MagickCore  7.0.7
Convert, Edit, Or Compose Bitmap Images
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-2018 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://www.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 
75 /*
76  Typedef declarations.
77 */
78 typedef struct _ResourceInfo
79 {
82  height,
83  area,
84  memory,
85  map,
86  disk,
87  file,
88  thread,
89  throttle,
90  time;
91 
95  area_limit,
97  map_limit,
98  disk_limit,
99  file_limit,
100  thread_limit,
102  time_limit;
103 } ResourceInfo;
104 
105 /*
106  Global declarations.
107 */
108 static RandomInfo
109  *random_info = (RandomInfo *) NULL;
110 
111 static ResourceInfo
113  {
114  MagickULLConstant(0), /* initial width */
115  MagickULLConstant(0), /* initial height */
116  MagickULLConstant(0), /* initial area */
117  MagickULLConstant(0), /* initial memory */
118  MagickULLConstant(0), /* initial map */
119  MagickULLConstant(0), /* initial disk */
120  MagickULLConstant(0), /* initial file */
121  MagickULLConstant(0), /* initial thread */
122  MagickULLConstant(0), /* initial throttle */
123  MagickULLConstant(0), /* initial time */
124  (INT_MAX/(5*sizeof(Quantum))), /* width limit */
125  (INT_MAX/(5*sizeof(Quantum))), /* height limit */
126  MagickULLConstant(3072)*1024*1024, /* area limit */
127  MagickULLConstant(1536)*1024*1024, /* memory limit */
128  MagickULLConstant(3072)*1024*1024, /* map limit */
129  MagickResourceInfinity, /* disk limit */
130  MagickULLConstant(768), /* file limit */
131  MagickULLConstant(1), /* thread limit */
132  MagickULLConstant(0), /* throttle limit */
133  MagickResourceInfinity /* time limit */
134  };
135 
136 static SemaphoreInfo
138 
139 static SplayTreeInfo
141 
142 /*
143 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
144 % %
145 % %
146 % %
147 % A c q u i r e M a g i c k R e s o u r c e %
148 % %
149 % %
150 % %
151 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
152 %
153 % AcquireMagickResource() acquires resources of the specified type.
154 % MagickFalse is returned if the specified resource is exhausted otherwise
155 % MagickTrue.
156 %
157 % The format of the AcquireMagickResource() method is:
158 %
159 % MagickBooleanType AcquireMagickResource(const ResourceType type,
160 % const MagickSizeType size)
161 %
162 % A description of each parameter follows:
163 %
164 % o type: the type of resource.
165 %
166 % o size: the number of bytes needed from for this resource.
167 %
168 */
170  const MagickSizeType size)
171 {
172  char
173  resource_current[MagickFormatExtent],
174  resource_limit[MagickFormatExtent],
175  resource_request[MagickFormatExtent];
176 
178  logging,
179  status;
180 
182  limit;
183 
184  if ((MagickOffsetType) size < 0)
185  return(MagickFalse);
186  status=MagickFalse;
187  logging=IsEventLogging();
188  if (resource_semaphore == (SemaphoreInfo *) NULL)
191  switch (type)
192  {
193  case AreaResource:
194  {
197  if ((limit == MagickResourceInfinity) || (size < limit))
198  status=MagickTrue;
199  if (logging != MagickFalse)
200  {
201  (void) FormatMagickSize(size,MagickFalse,(const char *) NULL,
202  MagickFormatExtent,resource_request);
203  (void) FormatMagickSize(size,MagickFalse,(const char *) NULL,
204  MagickFormatExtent,resource_current);
205  (void) FormatMagickSize(limit,MagickFalse,(const char *) NULL,
206  MagickFormatExtent,resource_limit);
207  }
208  break;
209  }
210  case MemoryResource:
211  {
212  if ((resource_info.memory+(MagickOffsetType) size) < 0)
213  return(MagickFalse);
216  if ((limit == MagickResourceInfinity) ||
218  status=MagickTrue;
219  else
221  if (logging != MagickFalse)
222  {
224  resource_request);
226  MagickTrue,"B",MagickFormatExtent,resource_current);
227  (void) FormatMagickSize(limit,MagickTrue,"B",MagickFormatExtent,
228  resource_limit);
229  }
230  break;
231  }
232  case MapResource:
233  {
234  if ((resource_info.map+(MagickOffsetType) size) < 0)
235  return(MagickFalse);
237  limit=resource_info.map_limit;
238  if ((limit == MagickResourceInfinity) ||
239  (resource_info.map < (MagickOffsetType) limit))
240  status=MagickTrue;
241  else
243  if (logging != MagickFalse)
244  {
246  resource_request);
248  MagickTrue,"B",MagickFormatExtent,resource_current);
249  (void) FormatMagickSize(limit,MagickTrue,"B",MagickFormatExtent,
250  resource_limit);
251  }
252  break;
253  }
254  case DiskResource:
255  {
256  if ((resource_info.disk+(MagickOffsetType) size) < 0)
257  return(MagickFalse);
260  if ((limit == MagickResourceInfinity) ||
261  (resource_info.disk < (MagickOffsetType) limit))
262  status=MagickTrue;
263  else
265  if (logging != MagickFalse)
266  {
268  resource_request);
270  MagickTrue,"B",MagickFormatExtent,resource_current);
271  (void) FormatMagickSize(limit,MagickTrue,"B",MagickFormatExtent,
272  resource_limit);
273  }
274  break;
275  }
276  case FileResource:
277  {
278  if ((resource_info.file+(MagickOffsetType) size) < 0)
279  return(MagickFalse);
282  if ((limit == MagickResourceInfinity) ||
283  (resource_info.file < (MagickOffsetType) limit))
284  status=MagickTrue;
285  else
287  if (logging != MagickFalse)
288  {
289  (void) FormatMagickSize(size,MagickFalse,(const char *) NULL,
290  MagickFormatExtent,resource_request);
292  MagickFalse,(const char *) NULL,MagickFormatExtent,
293  resource_current);
294  (void) FormatMagickSize(limit,MagickTrue,(const char *) NULL,
295  MagickFormatExtent,resource_limit);
296  }
297  break;
298  }
299  case HeightResource:
300  {
303  if ((limit == MagickResourceInfinity) || (size < limit))
304  status=MagickTrue;
305  if (logging != MagickFalse)
306  {
308  resource_request);
310  resource_current);
312  resource_limit);
313  }
314  break;
315  }
316  case ThreadResource:
317  {
319  if ((limit == MagickResourceInfinity) ||
321  status=MagickTrue;
322  if (logging != MagickFalse)
323  {
324  (void) FormatMagickSize(size,MagickFalse,(const char *) NULL,
325  MagickFormatExtent,resource_request);
327  MagickFalse,(const char *) NULL,MagickFormatExtent,
328  resource_current);
329  (void) FormatMagickSize(limit,MagickFalse,(const char *) NULL,
330  MagickFormatExtent,resource_limit);
331  }
332  break;
333  }
334  case ThrottleResource:
335  {
337  if ((limit == MagickResourceInfinity) ||
339  status=MagickTrue;
340  if (logging != MagickFalse)
341  {
342  (void) FormatMagickSize(size,MagickFalse,(const char *) NULL,
343  MagickFormatExtent,resource_request);
345  MagickFalse,(const char *) NULL,MagickFormatExtent,
346  resource_current);
347  (void) FormatMagickSize(limit,MagickFalse,(const char *) NULL,
348  MagickFormatExtent,resource_limit);
349  }
350  break;
351  }
352  case TimeResource:
353  {
354  if ((resource_info.time+(MagickOffsetType) size) < 0)
355  return(MagickFalse);
358  if ((limit == MagickResourceInfinity) ||
359  (resource_info.time < (MagickOffsetType) limit))
360  status=MagickTrue;
361  else
363  if (logging != MagickFalse)
364  {
365  (void) FormatMagickSize(size,MagickFalse,(const char *) NULL,
366  MagickFormatExtent,resource_request);
368  MagickFalse,(const char *) NULL,MagickFormatExtent,
369  resource_current);
370  (void) FormatMagickSize(limit,MagickFalse,(const char *) NULL,
371  MagickFormatExtent,resource_limit);
372  }
373  break;
374  }
375  case WidthResource:
376  {
379  if ((limit == MagickResourceInfinity) || (size < limit))
380  status=MagickTrue;
381  if (logging != MagickFalse)
382  {
384  resource_request);
386  resource_current);
388  resource_limit);
389  }
390  break;
391  }
392  default:
393  break;
394  }
396  if (logging != MagickFalse)
397  {
398  (void) LogMagickEvent(ResourceEvent,GetMagickModule(),"%s: %s/%s/%s",
400  resource_request,resource_current,resource_limit);
401  }
402  return(status);
403 }
404 
405 /*
406 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
407 % %
408 % %
409 % %
410 + 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 %
411 % %
412 % %
413 % %
414 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
415 %
416 % AsynchronousResourceComponentTerminus() destroys the resource environment.
417 % It differs from ResourceComponentTerminus() in that it can be called from a
418 % asynchronous signal handler.
419 %
420 % The format of the ResourceComponentTerminus() method is:
421 %
422 % ResourceComponentTerminus(void)
423 %
424 */
426 {
427  const char
428  *path;
429 
430  if (temporary_resources == (SplayTreeInfo *) NULL)
431  return;
432  /*
433  Remove any lingering temporary files.
434  */
436  path=(const char *) GetNextKeyInSplayTree(temporary_resources);
437  while (path != (const char *) NULL)
438  {
439  (void) ShredFile(path);
440  path=(const char *) GetNextKeyInSplayTree(temporary_resources);
441  }
442 }
443 
444 /*
445 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
446 % %
447 % %
448 % %
449 % 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 %
450 % %
451 % %
452 % %
453 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
454 %
455 % AcquireUniqueFileResource() returns a unique file name, and returns a file
456 % descriptor for the file open for reading and writing.
457 %
458 % The format of the AcquireUniqueFileResource() method is:
459 %
460 % int AcquireUniqueFileResource(char *path)
461 %
462 % A description of each parameter follows:
463 %
464 % o path: Specifies a pointer to an array of characters. The unique path
465 % name is returned in this array.
466 %
467 */
468 
469 static void *DestroyTemporaryResources(void *temporary_resource)
470 {
471  (void) ShredFile((char *) temporary_resource);
472  temporary_resource=DestroyString((char *) temporary_resource);
473  return((void *) NULL);
474 }
475 
477 {
478  char
479  *directory,
480  *value;
481 
483  *exception;
484 
486  status;
487 
488  struct stat
489  attributes;
490 
491  (void) FormatLocaleString(path,MagickPathExtent,"magick-%.20g"
492  MagickPathTemplate,(double) getpid());
493  exception=AcquireExceptionInfo();
494  directory=(char *) GetImageRegistry(StringRegistryType,"temporary-path",
495  exception);
496  exception=DestroyExceptionInfo(exception);
497  if (directory == (char *) NULL)
498  directory=GetEnvironmentValue("MAGICK_TEMPORARY_PATH");
499  if (directory == (char *) NULL)
500  directory=GetEnvironmentValue("MAGICK_TMPDIR");
501  if (directory == (char *) NULL)
502  directory=GetEnvironmentValue("TMPDIR");
503 #if defined(MAGICKCORE_WINDOWS_SUPPORT) || defined(__OS2__) || defined(__CYGWIN__)
504  if (directory == (char *) NULL)
505  directory=GetEnvironmentValue("TMP");
506  if (directory == (char *) NULL)
507  directory=GetEnvironmentValue("TEMP");
508 #endif
509 #if defined(__VMS)
510  if (directory == (char *) NULL)
511  directory=GetEnvironmentValue("MTMPDIR");
512 #endif
513 #if defined(P_tmpdir)
514  if (directory == (char *) NULL)
515  directory=ConstantString(P_tmpdir);
516 #endif
517  if (directory == (char *) NULL)
518  return(MagickTrue);
519  value=GetPolicyValue("resource:temporary-path");
520  if (value != (char *) NULL)
521  {
522  (void) CloneString(&directory,value);
523  value=DestroyString(value);
524  }
525  if (strlen(directory) > (MagickPathExtent-25))
526  {
527  directory=DestroyString(directory);
528  return(MagickFalse);
529  }
530  status=GetPathAttributes(directory,&attributes);
531  if ((status == MagickFalse) || !S_ISDIR(attributes.st_mode))
532  {
533  directory=DestroyString(directory);
534  return(MagickFalse);
535  }
536  if (directory[strlen(directory)-1] == *DirectorySeparator)
538  "%smagick-%.20g" MagickPathTemplate,directory,(double) getpid());
539  else
541  "%s%smagick-%.20g" MagickPathTemplate,directory,DirectorySeparator,
542  (double) getpid());
543  directory=DestroyString(directory);
544 #if defined(MAGICKCORE_WINDOWS_SUPPORT)
545  {
546  register char
547  *p;
548 
549  /*
550  Ghostscript does not like backslashes so we need to replace them. The
551  forward slash also works under Windows.
552  */
553  for (p=(path[1] == *DirectorySeparator ? path+2 : path); *p != '\0'; p++)
554  if (*p == *DirectorySeparator)
555  *p='/';
556  }
557 #endif
558  return(MagickTrue);
559 }
560 
562 {
563 #if !defined(O_NOFOLLOW)
564 #define O_NOFOLLOW 0
565 #endif
566 #if !defined(TMP_MAX)
567 # define TMP_MAX 238328
568 #endif
569 
570  int
571  c,
572  file;
573 
574  register char
575  *p;
576 
577  register ssize_t
578  i;
579 
580  static const char
581  portable_filename[65] =
582  "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_-";
583 
584  StringInfo
585  *key;
586 
587  unsigned char
588  *datum;
589 
590  assert(path != (char *) NULL);
592  if (random_info == (RandomInfo *) NULL)
593  {
595  if (random_info == (RandomInfo *) NULL)
598  }
599  file=(-1);
600  for (i=0; i < (ssize_t) TMP_MAX; i++)
601  {
602  register ssize_t
603  j;
604 
605  /*
606  Get temporary pathname.
607  */
608  (void) GetPathTemplate(path);
609  key=GetRandomKey(random_info,6);
610  p=path+strlen(path)-strlen(MagickPathTemplate);
611  datum=GetStringInfoDatum(key);
612  for (j=0; j < (ssize_t) GetStringInfoLength(key); j++)
613  {
614  c=(int) (datum[j] & 0x3f);
615  *p++=portable_filename[c];
616  }
617  key=DestroyStringInfo(key);
618 #if defined(MAGICKCORE_HAVE_MKSTEMP)
619  file=mkstemp(path);
620  if (file != -1)
621  {
622 #if defined(MAGICKCORE_HAVE_FCHMOD)
623  (void) fchmod(file,0600);
624 #endif
625 #if defined(__OS2__)
626  setmode(file,O_BINARY);
627 #endif
628  break;
629  }
630 #endif
632  p=path+strlen(path)-strlen(MagickPathTemplate);
633  datum=GetStringInfoDatum(key);
634  for (j=0; j < (ssize_t) GetStringInfoLength(key); j++)
635  {
636  c=(int) (datum[j] & 0x3f);
637  *p++=portable_filename[c];
638  }
639  key=DestroyStringInfo(key);
640  file=open_utf8(path,O_RDWR | O_CREAT | O_EXCL | O_BINARY | O_NOFOLLOW,
641  S_MODE);
642  if ((file >= 0) || (errno != EEXIST))
643  break;
644  }
645  (void) LogMagickEvent(ResourceEvent,GetMagickModule(),"%s",path);
646  if (file == -1)
647  return(file);
648  if (resource_semaphore == (SemaphoreInfo *) NULL)
651  if (temporary_resources == (SplayTreeInfo *) NULL)
653  DestroyTemporaryResources,(void *(*)(void *)) NULL);
656  (const void *) NULL);
657  return(file);
658 }
659 
660 /*
661 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
662 % %
663 % %
664 % %
665 % G e t M a g i c k R e s o u r c e %
666 % %
667 % %
668 % %
669 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
670 %
671 % GetMagickResource() returns the specified resource.
672 %
673 % The format of the GetMagickResource() method is:
674 %
675 % MagickSizeType GetMagickResource(const ResourceType type)
676 %
677 % A description of each parameter follows:
678 %
679 % o type: the type of resource.
680 %
681 */
683 {
685  resource;
686 
687  resource=0;
689  switch (type)
690  {
691  case WidthResource:
692  {
694  break;
695  }
696  case HeightResource:
697  {
699  break;
700  }
701  case AreaResource:
702  {
703  resource=(MagickSizeType) resource_info.area;
704  break;
705  }
706  case MemoryResource:
707  {
709  break;
710  }
711  case MapResource:
712  {
713  resource=(MagickSizeType) resource_info.map;
714  break;
715  }
716  case DiskResource:
717  {
718  resource=(MagickSizeType) resource_info.disk;
719  break;
720  }
721  case FileResource:
722  {
723  resource=(MagickSizeType) resource_info.file;
724  break;
725  }
726  case ThreadResource:
727  {
729  break;
730  }
731  case ThrottleResource:
732  {
734  break;
735  }
736  case TimeResource:
737  {
738  resource=(MagickSizeType) resource_info.time;
739  break;
740  }
741  default:
742  break;
743  }
745  return(resource);
746 }
747 
748 /*
749 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
750 % %
751 % %
752 % %
753 % G e t M a g i c k R e s o u r c e L i m i t %
754 % %
755 % %
756 % %
757 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
758 %
759 % GetMagickResourceLimit() returns the specified resource limit.
760 %
761 % The format of the GetMagickResourceLimit() method is:
762 %
763 % MagickSizeType GetMagickResourceLimit(const ResourceType type)
764 %
765 % A description of each parameter follows:
766 %
767 % o type: the type of resource.
768 %
769 */
771 {
773  resource;
774 
775  resource=0;
776  if (resource_semaphore == (SemaphoreInfo *) NULL)
779  switch (type)
780  {
781  case WidthResource:
782  {
783  resource=resource_info.width_limit;
784  break;
785  }
786  case HeightResource:
787  {
788  resource=resource_info.height_limit;
789  break;
790  }
791  case AreaResource:
792  {
793  resource=resource_info.area_limit;
794  break;
795  }
796  case MemoryResource:
797  {
798  resource=resource_info.memory_limit;
799  break;
800  }
801  case MapResource:
802  {
803  resource=resource_info.map_limit;
804  break;
805  }
806  case DiskResource:
807  {
808  resource=resource_info.disk_limit;
809  break;
810  }
811  case FileResource:
812  {
813  resource=resource_info.file_limit;
814  break;
815  }
816  case ThreadResource:
817  {
818  resource=resource_info.thread_limit;
819  break;
820  }
821  case ThrottleResource:
822  {
823  resource=resource_info.throttle_limit;
824  break;
825  }
826  case TimeResource:
827  {
828  resource=resource_info.time_limit;
829  break;
830  }
831  default:
832  break;
833  }
835  return(resource);
836 }
837 
838 /*
839 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
840 % %
841 % %
842 % %
843 % L i s t M a g i c k R e s o u r c e I n f o %
844 % %
845 % %
846 % %
847 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
848 %
849 % ListMagickResourceInfo() lists the resource info to a file.
850 %
851 % The format of the ListMagickResourceInfo method is:
852 %
853 % MagickBooleanType ListMagickResourceInfo(FILE *file,
854 % ExceptionInfo *exception)
855 %
856 % A description of each parameter follows.
857 %
858 % o file: An pointer to a FILE.
859 %
860 % o exception: return any errors or warnings in this structure.
861 %
862 */
864  ExceptionInfo *magick_unused(exception))
865 {
866  char
874 
875  magick_unreferenced(exception);
876 
877  if (file == (const FILE *) NULL)
878  file=stdout;
879  if (resource_semaphore == (SemaphoreInfo *) NULL)
883  MagickFormatExtent,width_limit);
885  MagickFormatExtent,height_limit);
887  MagickFormatExtent,area_limit);
889  MagickFormatExtent,memory_limit);
891  MagickFormatExtent,map_limit);
892  (void) CopyMagickString(disk_limit,"unlimited",MagickFormatExtent);
895  MagickFormatExtent,disk_limit);
896  (void) CopyMagickString(time_limit,"unlimited",MagickFormatExtent);
898  (void) FormatLocaleString(time_limit,MagickFormatExtent,"%.20g",(double)
900  (void) FormatLocaleFile(file,"Resource limits:\n");
901  (void) FormatLocaleFile(file," Width: %s\n",width_limit);
902  (void) FormatLocaleFile(file," Height: %s\n",height_limit);
903  (void) FormatLocaleFile(file," Area: %s\n",area_limit);
904  (void) FormatLocaleFile(file," Memory: %s\n",memory_limit);
905  (void) FormatLocaleFile(file," Map: %s\n",map_limit);
906  (void) FormatLocaleFile(file," Disk: %s\n",disk_limit);
907  (void) FormatLocaleFile(file," File: %.20g\n",(double) ((MagickOffsetType)
909  (void) FormatLocaleFile(file," Thread: %.20g\n",(double) ((MagickOffsetType)
911  (void) FormatLocaleFile(file," Throttle: %.20g\n",(double)
913  (void) FormatLocaleFile(file," Time: %s\n",time_limit);
914  (void) fflush(file);
916  return(MagickTrue);
917 }
918 
919 /*
920 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
921 % %
922 % %
923 % %
924 % R e l i n q u i s h M a g i c k R e s o u r c e %
925 % %
926 % %
927 % %
928 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
929 %
930 % RelinquishMagickResource() relinquishes resources of the specified type.
931 %
932 % The format of the RelinquishMagickResource() method is:
933 %
934 % void RelinquishMagickResource(const ResourceType type,
935 % const MagickSizeType size)
936 %
937 % A description of each parameter follows:
938 %
939 % o type: the type of resource.
940 %
941 % o size: the size of the resource.
942 %
943 */
945  const MagickSizeType size)
946 {
947  char
948  resource_current[MagickFormatExtent],
949  resource_limit[MagickFormatExtent],
950  resource_request[MagickFormatExtent];
951 
953  logging;
954 
955  logging=IsEventLogging();
956  if (resource_semaphore == (SemaphoreInfo *) NULL)
959  switch (type)
960  {
961  case AreaResource:
962  {
964  if (logging != MagickFalse)
965  {
966  (void) FormatMagickSize(size,MagickFalse,(const char *) NULL,
967  MagickFormatExtent,resource_request);
969  MagickFalse,(const char *) NULL,MagickFormatExtent,
970  resource_current);
972  (const char *) NULL,MagickFormatExtent,resource_limit);
973  }
974  break;
975  }
976  case MemoryResource:
977  {
978  resource_info.memory-=size;
979  assert(resource_info.memory >= 0);
980  if (logging != MagickFalse)
981  {
983  resource_request);
985  MagickTrue,"B",MagickFormatExtent,resource_current);
987  MagickFormatExtent,resource_limit);
988  }
989  break;
990  }
991  case MapResource:
992  {
993  resource_info.map-=size;
994  assert(resource_info.map >= 0);
995  if (logging != MagickFalse)
996  {
998  resource_request);
1000  MagickTrue,"B",MagickFormatExtent,resource_current);
1002  MagickFormatExtent,resource_limit);
1003  }
1004  break;
1005  }
1006  case DiskResource:
1007  {
1008  resource_info.disk-=size;
1009  assert(resource_info.disk >= 0);
1010  if (logging != MagickFalse)
1011  {
1013  resource_request);
1015  MagickTrue,"B",MagickFormatExtent,resource_current);
1017  MagickFormatExtent,resource_limit);
1018  }
1019  break;
1020  }
1021  case FileResource:
1022  {
1023  resource_info.file-=size;
1024  assert(resource_info.file >= 0);
1025  if (logging != MagickFalse)
1026  {
1027  (void) FormatMagickSize(size,MagickFalse,(const char *) NULL,
1028  MagickFormatExtent,resource_request);
1030  MagickFalse,(const char *) NULL,MagickFormatExtent,
1031  resource_current);
1033  MagickFalse,(const char *) NULL,MagickFormatExtent,resource_limit);
1034  }
1035  break;
1036  }
1037  case HeightResource:
1038  {
1040  if (logging != MagickFalse)
1041  {
1043  resource_request);
1045  MagickFalse,"P",MagickFormatExtent,resource_current);
1047  MagickFormatExtent,resource_limit);
1048  }
1049  break;
1050  }
1051  case ThreadResource:
1052  {
1053  if (logging != MagickFalse)
1054  {
1055  (void) FormatMagickSize(size,MagickFalse,(const char *) NULL,
1056  MagickFormatExtent,resource_request);
1058  MagickFalse,(const char *) NULL,MagickFormatExtent,
1059  resource_current);
1061  MagickFalse,(const char *) NULL,MagickFormatExtent,resource_limit);
1062  }
1063  break;
1064  }
1065  case ThrottleResource:
1066  {
1067  if (logging != MagickFalse)
1068  {
1069  (void) FormatMagickSize(size,MagickFalse,(const char *) NULL,
1070  MagickFormatExtent,resource_request);
1072  MagickFalse,(const char *) NULL,MagickFormatExtent,
1073  resource_current);
1075  MagickFalse,(const char *) NULL,MagickFormatExtent,resource_limit);
1076  }
1077  break;
1078  }
1079  case TimeResource:
1080  {
1081  resource_info.time-=size;
1082  assert(resource_info.time >= 0);
1083  if (logging != MagickFalse)
1084  {
1085  (void) FormatMagickSize(size,MagickFalse,(const char *) NULL,
1086  MagickFormatExtent,resource_request);
1088  MagickFalse,(const char *) NULL,MagickFormatExtent,
1089  resource_current);
1091  MagickFalse,(const char *) NULL,MagickFormatExtent,resource_limit);
1092  }
1093  break;
1094  }
1095  case WidthResource:
1096  {
1098  if (logging != MagickFalse)
1099  {
1101  resource_request);
1103  MagickFalse,"P",MagickFormatExtent,resource_current);
1105  MagickFormatExtent,resource_limit);
1106  }
1107  break;
1108  }
1109  default:
1110  break;
1111  }
1113  if (logging != MagickFalse)
1114  {
1115  (void) LogMagickEvent(ResourceEvent,GetMagickModule(),"%s: %s/%s/%s",
1117  resource_request,resource_current,resource_limit);
1118  }
1119 }
1120 
1121 /*
1122 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1123 % %
1124 % %
1125 % %
1126 % 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 %
1127 % %
1128 % %
1129 % %
1130 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1131 %
1132 % RelinquishUniqueFileResource() relinquishes a unique file resource.
1133 %
1134 % The format of the RelinquishUniqueFileResource() method is:
1135 %
1136 % MagickBooleanType RelinquishUniqueFileResource(const char *path)
1137 %
1138 % A description of each parameter follows:
1139 %
1140 % o name: the name of the temporary resource.
1141 %
1142 */
1144 {
1145  char
1146  cache_path[MagickPathExtent];
1147 
1149  status;
1150 
1151  assert(path != (const char *) NULL);
1152  status=MagickFalse;
1153  (void) LogMagickEvent(ResourceEvent,GetMagickModule(),"%s",path);
1154  if (resource_semaphore == (SemaphoreInfo *) NULL)
1157  if (temporary_resources != (SplayTreeInfo *) NULL)
1158  status=DeleteNodeFromSplayTree(temporary_resources,(const void *) path);
1160  (void) CopyMagickString(cache_path,path,MagickPathExtent);
1161  AppendImageFormat("cache",cache_path);
1162  (void) ShredFile(cache_path);
1163  if (status == MagickFalse)
1164  status=ShredFile(path);
1165  return(status);
1166 }
1167 
1168 /*
1169 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1170 % %
1171 % %
1172 % %
1173 + R e s o u r c e C o m p o n e n t G e n e s i s %
1174 % %
1175 % %
1176 % %
1177 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1178 %
1179 % ResourceComponentGenesis() instantiates the resource component.
1180 %
1181 % The format of the ResourceComponentGenesis method is:
1182 %
1183 % MagickBooleanType ResourceComponentGenesis(void)
1184 %
1185 */
1186 
1188 {
1189  char
1190  *limit;
1191 
1193  memory;
1194 
1195  ssize_t
1196  files,
1197  pages,
1198  pagesize;
1199 
1200  /*
1201  Set Magick resource limits.
1202  */
1203  if (resource_semaphore == (SemaphoreInfo *) NULL)
1206  limit=GetEnvironmentValue("MAGICK_WIDTH_LIMIT");
1207  if (limit != (char *) NULL)
1208  {
1210  100.0));
1211  limit=DestroyString(limit);
1212  }
1214  limit=GetEnvironmentValue("MAGICK_HEIGHT_LIMIT");
1215  if (limit != (char *) NULL)
1216  {
1218  limit,100.0));
1219  limit=DestroyString(limit);
1220  }
1221  pagesize=GetMagickPageSize();
1222  pages=(-1);
1223 #if defined(MAGICKCORE_HAVE_SYSCONF) && defined(_SC_PHYS_PAGES)
1224  pages=(ssize_t) sysconf(_SC_PHYS_PAGES);
1225 #endif
1226  memory=(MagickSizeType) pages*pagesize;
1227  if ((pagesize <= 0) || (pages <= 0))
1228  memory=2048UL*1024UL*1024UL;
1229 #if defined(PixelCacheThreshold)
1230  memory=PixelCacheThreshold;
1231 #endif
1232  (void) SetMagickResourceLimit(AreaResource,2*memory);
1233  limit=GetEnvironmentValue("MAGICK_AREA_LIMIT");
1234  if (limit != (char *) NULL)
1235  {
1237  100.0));
1238  limit=DestroyString(limit);
1239  }
1240  (void) SetMagickResourceLimit(MemoryResource,memory);
1241  limit=GetEnvironmentValue("MAGICK_MEMORY_LIMIT");
1242  if (limit != (char *) NULL)
1243  {
1245  limit,100.0));
1246  limit=DestroyString(limit);
1247  }
1248  (void) SetMagickResourceLimit(MapResource,2*memory);
1249  limit=GetEnvironmentValue("MAGICK_MAP_LIMIT");
1250  if (limit != (char *) NULL)
1251  {
1253  100.0));
1254  limit=DestroyString(limit);
1255  }
1257  limit=GetEnvironmentValue("MAGICK_DISK_LIMIT");
1258  if (limit != (char *) NULL)
1259  {
1261  100.0));
1262  limit=DestroyString(limit);
1263  }
1264  files=(-1);
1265 #if defined(MAGICKCORE_HAVE_SYSCONF) && defined(_SC_OPEN_MAX)
1266  files=(ssize_t) sysconf(_SC_OPEN_MAX);
1267 #endif
1268 #if defined(MAGICKCORE_HAVE_GETRLIMIT) && defined(RLIMIT_NOFILE)
1269  if (files < 0)
1270  {
1271  struct rlimit
1272  resources;
1273 
1274  if (getrlimit(RLIMIT_NOFILE,&resources) != -1)
1275  files=(ssize_t) resources.rlim_cur;
1276  }
1277 #endif
1278 #if defined(MAGICKCORE_HAVE_GETDTABLESIZE) && defined(MAGICKCORE_POSIX_SUPPORT)
1279  if (files < 0)
1280  files=(ssize_t) getdtablesize();
1281 #endif
1282  if (files < 0)
1283  files=64;
1285  (3*files/4),64));
1286  limit=GetEnvironmentValue("MAGICK_FILE_LIMIT");
1287  if (limit != (char *) NULL)
1288  {
1290  100.0));
1291  limit=DestroyString(limit);
1292  }
1294  limit=GetEnvironmentValue("MAGICK_THREAD_LIMIT");
1295  if (limit != (char *) NULL)
1296  {
1298  limit,100.0));
1299  limit=DestroyString(limit);
1300  }
1302  limit=GetEnvironmentValue("MAGICK_THROTTLE_LIMIT");
1303  if (limit != (char *) NULL)
1304  {
1306  limit,100.0));
1307  limit=DestroyString(limit);
1308  }
1310  limit=GetEnvironmentValue("MAGICK_TIME_LIMIT");
1311  if (limit != (char *) NULL)
1312  {
1314  100.0));
1315  limit=DestroyString(limit);
1316  }
1317  return(MagickTrue);
1318 }
1319 
1320 /*
1321 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1322 % %
1323 % %
1324 % %
1325 + 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 %
1326 % %
1327 % %
1328 % %
1329 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1330 %
1331 % ResourceComponentTerminus() destroys the resource component.
1332 %
1333 % The format of the ResourceComponentTerminus() method is:
1334 %
1335 % ResourceComponentTerminus(void)
1336 %
1337 */
1339 {
1340  if (resource_semaphore == (SemaphoreInfo *) NULL)
1343  if (temporary_resources != (SplayTreeInfo *) NULL)
1345  if (random_info != (RandomInfo *) NULL)
1349 }
1350 
1351 /*
1352 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1353 % %
1354 % %
1355 % %
1356 % S e t M a g i c k R e s o u r c e L i m i t %
1357 % %
1358 % %
1359 % %
1360 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1361 %
1362 % SetMagickResourceLimit() sets the limit for a particular resource.
1363 %
1364 % The format of the SetMagickResourceLimit() method is:
1365 %
1366 % MagickBooleanType SetMagickResourceLimit(const ResourceType type,
1367 % const MagickSizeType limit)
1368 %
1369 % A description of each parameter follows:
1370 %
1371 % o type: the type of resource.
1372 %
1373 % o limit: the maximum limit for the resource.
1374 %
1375 */
1376 
1378  const MagickSizeType limit)
1379 {
1380  char
1381  *value;
1382 
1384  status;
1385 
1386  status=MagickTrue;
1387  if (resource_semaphore == (SemaphoreInfo *) NULL)
1390  value=(char *) NULL;
1391  switch (type)
1392  {
1393  case WidthResource:
1394  {
1395  resource_info.width_limit=limit;
1396  value=GetPolicyValue("resource:width");
1397  if (value != (char *) NULL)
1399  100.0));
1400  break;
1401  }
1402  case HeightResource:
1403  {
1405  value=GetPolicyValue("resource:height");
1406  if (value != (char *) NULL)
1408  value,100.0));
1409  break;
1410  }
1411  case AreaResource:
1412  {
1413  resource_info.area_limit=limit;
1414  value=GetPolicyValue("resource:area");
1415  if (value != (char *) NULL)
1417  100.0));
1418  break;
1419  }
1420  case MemoryResource:
1421  {
1423  value=GetPolicyValue("resource:memory");
1424  if (value != (char *) NULL)
1426  value,100.0));
1427  break;
1428  }
1429  case MapResource:
1430  {
1431  resource_info.map_limit=limit;
1432  value=GetPolicyValue("resource:map");
1433  if (value != (char *) NULL)
1435  100.0));
1436  break;
1437  }
1438  case DiskResource:
1439  {
1440  resource_info.disk_limit=limit;
1441  value=GetPolicyValue("resource:disk");
1442  if (value != (char *) NULL)
1444  100.0));
1445  break;
1446  }
1447  case FileResource:
1448  {
1449  resource_info.file_limit=limit;
1450  value=GetPolicyValue("resource:file");
1451  if (value != (char *) NULL)
1453  100.0));
1454  break;
1455  }
1456  case ThreadResource:
1457  {
1459  value=GetPolicyValue("resource:thread");
1460  if (value != (char *) NULL)
1462  value,100.0));
1465  else
1466  if (resource_info.thread_limit == 0)
1468  break;
1469  }
1470  case ThrottleResource:
1471  {
1473  value=GetPolicyValue("resource:throttle");
1474  if (value != (char *) NULL)
1476  value,100.0));
1477  break;
1478  }
1479  case TimeResource:
1480  {
1481  resource_info.time_limit=limit;
1482  value=GetPolicyValue("resource:time");
1483  if (value != (char *) NULL)
1485  100.0));
1487  break;
1488  }
1489  default:
1490  status=MagickFalse;
1491  break;
1492  }
1493  if (value != (char *) NULL)
1494  value=DestroyString(value);
1496  return(status);
1497 }
MagickExport ssize_t FormatMagickSize(const MagickSizeType size, const MagickBooleanType bi, const char *suffix, const size_t length, char *format)
Definition: string.c:1081
MagickOffsetType map
Definition: resource.c:81
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:863
static void * DestroyTemporaryResources(void *temporary_resource)
Definition: resource.c:469
#define MagickULLConstant(c)
Definition: magick-type.h:36
struct _ResourceInfo ResourceInfo
MagickOffsetType file
Definition: resource.c:81
static size_t GetOpenMPMaximumThreads(void)
MagickOffsetType thread
Definition: resource.c:81
MagickSizeType height_limit
Definition: resource.c:93
MagickExport SemaphoreInfo * AcquireSemaphoreInfo(void)
Definition: semaphore.c:192
static ResourceInfo resource_info
Definition: resource.c:112
MagickSizeType map_limit
Definition: resource.c:93
MagickPrivate MagickBooleanType ResourceComponentGenesis(void)
Definition: resource.c:1187
MagickOffsetType memory
Definition: resource.c:81
MagickExport MagickBooleanType SetMagickResourceLimit(const ResourceType type, const MagickSizeType limit)
Definition: resource.c:1377
MagickOffsetType area
Definition: resource.c:81
#define S_ISDIR(mode)
Definition: studio.h:195
MagickSizeType area_limit
Definition: resource.c:93
MagickExport ExceptionInfo * AcquireExceptionInfo(void)
Definition: exception.c:108
MagickOffsetType time
Definition: resource.c:81
MagickExport ssize_t FormatLocaleString(char *magick_restrict string, const size_t length, const char *magick_restrict format,...)
Definition: locale.c:473
MagickExport void RelinquishMagickResource(const ResourceType type, const MagickSizeType size)
Definition: resource.c:944
#define O_BINARY
Definition: studio.h:320
MagickExport MagickBooleanType AcquireMagickResource(const ResourceType type, const MagickSizeType size)
Definition: resource.c:169
ssize_t MagickOffsetType
Definition: magick-type.h:127
MagickOffsetType disk
Definition: resource.c:81
MagickExport RandomInfo * DestroyRandomInfo(RandomInfo *random_info)
Definition: random.c:274
MagickExport void LockSemaphoreInfo(SemaphoreInfo *semaphore_info)
Definition: semaphore.c:293
MagickExport unsigned char * GetStringInfoDatum(const StringInfo *string_info)
Definition: string.c:1283
MagickSizeType memory_limit
Definition: resource.c:93
MagickExport ssize_t FormatLocaleFile(FILE *file, const char *magick_restrict format,...)
Definition: locale.c:378
MagickBooleanType
Definition: magick-type.h:156
#define DirectorySeparator
Definition: studio.h:254
MagickExport int AcquireUniqueFileResource(char *path)
Definition: resource.c:561
MagickPrivate ssize_t GetMagickPageSize(void)
Definition: utility.c:1122
MagickExport const char * CommandOptionToMnemonic(const CommandOption option, const ssize_t type)
Definition: option.c:2667
static SplayTreeInfo * temporary_resources
Definition: resource.c:140
MagickExport StringInfo * DestroyStringInfo(StringInfo *string_info)
Definition: string.c:837
MagickSizeType time_limit
Definition: resource.c:93
MagickExport MagickBooleanType RelinquishUniqueFileResource(const char *path)
Definition: resource.c:1143
#define magick_unused(x)
MagickExport SplayTreeInfo * DestroySplayTree(SplayTreeInfo *splay_tree)
Definition: splay-tree.c:682
size_t MagickSizeType
Definition: magick-type.h:128
#define MagickPathExtent
MagickOffsetType width
Definition: resource.c:81
MagickExport MagickBooleanType IsEventLogging(void)
Definition: log.c:716
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:1397
static int open_utf8(const char *path, int flags, mode_t mode)
MagickExport RandomInfo * AcquireRandomInfo(void)
Definition: random.c:164
MagickExport MagickSizeType GetMagickResourceLimit(const ResourceType type)
Definition: resource.c:770
MagickExport char * GetEnvironmentValue(const char *name)
Definition: string.c:1250
MagickExport size_t CopyMagickString(char *destination, const char *source, const size_t length)
Definition: string.c:742
MagickPrivate MagickBooleanType ShredFile(const char *)
Definition: utility.c:1810
#define S_MODE
Definition: studio.h:234
#define MagickMax(x, y)
Definition: image-private.h:26
MagickExport void AppendImageFormat(const char *format, char *filename)
Definition: utility.c:281
ResourceType
Definition: resource_.h:25
MagickSizeType throttle_limit
Definition: resource.c:93
MagickPrivate void AsynchronousResourceComponentTerminus(void)
Definition: resource.c:425
#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:682
#define MagickResourceInfinity
Definition: resource_.h:40
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:810
MagickExport void ActivateSemaphoreInfo(SemaphoreInfo **semaphore_info)
Definition: semaphore.c:97
MagickOffsetType throttle
Definition: resource.c:81
static MagickSizeType StringToMagickSizeType(const char *string, const double interval)
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:505
MagickSizeType thread_limit
Definition: resource.c:93
MagickExport void ResetSplayTreeIterator(SplayTreeInfo *splay_tree)
Definition: splay-tree.c:1472
static RandomInfo * random_info
Definition: resource.c:109
MagickPrivate void ResetPixelCacheEpoch(void)
#define magick_unreferenced(x)
#define MagickPathTemplate
Definition: resource.c:73
MagickSizeType width_limit
Definition: resource.c:93
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:270
#define MagickPrivate
#define MagickExport
MagickOffsetType height
Definition: resource.c:81
MagickExport StringInfo * GetRandomKey(RandomInfo *random_info, const size_t length)
Definition: random.c:710
#define TMP_MAX
MagickSizeType file_limit
Definition: resource.c:93
MagickExport size_t GetStringInfoLength(const StringInfo *string_info)
Definition: string.c:1312
MagickSizeType disk_limit
Definition: resource.c:93
MagickExport MagickBooleanType GetPathTemplate(char *path)
Definition: resource.c:476
MagickExport void RelinquishSemaphoreInfo(SemaphoreInfo **semaphore_info)
Definition: semaphore.c:351
MagickExport char * ConstantString(const char *source)
Definition: string.c:687
static SemaphoreInfo * resource_semaphore
Definition: resource.c:137
MagickExport ExceptionInfo * DestroyExceptionInfo(ExceptionInfo *exception)
Definition: exception.c:417
MagickPrivate void ResourceComponentTerminus(void)
Definition: resource.c:1338