MagickCore  7.0.3
resource.c
Go to the documentation of this file.
1 /*
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 % %
4 % %
5 % %
6 % RRRR EEEEE SSSSS OOO U U RRRR CCCC EEEEE %
7 % R R E SS O O U U R R C E %
8 % RRRR EEE SSS O O U U RRRR C EEE %
9 % R R E SS O O U U R R C E %
10 % R R EEEEE SSSSS OOO UUU R R CCCC EEEEE %
11 % %
12 % %
13 % Get/Set MagickCore Resources %
14 % %
15 % Software Design %
16 % Cristy %
17 % September 2002 %
18 % %
19 % %
20 % Copyright 1999-2019 ImageMagick Studio LLC, a non-profit organization %
21 % dedicated to making software imaging solutions freely available. %
22 % %
23 % You may not use this file except in compliance with the License. You may %
24 % obtain a copy of the License at %
25 % %
26 % https://imagemagick.org/script/license.php %
27 % %
28 % Unless required by applicable law or agreed to in writing, software %
29 % distributed under the License is distributed on an "AS IS" BASIS, %
30 % WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. %
31 % See the License for the specific language governing permissions and %
32 % limitations under the License. %
33 % %
34 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
35 %
36 %
37 */
38 
39 /*
40  Include declarations.
41 */
42 #include "MagickCore/studio.h"
43 #include "MagickCore/cache.h"
45 #include "MagickCore/configure.h"
46 #include "MagickCore/exception.h"
48 #include "MagickCore/linked-list.h"
49 #include "MagickCore/log.h"
50 #include "MagickCore/image.h"
52 #include "MagickCore/memory_.h"
54 #include "MagickCore/option.h"
55 #include "MagickCore/policy.h"
56 #include "MagickCore/random_.h"
57 #include "MagickCore/registry.h"
58 #include "MagickCore/resource_.h"
60 #include "MagickCore/semaphore.h"
62 #include "MagickCore/string_.h"
64 #include "MagickCore/splay-tree.h"
66 #include "MagickCore/token.h"
67 #include "MagickCore/utility.h"
69 
70 /*
71  Define declarations.
72 */
73 #define MagickPathTemplate "XXXXXXXXXXXX"
74 #define NumberOfResourceTypes \
75  (sizeof(resource_semaphore)/sizeof(*resource_semaphore))
76 
77 /*
78  Typedef declarations.
79 */
80 typedef struct _ResourceInfo
81 {
84  height,
86  area,
87  memory,
88  map,
89  disk,
90  file,
91  thread,
92  throttle,
93  time;
94 
99  area_limit,
100  memory_limit,
101  map_limit,
102  disk_limit,
103  file_limit,
104  thread_limit,
106  time_limit;
107 } ResourceInfo;
108 
109 /*
110  Global declarations.
111 */
112 static RandomInfo
113  *random_info = (RandomInfo *) NULL;
114 
115 static ResourceInfo
117  {
118  MagickULLConstant(0), /* initial width */
119  MagickULLConstant(0), /* initial height */
120  MagickULLConstant(0), /* initial list length */
121  MagickULLConstant(0), /* initial area */
122  MagickULLConstant(0), /* initial memory */
123  MagickULLConstant(0), /* initial map */
124  MagickULLConstant(0), /* initial disk */
125  MagickULLConstant(0), /* initial file */
126  MagickULLConstant(0), /* initial thread */
127  MagickULLConstant(0), /* initial throttle */
128  MagickULLConstant(0), /* initial time */
129  (INT_MAX/(5*sizeof(Quantum))), /* width limit */
130  (INT_MAX/(5*sizeof(Quantum))), /* height limit */
131  MagickResourceInfinity, /* list length limit */
132  MagickULLConstant(3072)*1024*1024, /* area limit */
133  MagickULLConstant(1536)*1024*1024, /* memory limit */
134  MagickULLConstant(3072)*1024*1024, /* map limit */
135  MagickResourceInfinity, /* disk limit */
136  MagickULLConstant(768), /* file limit */
137  MagickULLConstant(1), /* thread limit */
138  MagickULLConstant(0), /* throttle limit */
139  MagickResourceInfinity /* time limit */
140  };
141 
142 static SemaphoreInfo
144  (SemaphoreInfo *) NULL,
145  (SemaphoreInfo *) NULL,
146  (SemaphoreInfo *) NULL,
147  (SemaphoreInfo *) NULL,
148  (SemaphoreInfo *) NULL,
149  (SemaphoreInfo *) NULL,
150  (SemaphoreInfo *) NULL,
151  (SemaphoreInfo *) NULL,
152  (SemaphoreInfo *) NULL,
153  (SemaphoreInfo *) NULL,
154  (SemaphoreInfo *) NULL,
155  (SemaphoreInfo *) NULL
156  };
157 
158 static SplayTreeInfo
160 
161 /*
162 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
163 % %
164 % %
165 % %
166 % A c q u i r e M a g i c k R e s o u r c e %
167 % %
168 % %
169 % %
170 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
171 %
172 % AcquireMagickResource() acquires resources of the specified type.
173 % MagickFalse is returned if the specified resource is exhausted otherwise
174 % MagickTrue.
175 %
176 % The format of the AcquireMagickResource() method is:
177 %
178 % MagickBooleanType AcquireMagickResource(const ResourceType type,
179 % const MagickSizeType size)
180 %
181 % A description of each parameter follows:
182 %
183 % o type: the type of resource.
184 %
185 % o size: the number of bytes needed from for this resource.
186 %
187 */
189  const MagickSizeType size)
190 {
192  bi,
193  status;
194 
196  current,
197  request;
198 
200  limit;
201 
202  request=(MagickOffsetType) size;
203  if (request < 0)
204  return(MagickFalse);
205  limit=0;
206  current=0;
207  bi=MagickFalse;
208  status=MagickFalse;
209  switch (type)
210  {
211  case DiskResource:
212  case FileResource:
213  case MapResource:
214  case MemoryResource:
215  case TimeResource:
216  {
217  if (resource_semaphore[type] == (SemaphoreInfo *) NULL)
220  break;
221  }
222  default: ;
223  }
224  switch (type)
225  {
226  case AreaResource:
227  {
228  bi=MagickTrue;
229  resource_info.area=request;
231  if ((limit == MagickResourceInfinity) || (size < limit))
232  status=MagickTrue;
233  break;
234  }
235  case DiskResource:
236  {
237  bi=MagickTrue;
239  if ((resource_info.disk+request) > resource_info.disk)
240  {
241  resource_info.disk+=request;
242  if ((limit == MagickResourceInfinity) ||
243  (resource_info.disk < (MagickOffsetType) limit))
244  status=MagickTrue;
245  else
246  resource_info.disk-=request;
247  }
248  current=resource_info.disk;
249  break;
250  }
251  case FileResource:
252  {
254  if ((resource_info.file+request) > resource_info.file)
255  {
256  resource_info.file+=request;
257  if ((limit == MagickResourceInfinity) ||
258  (resource_info.file < (MagickOffsetType) limit))
259  status=MagickTrue;
260  }
261  current=resource_info.file;
262  break;
263  }
264  case HeightResource:
265  {
266  bi=MagickTrue;
267  resource_info.height=request;
269  if ((limit == MagickResourceInfinity) || (size < limit))
270  status=MagickTrue;
271  break;
272  }
273  case ListLengthResource:
274  {
275  resource_info.list_length=request;
277  if ((limit == MagickResourceInfinity) || (size < limit))
278  status=MagickTrue;
279  break;
280  }
281  case MapResource:
282  {
283  bi=MagickTrue;
284  limit=resource_info.map_limit;
285  if ((resource_info.map+request) > resource_info.map)
286  {
287  resource_info.map+=request;
288  if ((limit == MagickResourceInfinity) ||
289  (resource_info.map < (MagickOffsetType) limit))
290  status=MagickTrue;
291  else
292  resource_info.map-=request;
293  }
294  current=resource_info.map;
295  break;
296  }
297  case MemoryResource:
298  {
299  bi=MagickTrue;
301  if ((resource_info.memory+request) > resource_info.memory)
302  {
303  resource_info.memory+=request;
304  if ((limit == MagickResourceInfinity) ||
306  status=MagickTrue;
307  else
308  resource_info.memory-=request;
309  }
310  current=resource_info.memory;
311  break;
312  }
313  case ThreadResource:
314  {
316  if ((limit == MagickResourceInfinity) ||
318  status=MagickTrue;
319  break;
320  }
321  case ThrottleResource:
322  {
324  if ((limit == MagickResourceInfinity) ||
326  status=MagickTrue;
327  break;
328  }
329  case TimeResource:
330  {
332  if ((resource_info.time+request) > resource_info.time)
333  {
334  resource_info.time+=request;
335  if ((limit == MagickResourceInfinity) ||
336  (resource_info.time < (MagickOffsetType) limit))
337  status=MagickTrue;
338  else
339  resource_info.time-=request;
340  }
341  current=resource_info.time;
342  break;
343  }
344  case WidthResource:
345  {
346  bi=MagickTrue;
347  resource_info.width=request;
349  if ((limit == MagickResourceInfinity) || (size < limit))
350  status=MagickTrue;
351  break;
352  }
353  default:
354  {
355  current=0;
356  break;
357  }
358  }
359  switch (type)
360  {
361  case DiskResource:
362  case FileResource:
363  case MapResource:
364  case MemoryResource:
365  case TimeResource:
366  {
368  break;
369  }
370  default: ;
371  }
372  if (IsEventLogging() != MagickFalse)
373  {
374  char
375  resource_current[MagickFormatExtent],
376  resource_limit[MagickFormatExtent],
377  resource_request[MagickFormatExtent];
378 
379  (void) FormatMagickSize(size,bi,(bi != MagickFalse) ? "B" :
380  (const char *) NULL,MagickFormatExtent,resource_request);
381  (void) FormatMagickSize((MagickSizeType) current,bi,(bi != MagickFalse) ?
382  "B" : (const char *) NULL,MagickFormatExtent,resource_current);
383  (void) FormatMagickSize(limit,bi,(bi != MagickFalse) ? "B" :
384  (const char *) NULL,MagickFormatExtent,resource_limit);
385  (void) LogMagickEvent(ResourceEvent,GetMagickModule(),"%s: %s/%s/%s",
387  resource_request,resource_current,resource_limit);
388  }
389  return(status);
390 }
391 
392 /*
393 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
394 % %
395 % %
396 % %
397 + A s y n c h r o n o u s R e s o u r c e C o m p o n e n t T e r m i n u s %
398 % %
399 % %
400 % %
401 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
402 %
403 % AsynchronousResourceComponentTerminus() destroys the resource environment.
404 % It differs from ResourceComponentTerminus() in that it can be called from a
405 % asynchronous signal handler.
406 %
407 % The format of the ResourceComponentTerminus() method is:
408 %
409 % ResourceComponentTerminus(void)
410 %
411 */
413 {
414  const char
415  *path;
416 
417  if (temporary_resources == (SplayTreeInfo *) NULL)
418  return;
419  /*
420  Remove any lingering temporary files.
421  */
423  path=(const char *) GetNextKeyInSplayTree(temporary_resources);
424  while (path != (const char *) NULL)
425  {
426  (void) ShredFile(path);
427  path=(const char *) GetNextKeyInSplayTree(temporary_resources);
428  }
429 }
430 
431 /*
432 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
433 % %
434 % %
435 % %
436 % A c q u i r e U n i q u e F i l e R e s o u r c e %
437 % %
438 % %
439 % %
440 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
441 %
442 % AcquireUniqueFileResource() returns a unique file name, and returns a file
443 % descriptor for the file open for reading and writing.
444 %
445 % The format of the AcquireUniqueFileResource() method is:
446 %
447 % int AcquireUniqueFileResource(char *path)
448 %
449 % A description of each parameter follows:
450 %
451 % o path: Specifies a pointer to an array of characters. The unique path
452 % name is returned in this array.
453 %
454 */
455 
456 static void *DestroyTemporaryResources(void *temporary_resource)
457 {
458  (void) ShredFile((char *) temporary_resource);
459  temporary_resource=DestroyString((char *) temporary_resource);
460  return((void *) NULL);
461 }
462 
464 {
465  char
466  *directory,
467  *value;
468 
470  *exception;
471 
473  status;
474 
475  struct stat
476  attributes;
477 
478  (void) FormatLocaleString(path,MagickPathExtent,"magick-%.20g"
479  MagickPathTemplate,(double) getpid());
480  exception=AcquireExceptionInfo();
481  directory=(char *) GetImageRegistry(StringRegistryType,"temporary-path",
482  exception);
483  exception=DestroyExceptionInfo(exception);
484  if (directory == (char *) NULL)
485  directory=GetEnvironmentValue("MAGICK_TEMPORARY_PATH");
486  if (directory == (char *) NULL)
487  directory=GetEnvironmentValue("MAGICK_TMPDIR");
488  if (directory == (char *) NULL)
489  directory=GetEnvironmentValue("TMPDIR");
490 #if defined(MAGICKCORE_WINDOWS_SUPPORT) || defined(__OS2__) || defined(__CYGWIN__)
491  if (directory == (char *) NULL)
492  directory=GetEnvironmentValue("TMP");
493  if (directory == (char *) NULL)
494  directory=GetEnvironmentValue("TEMP");
495 #endif
496 #if defined(__VMS)
497  if (directory == (char *) NULL)
498  directory=GetEnvironmentValue("MTMPDIR");
499 #endif
500 #if defined(P_tmpdir)
501  if (directory == (char *) NULL)
502  directory=ConstantString(P_tmpdir);
503 #endif
504  if (directory == (char *) NULL)
505  return(MagickTrue);
506  value=GetPolicyValue("resource:temporary-path");
507  if (value != (char *) NULL)
508  {
509  (void) CloneString(&directory,value);
510  value=DestroyString(value);
511  }
512  if (strlen(directory) > (MagickPathExtent-25))
513  {
514  directory=DestroyString(directory);
515  return(MagickFalse);
516  }
517  status=GetPathAttributes(directory,&attributes);
518  if ((status == MagickFalse) || !S_ISDIR(attributes.st_mode))
519  {
520  directory=DestroyString(directory);
521  return(MagickFalse);
522  }
523  if (directory[strlen(directory)-1] == *DirectorySeparator)
525  "%smagick-%.20g" MagickPathTemplate,directory,(double) getpid());
526  else
528  "%s%smagick-%.20g" MagickPathTemplate,directory,DirectorySeparator,
529  (double) getpid());
530  directory=DestroyString(directory);
531 #if defined(MAGICKCORE_WINDOWS_SUPPORT)
532  {
533  register char
534  *p;
535 
536  /*
537  Ghostscript does not like backslashes so we need to replace them. The
538  forward slash also works under Windows.
539  */
540  for (p=(path[1] == *DirectorySeparator ? path+2 : path); *p != '\0'; p++)
541  if (*p == *DirectorySeparator)
542  *p='/';
543  }
544 #endif
545  return(MagickTrue);
546 }
547 
549 {
550 #if !defined(O_NOFOLLOW)
551 #define O_NOFOLLOW 0
552 #endif
553 #if !defined(TMP_MAX)
554 # define TMP_MAX 238328
555 #endif
556 
557  int
558  c,
559  file;
560 
561  register char
562  *p;
563 
564  register ssize_t
565  i;
566 
567  static const char
568  portable_filename[65] =
569  "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_-";
570 
571  StringInfo
572  *key;
573 
574  unsigned char
575  *datum;
576 
577  assert(path != (char *) NULL);
579  if (random_info == (RandomInfo *) NULL)
580  {
583  LockSemaphoreInfo(resource_semaphore[FileResource]);
584  if (random_info == (RandomInfo *) NULL)
587  }
588  file=(-1);
589  for (i=0; i < (ssize_t) TMP_MAX; i++)
590  {
591  register ssize_t
592  j;
593 
594  /*
595  Get temporary pathname.
596  */
597  (void) GetPathTemplate(path);
598  key=GetRandomKey(random_info,6);
599  p=path+strlen(path)-strlen(MagickPathTemplate);
600  datum=GetStringInfoDatum(key);
601  for (j=0; j < (ssize_t) GetStringInfoLength(key); j++)
602  {
603  c=(int) (datum[j] & 0x3f);
604  *p++=portable_filename[c];
605  }
606  key=DestroyStringInfo(key);
607 #if defined(MAGICKCORE_HAVE_MKSTEMP)
608  file=mkstemp(path);
609  if (file != -1)
610  {
611 #if defined(MAGICKCORE_HAVE_FCHMOD)
612  (void) fchmod(file,0600);
613 #endif
614 #if defined(__OS2__)
615  setmode(file,O_BINARY);
616 #endif
617  break;
618  }
619 #endif
621  p=path+strlen(path)-strlen(MagickPathTemplate);
622  datum=GetStringInfoDatum(key);
623  for (j=0; j < (ssize_t) GetStringInfoLength(key); j++)
624  {
625  c=(int) (datum[j] & 0x3f);
626  *p++=portable_filename[c];
627  }
628  key=DestroyStringInfo(key);
629  file=open_utf8(path,O_RDWR | O_CREAT | O_EXCL | O_BINARY | O_NOFOLLOW,
630  S_MODE);
631  if ((file >= 0) || (errno != EEXIST))
632  break;
633  }
634  (void) LogMagickEvent(ResourceEvent,GetMagickModule(),"%s",path);
635  if (file == -1)
636  return(file);
639  LockSemaphoreInfo(resource_semaphore[FileResource]);
640  if (temporary_resources == (SplayTreeInfo *) NULL)
642  DestroyTemporaryResources,(void *(*)(void *)) NULL);
645  (const void *) NULL);
646  return(file);
647 }
648 
649 /*
650 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
651 % %
652 % %
653 % %
654 % G e t M a g i c k R e s o u r c e %
655 % %
656 % %
657 % %
658 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
659 %
660 % GetMagickResource() returns the specified resource.
661 %
662 % The format of the GetMagickResource() method is:
663 %
664 % MagickSizeType GetMagickResource(const ResourceType type)
665 %
666 % A description of each parameter follows:
667 %
668 % o type: the type of resource.
669 %
670 */
672 {
674  resource;
675 
676  resource=0;
677  switch (type)
678  {
679  case DiskResource:
680  case FileResource:
681  case MapResource:
682  case MemoryResource:
683  case TimeResource:
684  {
685  if (resource_semaphore[type] == (SemaphoreInfo *) NULL)
688  break;
689  }
690  default: ;
691  }
692  switch (type)
693  {
694  case AreaResource:
695  {
696  resource=(MagickSizeType) resource_info.area;
697  break;
698  }
699  case DiskResource:
700  {
701  resource=(MagickSizeType) resource_info.disk;
702  break;
703  }
704  case FileResource:
705  {
706  resource=(MagickSizeType) resource_info.file;
707  break;
708  }
709  case HeightResource:
710  {
712  break;
713  }
714  case ListLengthResource:
715  {
717  break;
718  }
719  case MapResource:
720  {
721  resource=(MagickSizeType) resource_info.map;
722  break;
723  }
724  case MemoryResource:
725  {
727  break;
728  }
729  case TimeResource:
730  {
731  resource=(MagickSizeType) resource_info.time;
732  break;
733  }
734  case ThreadResource:
735  {
737  break;
738  }
739  case ThrottleResource:
740  {
742  break;
743  }
744  case WidthResource:
745  {
747  break;
748  }
749  default:
750  break;
751  }
752  switch (type)
753  {
754  case DiskResource:
755  case FileResource:
756  case MapResource:
757  case MemoryResource:
758  case TimeResource:
759  {
761  break;
762  }
763  default: ;
764  }
765  return(resource);
766 }
767 
768 /*
769 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
770 % %
771 % %
772 % %
773 % G e t M a g i c k R e s o u r c e L i m i t %
774 % %
775 % %
776 % %
777 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
778 %
779 % GetMagickResourceLimit() returns the specified resource limit.
780 %
781 % The format of the GetMagickResourceLimit() method is:
782 %
783 % MagickSizeType GetMagickResourceLimit(const ResourceType type)
784 %
785 % A description of each parameter follows:
786 %
787 % o type: the type of resource.
788 %
789 */
791 {
793  resource;
794 
795  switch (type)
796  {
797  case AreaResource:
798  return resource_info.area_limit;
799  case HeightResource:
801  case ListLengthResource:
803  case ThreadResource:
805  case ThrottleResource:
807  case WidthResource:
808  return resource_info.width_limit;
809  default: ;
810  }
811  resource=0;
812  if (resource_semaphore[type] == (SemaphoreInfo *) NULL)
815  switch (type)
816  {
817  case DiskResource:
818  {
819  resource=resource_info.disk_limit;
820  break;
821  }
822  case FileResource:
823  {
824  resource=resource_info.file_limit;
825  break;
826  }
827  case MapResource:
828  {
829  resource=resource_info.map_limit;
830  break;
831  }
832  case MemoryResource:
833  {
834  resource=resource_info.memory_limit;
835  break;
836  }
837  case TimeResource:
838  {
839  resource=resource_info.time_limit;
840  break;
841  }
842  default:
843  break;
844  }
846  return(resource);
847 }
848 
849 /*
850 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
851 % %
852 % %
853 % %
854 % L i s t M a g i c k R e s o u r c e I n f o %
855 % %
856 % %
857 % %
858 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
859 %
860 % ListMagickResourceInfo() lists the resource info to a file.
861 %
862 % The format of the ListMagickResourceInfo method is:
863 %
864 % MagickBooleanType ListMagickResourceInfo(FILE *file,
865 % ExceptionInfo *exception)
866 %
867 % A description of each parameter follows.
868 %
869 % o file: An pointer to a FILE.
870 %
871 % o exception: return any errors or warnings in this structure.
872 %
873 */
875  ExceptionInfo *magick_unused(exception))
876 {
877  char
878  area_limit[MagickFormatExtent],
879  disk_limit[MagickFormatExtent],
880  height_limit[MagickFormatExtent],
881  list_length_limit[MagickFormatExtent],
882  map_limit[MagickFormatExtent],
883  memory_limit[MagickFormatExtent],
884  time_limit[MagickFormatExtent],
885  width_limit[MagickFormatExtent];
886 
887  magick_unreferenced(exception);
888 
889  if (file == (const FILE *) NULL)
890  file=stdout;
893  LockSemaphoreInfo(resource_semaphore[FileResource]);
895  MagickFormatExtent,width_limit);
897  MagickFormatExtent,height_limit);
899  MagickFormatExtent,area_limit);
900  (void) CopyMagickString(list_length_limit,"unlimited",MagickFormatExtent);
903  MagickFormatExtent,list_length_limit);
905  MagickFormatExtent,memory_limit);
907  MagickFormatExtent,map_limit);
908  (void) CopyMagickString(disk_limit,"unlimited",MagickFormatExtent);
911  MagickFormatExtent,disk_limit);
912  (void) CopyMagickString(time_limit,"unlimited",MagickFormatExtent);
914  (void) FormatLocaleString(time_limit,MagickFormatExtent,"%.20g",(double)
916  (void) FormatLocaleFile(file,"Resource limits:\n");
917  (void) FormatLocaleFile(file," Width: %s\n",width_limit);
918  (void) FormatLocaleFile(file," Height: %s\n",height_limit);
919  (void) FormatLocaleFile(file," Area: %s\n",area_limit);
920  (void) FormatLocaleFile(file," List length: %s\n",list_length_limit);
921  (void) FormatLocaleFile(file," Memory: %s\n",memory_limit);
922  (void) FormatLocaleFile(file," Map: %s\n",map_limit);
923  (void) FormatLocaleFile(file," Disk: %s\n",disk_limit);
924  (void) FormatLocaleFile(file," File: %.20g\n",(double) ((MagickOffsetType)
926  (void) FormatLocaleFile(file," Thread: %.20g\n",(double) ((MagickOffsetType)
928  (void) FormatLocaleFile(file," Throttle: %.20g\n",(double)
930  (void) FormatLocaleFile(file," Time: %s\n",time_limit);
931  (void) fflush(file);
933  return(MagickTrue);
934 }
935 
936 /*
937 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
938 % %
939 % %
940 % %
941 % R e l i n q u i s h M a g i c k R e s o u r c e %
942 % %
943 % %
944 % %
945 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
946 %
947 % RelinquishMagickResource() relinquishes resources of the specified type.
948 %
949 % The format of the RelinquishMagickResource() method is:
950 %
951 % void RelinquishMagickResource(const ResourceType type,
952 % const MagickSizeType size)
953 %
954 % A description of each parameter follows:
955 %
956 % o type: the type of resource.
957 %
958 % o size: the size of the resource.
959 %
960 */
962  const MagickSizeType size)
963 {
965  bi;
966 
968  current,
969  limit;
970 
971  bi=MagickFalse;
972  limit=0;
973  current=0;
974  switch (type)
975  {
976  case DiskResource:
977  case FileResource:
978  case MapResource:
979  case MemoryResource:
980  case TimeResource:
981  {
982  if (resource_semaphore[type] == (SemaphoreInfo *) NULL)
985  break;
986  }
987  default: ;
988  }
989  switch (type)
990  {
991  case DiskResource:
992  {
993  bi=MagickTrue;
994  resource_info.disk-=size;
997  assert(resource_info.disk >= 0);
998  break;
999  }
1000  case FileResource:
1001  {
1002  resource_info.file-=size;
1003  current=(MagickSizeType) resource_info.file;
1004  limit=resource_info.file_limit;
1005  assert(resource_info.file >= 0);
1006  break;
1007  }
1008  case MapResource:
1009  {
1010  bi=MagickTrue;
1011  resource_info.map-=size;
1012  current=(MagickSizeType) resource_info.map;
1013  limit=resource_info.map_limit;
1014  assert(resource_info.map >= 0);
1015  break;
1016  }
1017  case MemoryResource:
1018  {
1019  bi=MagickTrue;
1020  resource_info.memory-=size;
1023  assert(resource_info.memory >= 0);
1024  break;
1025  }
1026  case TimeResource:
1027  {
1028  bi=MagickTrue;
1029  resource_info.time-=size;
1030  current=(MagickSizeType) resource_info.time;
1031  limit=resource_info.time_limit;
1032  assert(resource_info.time >= 0);
1033  break;
1034  }
1035  default:
1036  {
1037  current=0;
1038  break;
1039  }
1040  }
1041  switch (type)
1042  {
1043  case DiskResource:
1044  case FileResource:
1045  case MapResource:
1046  case MemoryResource:
1047  case TimeResource:
1048  {
1050  break;
1051  }
1052  default: ;
1053  }
1054  if (IsEventLogging() != MagickFalse)
1055  {
1056  char
1057  resource_current[MagickFormatExtent],
1058  resource_limit[MagickFormatExtent],
1059  resource_request[MagickFormatExtent];
1060 
1061  (void) FormatMagickSize(size,bi,(bi != MagickFalse) ? "B" :
1062  (const char *) NULL,MagickFormatExtent,resource_request);
1063  (void) FormatMagickSize(current,bi,(bi != MagickFalse) ? "B" :
1064  (const char *) NULL,MagickFormatExtent,resource_current);
1065  (void) FormatMagickSize(limit,bi,(bi != MagickFalse) ? "B" :
1066  (const char *) NULL,MagickFormatExtent,resource_limit);
1067  (void) LogMagickEvent(ResourceEvent,GetMagickModule(),"%s: %s/%s/%s",
1069  resource_request,resource_current,resource_limit);
1070  }
1071 }
1072 
1073 /*
1074 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1075 % %
1076 % %
1077 % %
1078 % R e l i n q u i s h U n i q u e F i l e R e s o u r c e %
1079 % %
1080 % %
1081 % %
1082 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1083 %
1084 % RelinquishUniqueFileResource() relinquishes a unique file resource.
1085 %
1086 % The format of the RelinquishUniqueFileResource() method is:
1087 %
1088 % MagickBooleanType RelinquishUniqueFileResource(const char *path)
1089 %
1090 % A description of each parameter follows:
1091 %
1092 % o name: the name of the temporary resource.
1093 %
1094 */
1096 {
1097  char
1098  cache_path[MagickPathExtent];
1099 
1101  status;
1102 
1103  assert(path != (const char *) NULL);
1104  status=MagickFalse;
1105  (void) LogMagickEvent(ResourceEvent,GetMagickModule(),"%s",path);
1108  LockSemaphoreInfo(resource_semaphore[FileResource]);
1109  if (temporary_resources != (SplayTreeInfo *) NULL)
1110  status=DeleteNodeFromSplayTree(temporary_resources,(const void *) path);
1111  UnlockSemaphoreInfo(resource_semaphore[FileResource]);
1112  (void) CopyMagickString(cache_path,path,MagickPathExtent);
1113  AppendImageFormat("cache",cache_path);
1114  if (access_utf8(cache_path,F_OK) == 0)
1115  (void) ShredFile(cache_path);
1116  if (status == MagickFalse)
1117  status=ShredFile(path);
1118  return(status);
1119 }
1120 
1121 /*
1122 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1123 % %
1124 % %
1125 % %
1126 + R e s o u r c e C o m p o n e n t G e n e s i s %
1127 % %
1128 % %
1129 % %
1130 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1131 %
1132 % ResourceComponentGenesis() instantiates the resource component.
1133 %
1134 % The format of the ResourceComponentGenesis method is:
1135 %
1136 % MagickBooleanType ResourceComponentGenesis(void)
1137 %
1138 */
1139 
1141 {
1142  char
1143  *limit;
1144 
1146  memory;
1147 
1148  register ssize_t
1149  i;
1150 
1151  ssize_t
1152  files,
1153  pages,
1154  pagesize;
1155 
1156  /*
1157  Set Magick resource limits.
1158  */
1159  for (i=0; i < (ssize_t) NumberOfResourceTypes; i++)
1160  if (resource_semaphore[i] == (SemaphoreInfo *) NULL)
1163  limit=GetEnvironmentValue("MAGICK_WIDTH_LIMIT");
1164  if (limit != (char *) NULL)
1165  {
1167  100.0));
1168  limit=DestroyString(limit);
1169  }
1171  limit=GetEnvironmentValue("MAGICK_HEIGHT_LIMIT");
1172  if (limit != (char *) NULL)
1173  {
1175  limit,100.0));
1176  limit=DestroyString(limit);
1177  }
1178  pagesize=GetMagickPageSize();
1179  pages=(-1);
1180 #if defined(MAGICKCORE_HAVE_SYSCONF) && defined(_SC_PHYS_PAGES)
1181  pages=(ssize_t) sysconf(_SC_PHYS_PAGES);
1182 #endif
1183  memory=(MagickSizeType) pages*pagesize;
1184  if ((pagesize <= 0) || (pages <= 0))
1185  memory=2048UL*1024UL*1024UL;
1186 #if defined(PixelCacheThreshold)
1187  memory=PixelCacheThreshold;
1188 #endif
1189  (void) SetMagickResourceLimit(AreaResource,2*memory);
1190  limit=GetEnvironmentValue("MAGICK_AREA_LIMIT");
1191  if (limit != (char *) NULL)
1192  {
1194  100.0));
1195  limit=DestroyString(limit);
1196  }
1197  (void) SetMagickResourceLimit(MemoryResource,memory);
1198  limit=GetEnvironmentValue("MAGICK_MEMORY_LIMIT");
1199  if (limit != (char *) NULL)
1200  {
1202  limit,100.0));
1203  limit=DestroyString(limit);
1204  }
1205  (void) SetMagickResourceLimit(MapResource,2*memory);
1206  limit=GetEnvironmentValue("MAGICK_MAP_LIMIT");
1207  if (limit != (char *) NULL)
1208  {
1210  100.0));
1211  limit=DestroyString(limit);
1212  }
1214  limit=GetEnvironmentValue("MAGICK_DISK_LIMIT");
1215  if (limit != (char *) NULL)
1216  {
1218  100.0));
1219  limit=DestroyString(limit);
1220  }
1221  files=(-1);
1222 #if defined(MAGICKCORE_HAVE_SYSCONF) && defined(_SC_OPEN_MAX)
1223  files=(ssize_t) sysconf(_SC_OPEN_MAX);
1224 #endif
1225 #if defined(MAGICKCORE_HAVE_GETRLIMIT) && defined(RLIMIT_NOFILE)
1226  if (files < 0)
1227  {
1228  struct rlimit
1229  resources;
1230 
1231  if (getrlimit(RLIMIT_NOFILE,&resources) != -1)
1232  files=(ssize_t) resources.rlim_cur;
1233  }
1234 #endif
1235 #if defined(MAGICKCORE_HAVE_GETDTABLESIZE) && defined(MAGICKCORE_POSIX_SUPPORT)
1236  if (files < 0)
1237  files=(ssize_t) getdtablesize();
1238 #endif
1239  if (files < 0)
1240  files=64;
1242  (3*files/4),64));
1243  limit=GetEnvironmentValue("MAGICK_FILE_LIMIT");
1244  if (limit != (char *) NULL)
1245  {
1247  100.0));
1248  limit=DestroyString(limit);
1249  }
1251  limit=GetEnvironmentValue("MAGICK_THREAD_LIMIT");
1252  if (limit != (char *) NULL)
1253  {
1255  limit,100.0));
1256  limit=DestroyString(limit);
1257  }
1259  limit=GetEnvironmentValue("MAGICK_THROTTLE_LIMIT");
1260  if (limit != (char *) NULL)
1261  {
1263  limit,100.0));
1264  limit=DestroyString(limit);
1265  }
1267  limit=GetEnvironmentValue("MAGICK_TIME_LIMIT");
1268  if (limit != (char *) NULL)
1269  {
1271  100.0));
1272  limit=DestroyString(limit);
1273  }
1275  limit=GetEnvironmentValue("MAGICK_LIST_LENGTH_LIMIT");
1276  if (limit != (char *) NULL)
1277  {
1279  StringToMagickSizeType(limit,100.0));
1280  limit=DestroyString(limit);
1281  }
1282  return(MagickTrue);
1283 }
1284 
1285 /*
1286 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1287 % %
1288 % %
1289 % %
1290 + R e s o u r c e C o m p o n e n t T e r m i n u s %
1291 % %
1292 % %
1293 % %
1294 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1295 %
1296 % ResourceComponentTerminus() destroys the resource component.
1297 %
1298 % The format of the ResourceComponentTerminus() method is:
1299 %
1300 % ResourceComponentTerminus(void)
1301 %
1302 */
1304 {
1305  register ssize_t
1306  i;
1307 
1308  for (i=0; i < (ssize_t) NumberOfResourceTypes; i++)
1309  if (resource_semaphore[i] == (SemaphoreInfo *) NULL)
1312  if (temporary_resources != (SplayTreeInfo *) NULL)
1314  if (random_info != (RandomInfo *) NULL)
1316  UnlockSemaphoreInfo(resource_semaphore[FileResource]);
1317  for (i=0; i < (ssize_t) NumberOfResourceTypes; i++)
1319 }
1320 
1321 /*
1322 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1323 % %
1324 % %
1325 % %
1326 % S e t M a g i c k R e s o u r c e L i m i t %
1327 % %
1328 % %
1329 % %
1330 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1331 %
1332 % SetMagickResourceLimit() sets the limit for a particular resource.
1333 %
1334 % The format of the SetMagickResourceLimit() method is:
1335 %
1336 % MagickBooleanType SetMagickResourceLimit(const ResourceType type,
1337 % const MagickSizeType limit)
1338 %
1339 % A description of each parameter follows:
1340 %
1341 % o type: the type of resource.
1342 %
1343 % o limit: the maximum limit for the resource.
1344 %
1345 */
1347  const MagickSizeType limit)
1348 {
1349  char
1350  *value;
1351 
1353  status;
1354 
1355  status=MagickTrue;
1356  value=(char *) NULL;
1357  switch (type)
1358  {
1359  case DiskResource:
1360  case FileResource:
1361  case MapResource:
1362  case MemoryResource:
1363  case TimeResource:
1364  {
1365  if (resource_semaphore[type] == (SemaphoreInfo *) NULL)
1368  break;
1369  }
1370  default: ;
1371  }
1372  switch (type)
1373  {
1374  case AreaResource:
1375  {
1376  value=GetPolicyValue("resource:area");
1377  if (value == (char *) NULL)
1378  resource_info.area_limit=limit;
1379  else
1381  100.0));
1382  break;
1383  }
1384  case DiskResource:
1385  {
1386  value=GetPolicyValue("resource:disk");
1387  if (value == (char *) NULL)
1388  resource_info.disk_limit=limit;
1389  else
1391  100.0));
1392  break;
1393  }
1394  case FileResource:
1395  {
1396  value=GetPolicyValue("resource:file");
1397  if (value == (char *) NULL)
1398  resource_info.file_limit=limit;
1399  else
1401  100.0));
1402  break;
1403  }
1404  case HeightResource:
1405  {
1406  value=GetPolicyValue("resource:height");
1407  if (value == (char *) NULL)
1409  else
1411  value,100.0));
1413  SSIZE_MAX);
1414  break;
1415  }
1416  case ListLengthResource:
1417  {
1418  value=GetPolicyValue("resource:list-length");
1419  if (value == (char *) NULL)
1421  else
1423  StringToMagickSizeType(value,100.0));
1424  break;
1425  }
1426  case MapResource:
1427  {
1428  value=GetPolicyValue("resource:map");
1429  if (value == (char *) NULL)
1430  resource_info.map_limit=limit;
1431  else
1433  value,100.0));
1434  break;
1435  }
1436  case MemoryResource:
1437  {
1438  value=GetPolicyValue("resource:memory");
1439  if (value == (char *) NULL)
1441  else
1443  value,100.0));
1444  break;
1445  }
1446  case ThreadResource:
1447  {
1448  value=GetPolicyValue("resource:thread");
1449  if (value == (char *) NULL)
1451  else
1453  value,100.0));
1456  else
1457  if (resource_info.thread_limit == 0)
1459  break;
1460  }
1461  case ThrottleResource:
1462  {
1463  value=GetPolicyValue("resource:throttle");
1464  if (value == (char *) NULL)
1466  else
1468  value,100.0));
1469  break;
1470  }
1471  case TimeResource:
1472  {
1473  value=GetPolicyValue("resource:time");
1474  if (value == (char *) NULL)
1475  resource_info.time_limit=limit;
1476  else
1478  100.0));
1480  break;
1481  }
1482  case WidthResource:
1483  {
1484  value=GetPolicyValue("resource:width");
1485  if (value == (char *) NULL)
1486  resource_info.width_limit=limit;
1487  else
1489  100.0));
1491  SSIZE_MAX);
1492  break;
1493  }
1494  default:
1495  {
1496  status=MagickFalse;
1497  break;
1498  }
1499  }
1500  switch (type)
1501  {
1502  case DiskResource:
1503  case FileResource:
1504  case MapResource:
1505  case MemoryResource:
1506  case TimeResource:
1507  {
1509  break;
1510  }
1511  default: ;
1512  }
1513  if (value != (char *) NULL)
1514  value=DestroyString(value);
1515  return(status);
1516 }
MagickExport ssize_t FormatMagickSize(const MagickSizeType size, const MagickBooleanType bi, const char *suffix, const size_t length, char *format)
Definition: string.c:1093
MagickPrivate MagickBooleanType ResourceComponentGenesis(void)
Definition: resource.c:1140
MagickOffsetType map
Definition: resource.c:83
MagickExport MagickBooleanType GetPathAttributes(const char *path, void *attributes)
Definition: utility.c:1165
MagickExport MagickBooleanType AddValueToSplayTree(SplayTreeInfo *splay_tree, const void *key, const void *value)
Definition: splay-tree.c:154
MagickExport void UnlockSemaphoreInfo(SemaphoreInfo *semaphore_info)
Definition: semaphore.c:450
MagickExport MagickBooleanType ListMagickResourceInfo(FILE *file, ExceptionInfo *magick_unused(exception))
Definition: resource.c:874
static void * DestroyTemporaryResources(void *temporary_resource)
Definition: resource.c:456
#define MagickULLConstant(c)
Definition: magick-type.h:36
struct _ResourceInfo ResourceInfo
MagickOffsetType file
Definition: resource.c:83
static size_t GetOpenMPMaximumThreads(void)
MagickOffsetType thread
Definition: resource.c:83
MagickSizeType height_limit
Definition: resource.c:96
static SemaphoreInfo * resource_semaphore[]
Definition: resource.c:143
MagickExport SemaphoreInfo * AcquireSemaphoreInfo(void)
Definition: semaphore.c:192
static ResourceInfo resource_info
Definition: resource.c:116
MagickSizeType map_limit
Definition: resource.c:96
MagickOffsetType memory
Definition: resource.c:83
MagickExport MagickBooleanType SetMagickResourceLimit(const ResourceType type, const MagickSizeType limit)
Definition: resource.c:1346
MagickOffsetType area
Definition: resource.c:83
#define S_ISDIR(mode)
Definition: studio.h:200
MagickSizeType area_limit
Definition: resource.c:96
MagickExport ExceptionInfo * AcquireExceptionInfo(void)
Definition: exception.c:115
MagickOffsetType time
Definition: resource.c:83
MagickExport ssize_t FormatLocaleString(char *magick_restrict string, const size_t length, const char *magick_restrict format,...)
Definition: locale.c:499
MagickExport void RelinquishMagickResource(const ResourceType type, const MagickSizeType size)
Definition: resource.c:961
#define O_BINARY
Definition: studio.h:325
MagickExport MagickBooleanType AcquireMagickResource(const ResourceType type, const MagickSizeType size)
Definition: resource.c:188
ssize_t MagickOffsetType
Definition: magick-type.h:129
MagickOffsetType disk
Definition: resource.c:83
MagickExport RandomInfo * DestroyRandomInfo(RandomInfo *random_info)
Definition: random.c:273
MagickExport void LockSemaphoreInfo(SemaphoreInfo *semaphore_info)
Definition: semaphore.c:293
MagickExport unsigned char * GetStringInfoDatum(const StringInfo *string_info)
Definition: string.c:1215
MagickSizeType memory_limit
Definition: resource.c:96
MagickExport ssize_t FormatLocaleFile(FILE *file, const char *magick_restrict format,...)
Definition: locale.c:404
MagickBooleanType
Definition: magick-type.h:158
#define DirectorySeparator
Definition: studio.h:259
MagickExport int AcquireUniqueFileResource(char *path)
Definition: resource.c:548
MagickPrivate ssize_t GetMagickPageSize(void)
Definition: utility.c:1122
MagickPrivate void AsynchronousResourceComponentTerminus(void)
MagickExport const char * CommandOptionToMnemonic(const CommandOption option, const ssize_t type)
Definition: option.c:2681
static SplayTreeInfo * temporary_resources
Definition: resource.c:159
MagickExport StringInfo * DestroyStringInfo(StringInfo *string_info)
Definition: string.c:850
MagickOffsetType list_length
Definition: resource.c:83
MagickSizeType time_limit
Definition: resource.c:96
MagickExport MagickBooleanType RelinquishUniqueFileResource(const char *path)
Definition: resource.c:1095
#define magick_unused(x)
MagickExport SplayTreeInfo * DestroySplayTree(SplayTreeInfo *splay_tree)
Definition: splay-tree.c:682
size_t MagickSizeType
Definition: magick-type.h:130
#define MagickPathExtent
MagickOffsetType width
Definition: resource.c:83
MagickExport MagickBooleanType IsEventLogging(void)
Definition: log.c:720
MagickExport SplayTreeInfo * NewSplayTree(int(*compare)(const void *, const void *), void *(*relinquish_key)(void *), void *(*relinquish_value)(void *))
Definition: splay-tree.c:1141
#define O_NOFOLLOW
MagickExport MagickBooleanType LogMagickEvent(const LogEventType type, const char *module, const char *function, const size_t line, const char *format,...)
Definition: log.c:1413
static int open_utf8(const char *path, int flags, mode_t mode)
MagickExport RandomInfo * AcquireRandomInfo(void)
Definition: random.c:163
MagickExport MagickSizeType GetMagickResourceLimit(const ResourceType type)
Definition: resource.c:790
MagickExport char * GetEnvironmentValue(const char *name)
Definition: string.c:1182
MagickExport size_t CopyMagickString(char *destination, const char *source, const size_t length)
Definition: string.c:755
MagickPrivate MagickBooleanType ShredFile(const char *)
Definition: utility.c:1811
#define S_MODE
Definition: studio.h:239
#define MagickMax(x, y)
Definition: image-private.h:26
MagickExport void AppendImageFormat(const char *format, char *filename)
Definition: utility.c:281
MagickPrivate void ResourceComponentTerminus(void)
Definition: resource.c:1303
ResourceType
Definition: resource_.h:25
MagickSizeType throttle_limit
Definition: resource.c:96
#define MagickFormatExtent
#define GetMagickModule()
Definition: log.h:28
MagickExport int CompareSplayTreeString(const void *target, const void *source)
Definition: splay-tree.c:412
MagickExport MagickSizeType GetMagickResource(const ResourceType type)
Definition: resource.c:671
#define MagickResourceInfinity
Definition: resource_.h:41
MagickExport const void * GetNextKeyInSplayTree(SplayTreeInfo *splay_tree)
Definition: splay-tree.c:769
unsigned short Quantum
Definition: magick-type.h:82
MagickExport char * DestroyString(char *string)
Definition: string.c:823
MagickExport void ActivateSemaphoreInfo(SemaphoreInfo **semaphore_info)
Definition: semaphore.c:97
MagickOffsetType throttle
Definition: resource.c:83
static MagickSizeType StringToMagickSizeType(const char *string, const double interval)
static int access_utf8(const char *path, int mode)
MagickSizeType list_length_limit
Definition: resource.c:96
MagickExport MagickBooleanType DeleteNodeFromSplayTree(SplayTreeInfo *splay_tree, const void *key)
Definition: splay-tree.c:603
#define MagickMin(x, y)
Definition: image-private.h:27
MagickExport char * GetPolicyValue(const char *name)
Definition: policy.c:506
MagickSizeType thread_limit
Definition: resource.c:96
MagickExport void ResetSplayTreeIterator(SplayTreeInfo *splay_tree)
Definition: splay-tree.c:1472
static RandomInfo * random_info
Definition: resource.c:113
MagickPrivate void ResetPixelCacheEpoch(void)
#define magick_unreferenced(x)
#define MagickPathTemplate
Definition: resource.c:73
MagickSizeType width_limit
Definition: resource.c:96
MagickExport void * GetImageRegistry(const RegistryType type, const char *key, ExceptionInfo *exception)
Definition: registry.c:187
MagickExport char * CloneString(char **destination, const char *source)
Definition: string.c:286
#define MagickPrivate
#define MagickExport
MagickOffsetType height
Definition: resource.c:83
MagickExport StringInfo * GetRandomKey(RandomInfo *random_info, const size_t length)
Definition: random.c:709
#define TMP_MAX
MagickSizeType file_limit
Definition: resource.c:96
MagickExport size_t GetStringInfoLength(const StringInfo *string_info)
Definition: string.c:1244
#define NumberOfResourceTypes
Definition: resource.c:74
MagickSizeType disk_limit
Definition: resource.c:96
MagickExport MagickBooleanType GetPathTemplate(char *path)
Definition: resource.c:463
MagickExport void RelinquishSemaphoreInfo(SemaphoreInfo **semaphore_info)
Definition: semaphore.c:351
MagickExport char * ConstantString(const char *source)
Definition: string.c:700
MagickExport ExceptionInfo * DestroyExceptionInfo(ExceptionInfo *exception)
Definition: exception.c:418