# Arabic translation of manpages # This file is distributed under the same license as the manpages-l10n package. # Copyright © of this file: # زايد السعيدي , 2026. msgid "" msgstr "" "Project-Id-Version: manpages-l10n\n" "POT-Creation-Date: 2026-06-05 06:30+0200\n" "PO-Revision-Date: 2026-06-03 04:49+0400\n" "Last-Translator: Zayed Al-Saidi \n" "Language-Team: Arabic \n" "Language: ar\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" ".MIME-Version: 1.0\n" "Plural-Forms: nplurals=6; plural=n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : n%100>=3 " "&& n%100<=10 ? 3 : n%100>=11 && n%100<=99 ? 4 : 5;\n" "X-Generator: Lokalize 23.08.5\n" #. type: TH #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "malloc_info" msgstr "malloc_info" #. type: TH #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 #: opensuse-tumbleweed #, no-wrap msgid "2026-02-08" msgstr "8 فبراير 2026" #. type: TH #: archlinux debian-unstable #, no-wrap msgid "Linux man-pages 6.18" msgstr "صفحات دليل لينكس 6.18" #. type: SH #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "NAME" msgstr "الاسم" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "malloc_info - export malloc state to a stream" msgstr "malloc_info - تصدير حالة malloc إلى دفق" #. type: SH #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "LIBRARY" msgstr "المكتبة" #. type: Plain text #: archlinux debian-unstable fedora-44 fedora-rawhide mageia-cauldron #: opensuse-leap-16-1 opensuse-tumbleweed msgid "Standard C library (I,\\ I<-lc>)" msgstr "مكتبة سي المعيارية (I،\\ I<-lc>)" #. type: SH #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "SYNOPSIS" msgstr "موجز" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "B<#include Emalloc.hE>\n" msgstr "B<#include Emalloc.hE>\n" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "BIB<, FILE *>IB<);>\n" msgstr "BIB<, FILE *>IB<);>\n" #. type: SH #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "DESCRIPTION" msgstr "الوصف" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "The B() function exports an XML string that describes the " "current state of the memory-allocation implementation in the caller. The " "string is printed on the file stream I. The exported string " "includes information about all arenas (see B(3))." msgstr "" "تصدّر الدالة B() سلسلة XML تصف الحالة الحالية لتنفيذ تخصيص " "الذاكرة في المستدعي. تُطبع السلسلة على دفق الملف I. تتضمن السلسلة " "المُصدّرة معلومات عن جميع الساحات (انظر B(3))." #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "As currently implemented, I must be zero." msgstr "كما هو مطبّق حالياً، يجب أن يكون I صفراً." #. type: SH #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "RETURN VALUE" msgstr "قيمة الإرجاع" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "On success, B() returns 0. On failure, it returns -1, and " "I is set to indicate the error." msgstr "" "عند النجاح، تُعيد B() 0. عند الفشل، تُعيد -1، ويُضبط I " "للإشارة إلى الخطأ." #. type: SH #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "ERRORS" msgstr "الأخطاء" #. type: TP #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "B" msgstr "B" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "I was nonzero." msgstr "I كان غير صفري." #. type: SH #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "ATTRIBUTES" msgstr "السمات" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "For an explanation of the terms used in this section, see B(7)." msgstr "" "للاطلاع على شرح للمصطلحات المستخدمة في هذا القسم، انظر B(7)." #. type: tbl table #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "Interface" msgstr "الواجهة" #. type: tbl table #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "Attribute" msgstr "السمة" #. type: tbl table #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "Value" msgstr "القيمة" #. type: tbl table #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid ".na\n" msgstr ".na\n" #. type: tbl table #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid ".nh\n" msgstr ".nh\n" #. type: tbl table #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "B()" msgstr "B()" #. type: tbl table #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "Thread safety" msgstr "سلامة الخيوط" #. type: tbl table #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "MT-Safe" msgstr "MT-Safe" #. type: SH #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "STANDARDS" msgstr "المعايير" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "GNU." msgstr "GNU." #. type: SH #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "HISTORY" msgstr "التاريخ" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "glibc 2.10." msgstr "glibc 2.10." #. type: SH #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "NOTES" msgstr "ملاحظات" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "The memory-allocation information is provided as an XML string (rather than " "a C structure) because the information may change over time (according to " "changes in the underlying implementation). The output XML string includes a " "version field." msgstr "" "تُقدّم معلومات تخصيص الذاكرة كسلسلة XML (بدلاً من بنية C) لأن المعلومات قد " "تتغير بمرور الوقت (تبعاً للتغييرات في التنفيذ الأساسي). تتضمن سلسلة XML " "الناتجة حقل إصدار." #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "The B(3) function can be used to send the output of " "B() directly into a buffer in memory, rather than to a file." msgstr "" "يمكن استخدام الدالة B(3) لإرسال مخرجات B() " "مباشرةً إلى مخزن مؤقت في الذاكرة، بدلاً من إرسالها إلى ملف." #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "The B() function is designed to address deficiencies in " "B(3) and B(3)." msgstr "" "صُمّمت الدالة B() لمعالجة أوجه القصور في B(3) و " "B(3)." #. type: SH #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "EXAMPLES" msgstr "أمثلة" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "The program below takes up to four command-line arguments, of which the " "first three are mandatory. The first argument specifies the number of " "threads that the program should create. All of the threads, including the " "main thread, allocate the number of blocks of memory specified by the second " "argument. The third argument controls the size of the blocks to be " "allocated. The main thread creates blocks of this size, the second thread " "created by the program allocates blocks of twice this size, the third thread " "allocates blocks of three times this size, and so on." msgstr "" "يقبل البرنامج أدناه ما يصل إلى أربع وسائط لسطر الأوامر، أول ثلاث منها " "إلزامية. تُحدد الوسيطة الأولى عدد الخيوط التي يجب أن ينشئها البرنامج. تُخصّص " "جميع الخيوط، بما في ذلك الخيط الرئيس، عدد الكتل الذاكرية المُحدّد بالوسيطة " "الثانية. تتحكم الوسيطة الثالثة في حجم الكتل التي سيتم تخصيصها. ينشئ الخيط " "الرئيس كتلًا بهذا الحجم، ويُخصّص الخيط الثاني الذي أنشأه البرنامج كتلًا بحجم " "مضاعف، ويُخصّص الخيط الثالث كتلًا بحجم ثلاثي، وهكذا." #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "The program calls B() twice to display the memory-allocation " "state. The first call takes place before any threads are created or memory " "allocated. The second call is performed after all threads have allocated " "memory." msgstr "" "يستدعي البرنامج B() مرتين لعرض حالة تخصيص الذاكرة. يحدث " "الاستدعاء الأول قبل إنشاء أي خيوط أو تخصيص ذاكرة. يُنفّذ الاستدعاء الثاني بعد " "أن تُخصّص جميع الخيوط الذاكرة." #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "In the following example, the command-line arguments specify the creation of " "one additional thread, and both the main thread and the additional thread " "allocate 10000 blocks of memory. After the blocks of memory have been " "allocated, B() shows the state of two allocation arenas." msgstr "" "في المثال التالي، تُحدد وسائط سطر الأوامر إنشاء خيط إضافي واحد، ويُخصّص كل من " "الخيط الرئيس والخيط الإضافي 10000 كتلة ذاكرة. بعد تخصيص كتل الذاكرة، يُظهر " "B() حالة ساحتي تخصيص." #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "" "$ B\n" "glibc 2.13\n" "$ B<./a.out 1 10000 100>\n" "============ Before allocating blocks ============\n" "Emalloc version=\"1\"E\n" "Eheap nr=\"0\"E\n" "EsizesE\n" "E/sizesE\n" "Etotal type=\"fast\" count=\"0\" size=\"0\"/E\n" "Etotal type=\"rest\" count=\"0\" size=\"0\"/E\n" "Esystem type=\"current\" size=\"135168\"/E\n" "Esystem type=\"max\" size=\"135168\"/E\n" "Easpace type=\"total\" size=\"135168\"/E\n" "Easpace type=\"mprotect\" size=\"135168\"/E\n" "E/heapE\n" "Etotal type=\"fast\" count=\"0\" size=\"0\"/E\n" "Etotal type=\"rest\" count=\"0\" size=\"0\"/E\n" "Esystem type=\"current\" size=\"135168\"/E\n" "Esystem type=\"max\" size=\"135168\"/E\n" "Easpace type=\"total\" size=\"135168\"/E\n" "Easpace type=\"mprotect\" size=\"135168\"/E\n" "E/mallocE\n" "\\&\n" "============ After allocating blocks ============\n" "Emalloc version=\"1\"E\n" "Eheap nr=\"0\"E\n" "EsizesE\n" "E/sizesE\n" "Etotal type=\"fast\" count=\"0\" size=\"0\"/E\n" "Etotal type=\"rest\" count=\"0\" size=\"0\"/E\n" "Esystem type=\"current\" size=\"1081344\"/E\n" "Esystem type=\"max\" size=\"1081344\"/E\n" "Easpace type=\"total\" size=\"1081344\"/E\n" "Easpace type=\"mprotect\" size=\"1081344\"/E\n" "E/heapE\n" "Eheap nr=\"1\"E\n" "EsizesE\n" "E/sizesE\n" "Etotal type=\"fast\" count=\"0\" size=\"0\"/E\n" "Etotal type=\"rest\" count=\"0\" size=\"0\"/E\n" "Esystem type=\"current\" size=\"1032192\"/E\n" "Esystem type=\"max\" size=\"1032192\"/E\n" "Easpace type=\"total\" size=\"1032192\"/E\n" "Easpace type=\"mprotect\" size=\"1032192\"/E\n" "E/heapE\n" "Etotal type=\"fast\" count=\"0\" size=\"0\"/E\n" "Etotal type=\"rest\" count=\"0\" size=\"0\"/E\n" "Esystem type=\"current\" size=\"2113536\"/E\n" "Esystem type=\"max\" size=\"2113536\"/E\n" "Easpace type=\"total\" size=\"2113536\"/E\n" "Easpace type=\"mprotect\" size=\"2113536\"/E\n" "E/mallocE\n" msgstr "" "$ B\n" "glibc 2.13\n" "$ B<./a.out 1 10000 100>\n" "============ Before allocating blocks ============\n" "Emalloc version=\"1\"E\n" "Eheap nr=\"0\"E\n" "EsizesE\n" "E/sizesE\n" "Etotal type=\"fast\" count=\"0\" size=\"0\"/E\n" "Etotal type=\"rest\" count=\"0\" size=\"0\"/E\n" "Esystem type=\"current\" size=\"135168\"/E\n" "Esystem type=\"max\" size=\"135168\"/E\n" "Easpace type=\"total\" size=\"135168\"/E\n" "Easpace type=\"mprotect\" size=\"135168\"/E\n" "E/heapE\n" "Etotal type=\"fast\" count=\"0\" size=\"0\"/E\n" "Etotal type=\"rest\" count=\"0\" size=\"0\"/E\n" "Esystem type=\"current\" size=\"135168\"/E\n" "Esystem type=\"max\" size=\"135168\"/E\n" "Easpace type=\"total\" size=\"135168\"/E\n" "Easpace type=\"mprotect\" size=\"135168\"/E\n" "E/mallocE\n" "\\&\n" "============ After allocating blocks ============\n" "Emalloc version=\"1\"E\n" "Eheap nr=\"0\"E\n" "EsizesE\n" "E/sizesE\n" "Etotal type=\"fast\" count=\"0\" size=\"0\"/E\n" "Etotal type=\"rest\" count=\"0\" size=\"0\"/E\n" "Esystem type=\"current\" size=\"1081344\"/E\n" "Esystem type=\"max\" size=\"1081344\"/E\n" "Easpace type=\"total\" size=\"1081344\"/E\n" "Easpace type=\"mprotect\" size=\"1081344\"/E\n" "E/heapE\n" "Eheap nr=\"1\"E\n" "EsizesE\n" "E/sizesE\n" "Etotal type=\"fast\" count=\"0\" size=\"0\"/E\n" "Etotal type=\"rest\" count=\"0\" size=\"0\"/E\n" "Esystem type=\"current\" size=\"1032192\"/E\n" "Esystem type=\"max\" size=\"1032192\"/E\n" "Easpace type=\"total\" size=\"1032192\"/E\n" "Easpace type=\"mprotect\" size=\"1032192\"/E\n" "E/heapE\n" "Etotal type=\"fast\" count=\"0\" size=\"0\"/E\n" "Etotal type=\"rest\" count=\"0\" size=\"0\"/E\n" "Esystem type=\"current\" size=\"2113536\"/E\n" "Esystem type=\"max\" size=\"2113536\"/E\n" "Easpace type=\"total\" size=\"2113536\"/E\n" "Easpace type=\"mprotect\" size=\"2113536\"/E\n" "E/mallocE\n" #. type: SS #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "Program source" msgstr "مصدر البرنامج" #. type: Plain text #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 #: opensuse-tumbleweed #, no-wrap msgid "" "#include Eerr.hE\n" "#include Eerrno.hE\n" "#include Emalloc.hE\n" "#include Epthread.hE\n" "#include Estdlib.hE\n" "#include Eunistd.hE\n" "\\&\n" "static size_t blockSize;\n" "static size_t numThreads;\n" "static unsigned int numBlocks;\n" "\\&\n" "static void *\n" "thread_func(void *arg)\n" "{\n" " int tn = (int) arg;\n" "\\&\n" " /* The multiplier \\[aq](2 + tn)\\[aq] ensures that each thread (including\n" " the main thread) allocates a different amount of memory. */\n" "\\&\n" " for (unsigned int j = 0; j E numBlocks; j++)\n" " if (malloc(blockSize * (2 + tn)) == NULL)\n" " err(EXIT_FAILURE, \"malloc-thread\");\n" "\\&\n" " sleep(100); /* Sleep until main thread terminates. */\n" " return NULL;\n" "}\n" "\\&\n" "int\n" "main(int argc, char *argv[])\n" "{\n" " int sleepTime;\n" " pthread_t *thr;\n" "\\&\n" " if (argc E 4) {\n" " fprintf(stderr,\n" " \"%s num-threads num-blocks block-size [sleep-time]\\[rs]n\",\n" " argv[0]);\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " numThreads = atoi(argv[1]);\n" " numBlocks = atoi(argv[2]);\n" " blockSize = atoi(argv[3]);\n" " sleepTime = (argc E 4) ? atoi(argv[4]) : 0;\n" "\\&\n" " thr = calloc(numThreads, sizeof(*thr));\n" " if (thr == NULL)\n" " err(EXIT_FAILURE, \"calloc\");\n" "\\&\n" " printf(\"============ Before allocating blocks ============\\[rs]n\");\n" " malloc_info(0, stdout);\n" "\\&\n" " /* Create threads that allocate different amounts of memory. */\n" "\\&\n" " for (size_t tn = 0; tn E numThreads; tn++) {\n" " errno = pthread_create(&thr[tn], NULL, thread_func,\n" " (void *) tn);\n" " if (errno != 0)\n" " err(EXIT_FAILURE, \"pthread_create\");\n" "\\&\n" " /* If we add a sleep interval after the start-up of each\n" " thread, the threads likely won\\[aq]t contend for malloc\n" " mutexes, and therefore additional arenas won\\[aq]t be\n" " allocated (see malloc(3)). */\n" "\\&\n" " if (sleepTime E 0)\n" " sleep(sleepTime);\n" " }\n" "\\&\n" " /* The main thread also allocates some memory. */\n" "\\&\n" " for (unsigned int j = 0; j E numBlocks; j++)\n" " if (malloc(blockSize) == NULL)\n" " err(EXIT_FAILURE, \"malloc\");\n" "\\&\n" " sleep(2); /* Give all threads a chance to\n" " complete allocations. */\n" "\\&\n" " printf(\"\\[rs]n============ After allocating blocks ============\\[rs]n\");\n" " malloc_info(0, stdout);\n" "\\&\n" " exit(EXIT_SUCCESS);\n" "}\n" msgstr "" "#include Eerr.hE\n" "#include Eerrno.hE\n" "#include Emalloc.hE\n" "#include Epthread.hE\n" "#include Estdlib.hE\n" "#include Eunistd.hE\n" "\\&\n" "static size_t blockSize;\n" "static size_t numThreads;\n" "static unsigned int numBlocks;\n" "\\&\n" "static void *\n" "thread_func(void *arg)\n" "{\n" " int tn = (int) arg;\n" "\\&\n" " /* The multiplier \\[aq](2 + tn)\\[aq] ensures that each thread (including\n" " the main thread) allocates a different amount of memory. */\n" "\\&\n" " for (unsigned int j = 0; j E numBlocks; j++)\n" " if (malloc(blockSize * (2 + tn)) == NULL)\n" " err(EXIT_FAILURE, \"malloc-thread\");\n" "\\&\n" " sleep(100); /* Sleep until main thread terminates. */\n" " return NULL;\n" "}\n" "\\&\n" "int\n" "main(int argc, char *argv[])\n" "{\n" " int sleepTime;\n" " pthread_t *thr;\n" "\\&\n" " if (argc E 4) {\n" " fprintf(stderr,\n" " \"%s num-threads num-blocks block-size [sleep-time]\\[rs]n\",\n" " argv[0]);\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " numThreads = atoi(argv[1]);\n" " numBlocks = atoi(argv[2]);\n" " blockSize = atoi(argv[3]);\n" " sleepTime = (argc E 4) ? atoi(argv[4]) : 0;\n" "\\&\n" " thr = calloc(numThreads, sizeof(*thr));\n" " if (thr == NULL)\n" " err(EXIT_FAILURE, \"calloc\");\n" "\\&\n" " printf(\"============ Before allocating blocks ============\\[rs]n\");\n" " malloc_info(0, stdout);\n" "\\&\n" " /* Create threads that allocate different amounts of memory. */\n" "\\&\n" " for (size_t tn = 0; tn E numThreads; tn++) {\n" " errno = pthread_create(&thr[tn], NULL, thread_func,\n" " (void *) tn);\n" " if (errno != 0)\n" " err(EXIT_FAILURE, \"pthread_create\");\n" "\\&\n" " /* If we add a sleep interval after the start-up of each\n" " thread, the threads likely won\\[aq]t contend for malloc\n" " mutexes, and therefore additional arenas won\\[aq]t be\n" " allocated (see malloc(3)). */\n" "\\&\n" " if (sleepTime E 0)\n" " sleep(sleepTime);\n" " }\n" "\\&\n" " /* The main thread also allocates some memory. */\n" "\\&\n" " for (unsigned int j = 0; j E numBlocks; j++)\n" " if (malloc(blockSize) == NULL)\n" " err(EXIT_FAILURE, \"malloc\");\n" "\\&\n" " sleep(2); /* Give all threads a chance to\n" " complete allocations. */\n" "\\&\n" " printf(\"\\[rs]n============ After allocating blocks ============\\[rs]n\");\n" " malloc_info(0, stdout);\n" "\\&\n" " exit(EXIT_SUCCESS);\n" "}\n" #. SRC END #. type: SH #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "SEE ALSO" msgstr "انظر أيضًا" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "B(3), B(3), B(3), B(3), " "B(3)" msgstr "" "B(3), B(3), B(3), B(3), " "B(3)" #. type: TH #: debian-trixie #, no-wrap msgid "2024-06-15" msgstr "15 يونيو 2024" #. type: TH #: debian-trixie #, no-wrap msgid "Linux man-pages 6.9.1" msgstr "صفحات دليل لينكس 6.9.1" #. type: Plain text #: debian-trixie msgid "Standard C library (I, I<-lc>)" msgstr "مكتبة سي المعيارية (I، I<-lc>)" #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide #, no-wrap msgid "" "#include Eerr.hE\n" "#include Eerrno.hE\n" "#include Emalloc.hE\n" "#include Epthread.hE\n" "#include Estdlib.hE\n" "#include Eunistd.hE\n" "\\&\n" "static size_t blockSize;\n" "static size_t numThreads;\n" "static unsigned int numBlocks;\n" "\\&\n" "static void *\n" "thread_func(void *arg)\n" "{\n" " int tn = (int) arg;\n" "\\&\n" " /* The multiplier \\[aq](2 + tn)\\[aq] ensures that each thread (including\n" " the main thread) allocates a different amount of memory. */\n" "\\&\n" " for (unsigned int j = 0; j E numBlocks; j++)\n" " if (malloc(blockSize * (2 + tn)) == NULL)\n" " err(EXIT_FAILURE, \"malloc-thread\");\n" "\\&\n" " sleep(100); /* Sleep until main thread terminates. */\n" " return NULL;\n" "}\n" "\\&\n" "int\n" "main(int argc, char *argv[])\n" "{\n" " int sleepTime;\n" " pthread_t *thr;\n" "\\&\n" " if (argc E 4) {\n" " fprintf(stderr,\n" " \"%s num-threads num-blocks block-size [sleep-time]\\[rs]n\",\n" " argv[0]);\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " numThreads = atoi(argv[1]);\n" " numBlocks = atoi(argv[2]);\n" " blockSize = atoi(argv[3]);\n" " sleepTime = (argc E 4) ? atoi(argv[4]) : 0;\n" "\\&\n" " thr = calloc(numThreads, sizeof(*thr));\n" " if (thr == NULL)\n" " err(EXIT_FAILURE, \"calloc\");\n" "\\&\n" " printf(\"============ Before allocating blocks ============\\[rs]n\");\n" " malloc_info(0, stdout);\n" "\\&\n" " /* Create threads that allocate different amounts of memory. */\n" "\\&\n" " for (size_t tn = 0; tn E numThreads; tn++) {\n" " errno = pthread_create(&thr[tn], NULL, thread_func,\n" " (void *) tn);\n" " if (errno != 0)\n" " err(EXIT_FAILURE, \"pthread_create\");\n" "\\&\n" " /* If we add a sleep interval after the start-up of each\n" " thread, the threads likely won\\[aq]t contend for malloc\n" " mutexes, and therefore additional arenas won\\[aq]t be\n" " allocated (see malloc(3)). */\n" "\\&\n" " if (sleepTime E 0)\n" " sleep(sleepTime);\n" " }\n" "\\&\n" " /* The main thread also allocates some memory. */\n" "\\&\n" " for (unsigned int j = 0; j E numBlocks; j++)\n" " if (malloc(blockSize) == NULL)\n" " err(EXIT_FAILURE, \"malloc\");\n" "\\&\n" " sleep(2); /* Give all threads a chance to\n" " complete allocations. */\n" "\\&\n" " printf(\"\\[rs]n============ After allocating blocks ============\\[rs]n\");\n" " malloc_info(0, stdout);\n" "\\&\n" " exit(EXIT_SUCCESS);\n" "}\n" msgstr "" "#include Eerr.hE\n" "#include Eerrno.hE\n" "#include Emalloc.hE\n" "#include Epthread.hE\n" "#include Estdlib.hE\n" "#include Eunistd.hE\n" "\\&\n" "static size_t blockSize;\n" "static size_t numThreads;\n" "static unsigned int numBlocks;\n" "\\&\n" "static void *\n" "thread_func(void *arg)\n" "{\n" " int tn = (int) arg;\n" "\\&\n" " /* The multiplier \\[aq](2 + tn)\\[aq] ensures that each thread (including\n" " the main thread) allocates a different amount of memory. */\n" "\\&\n" " for (unsigned int j = 0; j E numBlocks; j++)\n" " if (malloc(blockSize * (2 + tn)) == NULL)\n" " err(EXIT_FAILURE, \"malloc-thread\");\n" "\\&\n" " sleep(100); /* Sleep until main thread terminates. */\n" " return NULL;\n" "}\n" "\\&\n" "int\n" "main(int argc, char *argv[])\n" "{\n" " int sleepTime;\n" " pthread_t *thr;\n" "\\&\n" " if (argc E 4) {\n" " fprintf(stderr,\n" " \"%s num-threads num-blocks block-size [sleep-time]\\[rs]n\",\n" " argv[0]);\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " numThreads = atoi(argv[1]);\n" " numBlocks = atoi(argv[2]);\n" " blockSize = atoi(argv[3]);\n" " sleepTime = (argc E 4) ? atoi(argv[4]) : 0;\n" "\\&\n" " thr = calloc(numThreads, sizeof(*thr));\n" " if (thr == NULL)\n" " err(EXIT_FAILURE, \"calloc\");\n" "\\&\n" " printf(\"============ Before allocating blocks ============\\[rs]n\");\n" " malloc_info(0, stdout);\n" "\\&\n" " /* Create threads that allocate different amounts of memory. */\n" "\\&\n" " for (size_t tn = 0; tn E numThreads; tn++) {\n" " errno = pthread_create(&thr[tn], NULL, thread_func,\n" " (void *) tn);\n" " if (errno != 0)\n" " err(EXIT_FAILURE, \"pthread_create\");\n" "\\&\n" " /* If we add a sleep interval after the start-up of each\n" " thread, the threads likely won\\[aq]t contend for malloc\n" " mutexes, and therefore additional arenas won\\[aq]t be\n" " allocated (see malloc(3)). */\n" "\\&\n" " if (sleepTime E 0)\n" " sleep(sleepTime);\n" " }\n" "\\&\n" " /* The main thread also allocates some memory. */\n" "\\&\n" " for (unsigned int j = 0; j E numBlocks; j++)\n" " if (malloc(blockSize) == NULL)\n" " err(EXIT_FAILURE, \"malloc\");\n" "\\&\n" " sleep(2); /* Give all threads a chance to\n" " complete allocations. */\n" "\\&\n" " printf(\"\\[rs]n============ After allocating blocks ============\\[rs]n\");\n" " malloc_info(0, stdout);\n" "\\&\n" " exit(EXIT_SUCCESS);\n" "}\n" #. type: TH #: fedora-44 fedora-rawhide #, no-wrap msgid "2024-07-23" msgstr "23 يوليو 2024" #. type: TH #: fedora-44 fedora-rawhide #, no-wrap msgid "Linux man-pages 6.13" msgstr "صفحات دليل لينكس 6.13" #. type: TH #: mageia-cauldron #, no-wrap msgid "Linux man-pages 6.17" msgstr "صفحات دليل لينكس 6.17" #. type: TH #: opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "Linux man-pages (unreleased)" msgstr "صفحات دليل لينكس (لم تصدر بعد)"