summaryrefslogtreecommitdiffstats
path: root/share
diff options
context:
space:
mode:
authorAlejandro Colomar <alx.manpages@gmail.com>2022-05-09 15:00:06 +0200
committerAlejandro Colomar <alx.manpages@gmail.com>2022-05-09 16:31:58 +0200
commit64f7e30da9cac95bab73c88dd2d29352e21cef3f (patch)
tree6816db9a8c979c51e4be4e27a2929bf31439592f /share
parent64b1acc2b88b2dff3e930b3d9b723f8a52030638 (diff)
share/doc/grepc/examples/linux/*: Add examples
Add some examples of running grepc on the Linux repository. Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Diffstat (limited to 'share')
-rw-r--r--share/doc/grepc/examples/linux/ARRAY_SIZE260
-rw-r--r--share/doc/grepc/examples/linux/ENOMEM15
-rw-r--r--share/doc/grepc/examples/linux/LANDLOCK_RULE_PATH_BENEATH11
-rw-r--r--share/doc/grepc/examples/linux/NULL65
-rw-r--r--share/doc/grepc/examples/linux/SYSCALL_DEFINE.85
-rw-r--r--share/doc/grepc/examples/linux/landlock_rule_type11
-rw-r--r--share/doc/grepc/examples/linux/off_t15
-rw-r--r--share/doc/grepc/examples/linux/open148
-rw-r--r--share/doc/grepc/examples/linux/timespec16
9 files changed, 626 insertions, 0 deletions
diff --git a/share/doc/grepc/examples/linux/ARRAY_SIZE b/share/doc/grepc/examples/linux/ARRAY_SIZE
new file mode 100644
index 0000000..cce969b
--- /dev/null
+++ b/share/doc/grepc/examples/linux/ARRAY_SIZE
@@ -0,0 +1,260 @@
+
+
+./arch/mips/boot/tools/relocs.h:32:
+
+#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
+
+
+./arch/powerpc/boot/types.h:7:
+
+#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
+
+
+./arch/um/include/shared/user.h:17:
+
+#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
+
+
+./arch/x86/boot/boot.h:31:
+
+#define ARRAY_SIZE(x) (sizeof(x) / sizeof(*(x)))
+
+
+./arch/x86/tools/insn_sanity.c:19:
+
+#define ARRAY_SIZE(a) (sizeof(a)/sizeof(a[0]))
+
+
+./arch/x86/tools/relocs.h:22:
+
+#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
+
+
+./fs/orangefs/orangefs-debug.h:21:
+
+#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
+
+
+./fs/unicode/mkutf8data.c:63:
+
+#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
+
+
+./include/linux/kernel.h:49:
+
+#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
+
+
+./samples/bpf/cookie_uid_helper_example.c:34:
+
+#define ARRAY_SIZE(x) (sizeof(x) / sizeof(*(x)))
+
+
+./samples/bpf/xsk_fwd.c:30:
+
+#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
+
+
+./samples/seccomp/user-trap.c:24:
+
+#define ARRAY_SIZE(x) (sizeof(x) / sizeof(*(x)))
+
+
+./scripts/dtc/util.h:27:
+
+#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
+
+
+./scripts/genksyms/genksyms.c:406:
+
+#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
+
+
+./scripts/kallsyms.c:28:
+
+#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof(arr[0]))
+
+
+./scripts/kconfig/preprocess.c:15:
+
+#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
+
+
+./scripts/mod/file2alias.c:713:
+
+#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
+
+
+./scripts/selinux/mdp/mdp.c:40:
+
+#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
+
+
+./tools/gpio/gpio-utils.h:19:
+
+#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
+
+
+./tools/iio/iio_utils.h:18:
+
+#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof(arr[0]))
+
+
+./tools/include/linux/kernel.h:105:
+
+#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
+
+
+./tools/lib/traceevent/plugins/plugin_futex.c:15:
+
+#define ARRAY_SIZE(_a) (sizeof(_a) / sizeof((_a)[0]))
+
+
+./tools/lib/traceevent/plugins/plugin_xen.c:103:
+
+#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
+
+
+./tools/power/cpupower/utils/cpupower.c:23:
+
+#define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0]))
+
+
+./tools/spi/spidev_test.c:26:
+
+#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
+
+
+./tools/testing/selftests/bpf/bpf_util.h:31:
+
+# define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
+
+
+./tools/testing/selftests/bpf/progs/netif_receive_skb.c:20:
+
+#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
+
+
+./tools/testing/selftests/bpf/progs/profiler.inc.h:136:
+
+#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof(arr[0]))
+
+
+./tools/testing/selftests/bpf/progs/test_sysctl_loop1.c:13:
+
+#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
+
+
+./tools/testing/selftests/bpf/progs/test_sysctl_loop2.c:13:
+
+#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
+
+
+./tools/testing/selftests/bpf/progs/test_sysctl_prog.c:19:
+
+#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
+
+
+./tools/testing/selftests/cgroup/cgroup_util.h:7:
+
+#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
+
+
+./tools/testing/selftests/core/close_range_test.c:54:
+
+#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
+
+
+./tools/testing/selftests/ir/ir_loopback.c:29:
+
+#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
+
+
+./tools/testing/selftests/kselftest_harness.h:670:
+
+#define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0]))
+
+
+./tools/testing/selftests/net/ipsec.c:44:
+
+#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
+
+
+./tools/testing/selftests/net/reuseport_bpf.c:28:
+
+#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
+
+
+./tools/testing/selftests/net/rxtimestamp.c:21:
+
+#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
+
+
+./tools/testing/selftests/net/socket.c:34:
+
+#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
+
+
+./tools/testing/selftests/net/tcp_fastopen_backup_key.c:38:
+
+#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
+
+
+./tools/testing/selftests/rseq/basic_percpu_ops_test.c:14:
+
+#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
+
+
+./tools/testing/selftests/rseq/rseq.c:32:
+
+#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
+
+
+./tools/testing/selftests/seccomp/seccomp_benchmark.c:21:
+
+#define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0]))
+
+
+./tools/testing/selftests/sparc64/drivers/adi-test.c:28:
+
+# define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
+
+
+./tools/testing/selftests/timens/procfs.c:27:
+
+#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
+
+
+./tools/testing/selftests/timens/timens.c:25:
+
+#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
+
+
+./tools/testing/selftests/vm/mremap_test.c:23:
+
+#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
+
+
+./tools/testing/selftests/vm/pkey-helpers.h:178:
+
+#define ARRAY_SIZE(x) (sizeof(x) / sizeof(*(x)))
+
+
+./tools/testing/selftests/vm/va_128TBswitch.c:12:
+
+#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
+
+
+./tools/usb/usbip/libsrc/usbip_device_driver.c:30:
+
+#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
+
+
+./tools/virtio/linux/kernel.h:51:
+
+#define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0]))
+
+
+./tools/vm/page-types.c:211:
+
+#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
diff --git a/share/doc/grepc/examples/linux/ENOMEM b/share/doc/grepc/examples/linux/ENOMEM
new file mode 100644
index 0000000..1369513
--- /dev/null
+++ b/share/doc/grepc/examples/linux/ENOMEM
@@ -0,0 +1,15 @@
+
+
+./arch/powerpc/boot/stdio.h:7:
+
+#define ENOMEM 12 /* Out of Memory */
+
+
+./include/uapi/asm-generic/errno-base.h:16:
+
+#define ENOMEM 12 /* Out of memory */
+
+
+./tools/include/uapi/asm-generic/errno-base.h:16:
+
+#define ENOMEM 12 /* Out of memory */
diff --git a/share/doc/grepc/examples/linux/LANDLOCK_RULE_PATH_BENEATH b/share/doc/grepc/examples/linux/LANDLOCK_RULE_PATH_BENEATH
new file mode 100644
index 0000000..8711326
--- /dev/null
+++ b/share/doc/grepc/examples/linux/LANDLOCK_RULE_PATH_BENEATH
@@ -0,0 +1,11 @@
+
+
+./include/uapi/linux/landlock.h:43:
+
+enum landlock_rule_type {
+ /**
+ * @LANDLOCK_RULE_PATH_BENEATH: Type of a &struct
+ * landlock_path_beneath_attr .
+ */
+ LANDLOCK_RULE_PATH_BENEATH = 1,
+};
diff --git a/share/doc/grepc/examples/linux/NULL b/share/doc/grepc/examples/linux/NULL
new file mode 100644
index 0000000..2ba034d
--- /dev/null
+++ b/share/doc/grepc/examples/linux/NULL
@@ -0,0 +1,65 @@
+
+
+./arch/mips/include/asm/fw/arc/hinv.h:97:
+
+#define NULL 0
+
+
+./arch/parisc/math-emu/float.h:389:
+
+#define NULL 0
+
+
+./crypto/jitterentropy.c:60:
+
+#define NULL ((void *) 0)
+
+
+./drivers/media/dvb-frontends/stv0367_priv.h:24:
+
+#define NULL 0
+
+
+./drivers/net/fddi/skfp/h/hwmtm.h:70:
+
+#define NULL 0
+
+
+./drivers/net/fddi/skfp/h/sba_def.h:17:
+
+#define NULL 0x00
+
+
+./drivers/scsi/dpt/osd_util.h:198:
+
+ #define NULL 0
+
+
+./drivers/video/fbdev/riva/riva_hw.h:63:
+
+#define NULL 0
+
+
+./include/acpi/actypes.h:415:
+
+#define NULL (void *) 0
+
+
+./include/linux/stddef.h:8:
+
+#define NULL ((void *)0)
+
+
+./tools/include/nolibc/nolibc.h:118:
+
+#define NULL ((void *)0)
+
+
+./tools/testing/selftests/bpf/progs/profiler.inc.h:11:
+
+#define NULL 0
+
+
+./tools/testing/selftests/bpf/progs/skb_pkt_end.c:7:
+
+#define NULL 0
diff --git a/share/doc/grepc/examples/linux/SYSCALL_DEFINE. b/share/doc/grepc/examples/linux/SYSCALL_DEFINE.
new file mode 100644
index 0000000..5ad9f05
--- /dev/null
+++ b/share/doc/grepc/examples/linux/SYSCALL_DEFINE.
@@ -0,0 +1,85 @@
+
+
+./arch/arm64/include/asm/syscall_wrapper.h:69:
+
+#define SYSCALL_DEFINE0(sname) \
+ SYSCALL_METADATA(_##sname, 0); \
+ asmlinkage long __arm64_sys_##sname(const struct pt_regs *__unused); \
+ ALLOW_ERROR_INJECTION(__arm64_sys_##sname, ERRNO); \
+ asmlinkage long __arm64_sys_##sname(const struct pt_regs *__unused)
+
+
+./arch/s390/include/asm/syscall_wrapper.h:52:
+
+#define SYSCALL_DEFINE0(sname) \
+ SYSCALL_METADATA(_##sname, 0); \
+ asmlinkage long __s390x_sys_##sname(void); \
+ ALLOW_ERROR_INJECTION(__s390x_sys_##sname, ERRNO); \
+ asmlinkage long __s390_sys_##sname(void) \
+ __attribute__((alias(__stringify(__s390x_sys_##sname)))); \
+ asmlinkage long __s390x_sys_##sname(void)
+
+
+./arch/s390/include/asm/syscall_wrapper.h:102:
+
+#define SYSCALL_DEFINE0(sname) \
+ SYSCALL_METADATA(_##sname, 0); \
+ asmlinkage long __s390x_sys_##sname(void); \
+ ALLOW_ERROR_INJECTION(__s390x_sys_##sname, ERRNO); \
+ asmlinkage long __s390x_sys_##sname(void)
+
+
+./arch/x86/include/asm/syscall_wrapper.h:248:
+
+#define SYSCALL_DEFINE0(sname) \
+ SYSCALL_METADATA(_##sname, 0); \
+ static long __do_sys_##sname(const struct pt_regs *__unused); \
+ __X64_SYS_STUB0(sname) \
+ __IA32_SYS_STUB0(sname) \
+ static long __do_sys_##sname(const struct pt_regs *__unused)
+
+
+./include/linux/syscalls.h:206:
+
+#define SYSCALL_DEFINE0(sname) \
+ SYSCALL_METADATA(_##sname, 0); \
+ asmlinkage long sys_##sname(void); \
+ ALLOW_ERROR_INJECTION(sys_##sname, ERRNO); \
+ asmlinkage long sys_##sname(void)
+
+
+./include/linux/syscalls.h:213:
+
+#define SYSCALL_DEFINE1(name, ...) SYSCALL_DEFINEx(1, _##name, __VA_ARGS__)
+
+
+./include/linux/syscalls.h:214:
+
+#define SYSCALL_DEFINE2(name, ...) SYSCALL_DEFINEx(2, _##name, __VA_ARGS__)
+
+
+./include/linux/syscalls.h:215:
+
+#define SYSCALL_DEFINE3(name, ...) SYSCALL_DEFINEx(3, _##name, __VA_ARGS__)
+
+
+./include/linux/syscalls.h:216:
+
+#define SYSCALL_DEFINE4(name, ...) SYSCALL_DEFINEx(4, _##name, __VA_ARGS__)
+
+
+./include/linux/syscalls.h:217:
+
+#define SYSCALL_DEFINE5(name, ...) SYSCALL_DEFINEx(5, _##name, __VA_ARGS__)
+
+
+./include/linux/syscalls.h:218:
+
+#define SYSCALL_DEFINE6(name, ...) SYSCALL_DEFINEx(6, _##name, __VA_ARGS__)
+
+
+./include/linux/syscalls.h:222:
+
+#define SYSCALL_DEFINEx(x, sname, ...) \
+ SYSCALL_METADATA(sname, x, __VA_ARGS__) \
+ __SYSCALL_DEFINEx(x, sname, __VA_ARGS__)
diff --git a/share/doc/grepc/examples/linux/landlock_rule_type b/share/doc/grepc/examples/linux/landlock_rule_type
new file mode 100644
index 0000000..8711326
--- /dev/null
+++ b/share/doc/grepc/examples/linux/landlock_rule_type
@@ -0,0 +1,11 @@
+
+
+./include/uapi/linux/landlock.h:43:
+
+enum landlock_rule_type {
+ /**
+ * @LANDLOCK_RULE_PATH_BENEATH: Type of a &struct
+ * landlock_path_beneath_attr .
+ */
+ LANDLOCK_RULE_PATH_BENEATH = 1,
+};
diff --git a/share/doc/grepc/examples/linux/off_t b/share/doc/grepc/examples/linux/off_t
new file mode 100644
index 0000000..b44a37e
--- /dev/null
+++ b/share/doc/grepc/examples/linux/off_t
@@ -0,0 +1,15 @@
+
+
+./include/linux/types.h:21:
+
+typedef __kernel_off_t off_t;
+
+
+./include/linux/types.h:46:
+
+typedef __kernel_loff_t loff_t;
+
+
+./tools/include/nolibc/nolibc.h:136:
+
+typedef signed long off_t;
diff --git a/share/doc/grepc/examples/linux/open b/share/doc/grepc/examples/linux/open
new file mode 100644
index 0000000..27a09c0
--- /dev/null
+++ b/share/doc/grepc/examples/linux/open
@@ -0,0 +1,148 @@
+
+
+./drivers/tty/synclink_gt.c:140:
+
+static int open(struct tty_struct *tty, struct file * filp);
+
+
+./drivers/pci/hotplug/cpqphp_sysfs.c:131:
+
+static int open(struct inode *inode, struct file *file)
+{
+ struct controller *ctrl = inode->i_private;
+ struct ctrl_dbg *dbg;
+ int retval = -ENOMEM;
+
+ mutex_lock(&cpqphp_mutex);
+ dbg = kmalloc(sizeof(*dbg), GFP_KERNEL);
+ if (!dbg)
+ goto exit;
+ dbg->data = kmalloc(MAX_OUTPUT, GFP_KERNEL);
+ if (!dbg->data) {
+ kfree(dbg);
+ goto exit;
+ }
+ dbg->size = spew_debug_info(ctrl, dbg->data, MAX_OUTPUT);
+ file->private_data = dbg;
+ retval = 0;
+exit:
+ mutex_unlock(&cpqphp_mutex);
+ return retval;
+}
+
+
+./drivers/tty/synclink_gt.c:647:
+
+static int open(struct tty_struct *tty, struct file *filp)
+{
+ struct slgt_info *info;
+ int retval, line;
+ unsigned long flags;
+
+ line = tty->index;
+ if (line >= slgt_device_count) {
+ DBGERR(("%s: open with invalid line #%d.\n", driver_name, line));
+ return -ENODEV;
+ }
+
+ info = slgt_device_list;
+ while(info && info->line != line)
+ info = info->next_device;
+ if (sanity_check(info, tty->name, "open"))
+ return -ENODEV;
+ if (info->init_error) {
+ DBGERR(("%s init error=%d\n", info->device_name, info->init_error));
+ return -ENODEV;
+ }
+
+ tty->driver_data = info;
+ info->port.tty = tty;
+
+ DBGINFO(("%s open, old ref count = %d\n", info->device_name, info->port.count));
+
+ mutex_lock(&info->port.mutex);
+ info->port.low_latency = (info->port.flags & ASYNC_LOW_LATENCY) ? 1 : 0;
+
+ spin_lock_irqsave(&info->netlock, flags);
+ if (info->netcount) {
+ retval = -EBUSY;
+ spin_unlock_irqrestore(&info->netlock, flags);
+ mutex_unlock(&info->port.mutex);
+ goto cleanup;
+ }
+ info->port.count++;
+ spin_unlock_irqrestore(&info->netlock, flags);
+
+ if (info->port.count == 1) {
+ /* 1st open on this device, init hardware */
+ retval = startup(info);
+ if (retval < 0) {
+ mutex_unlock(&info->port.mutex);
+ goto cleanup;
+ }
+ }
+ mutex_unlock(&info->port.mutex);
+ retval = block_til_ready(tty, filp, info);
+ if (retval) {
+ DBGINFO(("%s block_til_ready rc=%d\n", info->device_name, retval));
+ goto cleanup;
+ }
+
+ retval = 0;
+
+cleanup:
+ if (retval) {
+ if (tty->count == 1)
+ info->port.tty = NULL; /* tty layer will release tty struct */
+ if(info->port.count)
+ info->port.count--;
+ }
+
+ DBGINFO(("%s open rc=%d\n", info->device_name, retval));
+ return retval;
+}
+
+
+./tools/include/nolibc/nolibc.h:2037:
+
+static __attribute__((unused))
+int open(const char *path, int flags, mode_t mode)
+{
+ int ret = sys_open(path, flags, mode);
+
+ if (ret < 0) {
+ SET_ERRNO(-ret);
+ ret = -1;
+ }
+ return ret;
+}
+
+
+./include/linux/compat.h:843:
+
+asmlinkage long compat_sys_open(const char __user *filename, int flags,
+ umode_t mode);
+
+
+./include/linux/syscalls.h:1046:
+
+asmlinkage long sys_open(const char __user *filename,
+ int flags, umode_t mode);
+
+
+./fs/open.c:1192:
+
+SYSCALL_DEFINE3(open, const char __user *, filename, int, flags, umode_t, mode)
+{
+ if (force_o_largefile())
+ flags |= O_LARGEFILE;
+ return do_sys_open(AT_FDCWD, filename, flags, mode);
+}
+
+
+./fs/open.c:1235:
+
+COMPAT_SYSCALL_DEFINE3(open, const char __user *, filename, int, flags, umode_t, mode)
+{
+ return do_sys_open(AT_FDCWD, filename, flags, mode);
+}
diff --git a/share/doc/grepc/examples/linux/timespec b/share/doc/grepc/examples/linux/timespec
new file mode 100644
index 0000000..eb1557e
--- /dev/null
+++ b/share/doc/grepc/examples/linux/timespec
@@ -0,0 +1,16 @@
+
+
+./include/uapi/linux/time.h:11:
+
+struct timespec {
+ __kernel_old_time_t tv_sec; /* seconds */
+ long tv_nsec; /* nanoseconds */
+};
+
+
+./tools/include/nolibc/nolibc.h:162:
+
+struct timespec {
+ long tv_sec;
+ long tv_nsec;
+};