tools/perf/util/util.h

Source file repositories/reference/linux-study-clean/tools/perf/util/util.h

File Facts

System
Linux kernel
Corpus path
tools/perf/util/util.h
Extension
.h
Size
3016 bytes
Lines
127
Domain
Support Tooling And Documentation
Bucket
tools
Inferred role
Support Tooling And Documentation: implementation source
Status
source implementation candidate

Why This File Exists

Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.

Dependency Surface

Detected Declarations

Annotated Snippet

struct perf_debuginfod {
	const char	*urls;
	bool		 set;
};
void perf_debuginfod_setup(struct perf_debuginfod *di);

const char *perf_basename(const char *path);

char *filename_with_chroot(int pid, const char *filename);

int do_realloc_array_as_needed(void **arr, size_t *arr_sz, size_t x,
			       size_t msz, const void *init_val);

#define realloc_array_as_needed(a, n, x, v) ({			\
	typeof(x) __x = (x);					\
	__x >= (n) ?						\
		do_realloc_array_as_needed((void **)&(a),	\
					   &(n),		\
					   __x,			\
					   sizeof(*(a)),	\
					   (const void *)(v)) :	\
		0;						\
	})

static inline bool host_is_bigendian(void)
{
#ifdef __BYTE_ORDER__
#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
	return false;
#elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
	return true;
#else
#error "Unrecognized __BYTE_ORDER__"
#endif
#else /* !__BYTE_ORDER__ */
	unsigned char str[] = { 0x1, 0x2, 0x3, 0x4, 0x0, 0x0, 0x0, 0x0};
	unsigned int *ptr;

	ptr = (unsigned int *)(void *)str;
	return *ptr == 0x01020304;
#endif
}

#endif /* __PERF_UTIL_H */

Annotation

Implementation Notes