MCPcopy Create free account
hub / github.com/F-Stack/f-stack / _rte_cpu_getauxval

Function _rte_cpu_getauxval

dpdk/lib/eal/linux/eal_cpuflags.c:41–70  ·  view source on GitHub ↗

* Provides a method for retrieving values from the auxiliary vector and * possibly running a string comparison. * * @return Always returns a result. When the result is 0, check errno * to see if an error occurred during processing. */

Source from the content-addressed store, hash-verified

39 * to see if an error occurred during processing.
40 */
41static unsigned long
42_rte_cpu_getauxval(unsigned long type, const char *str)
43{
44 unsigned long val;
45
46 errno = 0;
47 val = getauxval(type);
48
49 if (!val && (errno == ENOTSUP || errno == ENOENT)) {
50 int auxv_fd = open("/proc/self/auxv", O_RDONLY);
51 Internal_Elfx_auxv_t auxv;
52
53 if (auxv_fd == -1)
54 return 0;
55
56 errno = ENOENT;
57 while (read(auxv_fd, &auxv, sizeof(auxv)) == sizeof(auxv)) {
58 if (auxv.a_type == type) {
59 errno = 0;
60 val = auxv.a_un.a_val;
61 if (str)
62 val = strcmp((const char *)val, str);
63 break;
64 }
65 }
66 close(auxv_fd);
67 }
68
69 return val;
70}
71
72unsigned long
73rte_cpu_getauxval(unsigned long type)

Callers 2

rte_cpu_getauxvalFunction · 0.85
rte_cpu_strcmp_auxvalFunction · 0.85

Calls 4

getauxvalFunction · 0.85
strcmpFunction · 0.85
readFunction · 0.50
closeFunction · 0.50

Tested by

no test coverage detected