हमारा सुझाव है कि 27 मार्च, 2025 से AOSP को बनाने और उसमें योगदान देने के लिए, aosp-main
के बजाय android-latest-release
का इस्तेमाल करें. ज़्यादा जानकारी के लिए, AOSP में हुए बदलाव लेख पढ़ें.
संग्रह की मदद से व्यवस्थित रहें
अपनी प्राथमिकताओं के आधार पर, कॉन्टेंट को सेव करें और कैटगरी में बांटें.
memtrack_module स्ट्रक्चर का रेफ़रंस
#include <
memtrack.h
>
हर हार्डवेयर मॉड्यूल में, HAL_MODULE_INFO_SYM नाम का डेटा स्ट्रक्चर होना चाहिए. साथ ही, इस डेटा स्ट्रक्चर के फ़ील्ड,
hw_module_t
से शुरू होने चाहिए. इसके बाद, मॉड्यूल की खास जानकारी होनी चाहिए.
परिभाषा,
memtrack.h
की फ़ाइल के
120
पंक्ति पर दी गई है.
(*getMemory)() फ़ंक्शन में रिकॉर्ड ऑब्जेक्ट का कलेक्शन होना चाहिए. यह फ़ंक्शन, *num_record स्ट्रक्चर में मेमोरी के साइज़ के साथ-साथ उस मेमोरी से जुड़े फ़्लैग को भी पॉप्युलेट करता है. यह *num_records को उन रिकॉर्ड की कुल संख्या से भी अपडेट करता है जिन्हें *num_records के पास पास किए जाने पर दिखाया जा सकता है. साइज़ 0 वाले रिकॉर्ड दिखाने की उम्मीद है. एक ही तरह की मेमोरी के लिए, getMemory के कॉल के बीच रिकॉर्ड की संख्या में अंतर नहीं होना चाहिए. भले ही, अलग-अलग pid के लिए ऐसा हो.
कॉलर अक्सर किसी टाइप और pid के लिए, *num_records == 0 के साथ getMemory को कॉल करेगा, ताकि यह तय किया जा सके कि कितने रिकॉर्ड के लिए जगह आवंटित करनी है. यह मामला, HAL में फ़ास्ट-पाथ होना चाहिए, जो एक कॉन्स्टेंट दिखाता है और किसी भी कर्नेल फ़ाइल से क्वेरी नहीं करता. अगर *num_records की वैल्यू 0 है, तो रिकॉर्ड NULL हो सकते हैं.
यह फ़ंक्शन थ्रेड-सेफ़ होना चाहिए, क्योंकि इसे एक ही समय पर कई थ्रेड से कॉल किया जा सकता है.
सही तरीके से काम करने पर 0 दिखाता है. अगर टाइप काम नहीं करता है, तो -ENODEV दिखाता है. अन्य गड़बड़ियों पर -errno दिखाता है.
परिभाषा,
memtrack.h
फ़ाइल की लाइन
151
पर दी गई है.
(*init)(), memtrack मैनेजमेंट सेटअप ऐक्शन करता है. साथ ही,
getMemory()
को कॉल करने से पहले, इसे एक बार कॉल किया जाता है
. सही होने पर 0 और गड़बड़ी होने पर -errno दिखाता है.
परिभाषा,
memtrack.h
फ़ाइल की लाइन
128
पर दी गई है.
इस स्ट्रक्चर का दस्तावेज़, इस फ़ाइल से जनरेट किया गया था:
इस पेज पर मौजूद कॉन्टेंट और कोड सैंपल कॉन्टेंट के लाइसेंस में बताए गए लाइसेंस के हिसाब से हैं. Java और OpenJDK, Oracle और/या इससे जुड़ी हुई कंपनियों के ट्रेडमार्क या रजिस्टर किए हुए ट्रेडमार्क हैं.
आखिरी बार 2025-07-27 (UTC) को अपडेट किया गया.
[[["समझने में आसान है","easyToUnderstand","thumb-up"],["मेरी समस्या हल हो गई","solvedMyProblem","thumb-up"],["अन्य","otherUp","thumb-up"]],[["वह जानकारी मौजूद नहीं है जो मुझे चाहिए","missingTheInformationINeed","thumb-down"],["बहुत मुश्किल है / बहुत सारे चरण हैं","tooComplicatedTooManySteps","thumb-down"],["पुराना","outOfDate","thumb-down"],["अनुवाद से जुड़ी समस्या","translationIssue","thumb-down"],["सैंपल / कोड से जुड़ी समस्या","samplesCodeIssue","thumb-down"],["अन्य","otherDown","thumb-down"]],["आखिरी बार 2025-07-27 (UTC) को अपडेट किया गया."],[],[],null,["# Android Hardware Abstraction Layer: memtrack_module Struct Reference\n\nmemtrack_module Struct Reference\n================================\n\n[Data Fields](#pub-attribs) \nmemtrack_module Struct Reference \n\n`\n#include \u003c\n`[memtrack.h](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/memtrack.h)`\n\u003e\n`\n\n|----------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Data Fields ----------- ||\n| struct [hw_module_t](/reference/hal/structhw__module__t) | [common](/reference/hal/structmemtrack__module#a71ea01183b3998cad6a2301a37a42fc7) |\n| ||\n| int(\\* | [init](/reference/hal/structmemtrack__module#a44c48f5b685ba133e81237bf65fb77f3) )(const struct [memtrack_module](/reference/hal/structmemtrack__module) \\*module) |\n| ||\n| int(\\* | [getMemory](/reference/hal/structmemtrack__module#ad6da70db99b91b8e08eaff8f4500064a) )(const struct [memtrack_module](/reference/hal/structmemtrack__module) \\*module, pid_t pid, int type, struct [memtrack_record](/reference/hal/structmemtrack__record) \\*records, size_t \\*num_records) |\n| ||\n\n\nDetailed Description\n--------------------\n\n\nEvery hardware module must have a data structure named HAL_MODULE_INFO_SYM and the fields of this data structure must begin with\n[hw_module_t](/reference/hal/structhw__module__t)\nfollowed by module specific information.\n\n\nDefinition at line\n[120](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/memtrack.h)\nof file\n[memtrack.h](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/memtrack.h)\n.\n\nField Documentation\n-------------------\n\n\n|-----------------------------------------------------------------|\n| struct [hw_module_t](/reference/hal/structhw__module__t) common |\n\n\nDefinition at line\n[121](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/memtrack.h)\nof file\n[memtrack.h](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/memtrack.h)\n.\n\n|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| int(\\* getMemory)(const struct [memtrack_module](/reference/hal/structmemtrack__module) \\*module, pid_t pid, int type, struct [memtrack_record](/reference/hal/structmemtrack__record) \\*records, size_t \\*num_records) |\n\n\n(\\*getMemory)() expects an array of record objects and populates up to \\*num_record structures with the sizes of memory plus associated flags for that memory. It also updates \\*num_records with the total number of records it could return if \\*num_records was large enough when passed in. Returning records with size 0 is expected, the number of records should not vary between calls to getMemory for the same memory type, even for different pids.\n\n\nThe caller will often call getMemory for a type and pid with \\*num_records == 0 to determine how many records to allocate room for, this case should be a fast-path in the HAL, returning a constant and not querying any kernel files. If \\*num_records passed in is 0, then records may be NULL.\n\n\nThis function must be thread-safe, it may get called from multiple threads at the same time.\n\n\nReturns 0 on success, -ENODEV if the type is not supported, -errno on other errors.\n\n\nDefinition at line\n[151](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/memtrack.h)\nof file\n[memtrack.h](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/memtrack.h)\n.\n\n|----------------------------------------------------------------------------------------------|\n| int(\\* init)(const struct [memtrack_module](/reference/hal/structmemtrack__module) \\*module) |\n\n\n(\\*init)() performs memtrack management setup actions and is called once before any calls to\n[getMemory()](/reference/hal/structmemtrack__module#ad6da70db99b91b8e08eaff8f4500064a)\n. Returns 0 on success, -errno on error.\n\n\nDefinition at line\n[128](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/memtrack.h)\nof file\n[memtrack.h](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/memtrack.h)\n.\n\n*** ** * ** ***\n\nThe documentation for this struct was generated from the following file:\n\n- hardware/libhardware/include/hardware/ [memtrack.h](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/memtrack.h)"]]