example.c (4f2c0a4acffbec01079c28f839422e64ddeff004) example.c (2455f0e124d317dd08d337a7550a78a224d4ba41)
1// SPDX-License-Identifier: GPL-2.0-only
2/*
3 * Copyright (c) 2021, Microsoft Corporation.
4 *
5 * Authors:
6 * Beau Belgrave <beaub@linux.microsoft.com>
7 */
8

--- 9 unchanged lines hidden (view full) ---

18
19#if __BITS_PER_LONG == 64
20#define endian_swap(x) htole64(x)
21#else
22#define endian_swap(x) htole32(x)
23#endif
24
25/* Assumes debugfs is mounted */
1// SPDX-License-Identifier: GPL-2.0-only
2/*
3 * Copyright (c) 2021, Microsoft Corporation.
4 *
5 * Authors:
6 * Beau Belgrave <beaub@linux.microsoft.com>
7 */
8

--- 9 unchanged lines hidden (view full) ---

18
19#if __BITS_PER_LONG == 64
20#define endian_swap(x) htole64(x)
21#else
22#define endian_swap(x) htole32(x)
23#endif
24
25/* Assumes debugfs is mounted */
26const char *data_file = "/sys/kernel/debug/tracing/user_events_data";
27const char *status_file = "/sys/kernel/debug/tracing/user_events_status";
26const char *data_file = "/sys/kernel/tracing/user_events_data";
27const char *status_file = "/sys/kernel/tracing/user_events_status";
28
29static int event_status(long **status)
30{
31 int fd = open(status_file, O_RDONLY);
32
33 *status = mmap(NULL, sysconf(_SC_PAGESIZE), PROT_READ,
34 MAP_SHARED, fd, 0);
35

--- 67 unchanged lines hidden ---
28
29static int event_status(long **status)
30{
31 int fd = open(status_file, O_RDONLY);
32
33 *status = mmap(NULL, sysconf(_SC_PAGESIZE), PROT_READ,
34 MAP_SHARED, fd, 0);
35

--- 67 unchanged lines hidden ---