instruction
stringlengths
82
202
input
stringclasses
1 value
output
stringlengths
73
23.9M
Linux kernel'inin 'scripts/mod/sumversion' alt sistemi için gerekli C kaynak kodunu implemente et.
```c #include <netinet/in.h> #ifdef __sun__ #include <inttypes.h> #else #include <stdint.h> #endif #include <ctype.h> #include <errno.h> #include <string.h> #include <limits.h> #include <xalloc.h> #include "modpost.h" /* * Stolen form Cryptographic API. * * MD4 Message Digest Algorithm (RFC1320). * * Implementat...
Linux işletim sistemi çekirdeği için 'scripts/mod/modpost' yapılarının ve prototiplerinin bulunduğu C Header dosyasını yaz.
```c /* SPDX-License-Identifier: GPL-2.0 */ #include <byteswap.h> #include <stdbool.h> #include <stdio.h> #include <stdlib.h> #include <stdarg.h> #include <string.h> #include <sys/types.h> #include <sys/stat.h> #include <sys/mman.h> #include <fcntl.h> #include <unistd.h> #include <elf.h> #include "../../include/linux/m...
Linux kernel'inin 'scripts/mod/modpost' alt sistemi için gerekli C kaynak kodunu implemente et.
```c /* Postprocess module symbol versions * * Copyright 2003 Kai Germaschewski * Copyright 2002-2004 Rusty Russell, IBM Corporation * Copyright 2006-2008 Sam Ravnborg * Based in part on module-init-tools/depmod.c,file2alias * * This software may be used and distributed according to the terms * of the G...
Linux kernel'inin 'scripts/mod/symsearch' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* * Helper functions for finding the symbol in an ELF which is "nearest" * to a given address. */ #include <xalloc.h> #include "modpost.h" struct syminfo { unsigned int symbol_index; unsigned int section_index; Elf_Addr addr; }; /* * Container used to hold an entire b...
Linux kernel'inin 'scripts/mod/mk_elfconfig' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include <stdio.h> #include <stdlib.h> #include <string.h> #include <elf.h> int main(int argc, char **argv) { unsigned char ei[EI_NIDENT]; if (fread(ei, 1, EI_NIDENT, stdin) != EI_NIDENT) { fprintf(stderr, "Error: input truncated\n"); return 1; } if (memcmp(ei, ELFMAG,...
Linux kernel'inin 'scripts/mod/file2alias' alt sistemi için gerekli C kaynak kodunu implemente et.
```c /* Simple code to turn various tables in an ELF file into alias definitions. * This deals with kernel datastructures where they should be * dealt with: in the kernel source. * * Copyright 2002-2003 Rusty Russell, IBM Corporation * 2003 Kai Germaschewski * * * This software may be used and ...
Linux kernel'inin 'scripts/mod/devicetable-offsets' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #define COMPILE_OFFSETS #include <linux/kbuild.h> #include <linux/mod_devicetable.h> #define DEVID(devid) DEFINE(SIZE_##devid, sizeof(struct devid)) #define DEVID_FIELD(devid, field) \ DEFINE(OFF_##devid##_##field, offsetof(struct devid, field)) int main(void) { DEVID(usb_de...
Linux kernel'inin 'scripts/genksyms/genksyms' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0-or-later /* Generate kernel symbol version hashes. Copyright 1996, 1997 Linux International. New implementation contributed by Richard Henderson <rth@tamu.edu> Based on original work by Bjorn Ekwall <bj0rn@blox.se> This file was part of the Linux modutils 2.4.22: m...
Linux kernel'inin 'scripts/genksyms/keywords' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0-only static struct resword { const char *name; int token; } keywords[] = { { "__GENKSYMS_EXPORT_SYMBOL", EXPORT_SYMBOL_KEYW }, { "__asm", ASM_KEYW }, { "__asm__", ASM_KEYW }, { "__attribute", ATTRIBUTE_KEYW }, { "__attribute__", ATTRIBUTE_KEYW }, { "__const", CONST_KEYW ...
Linux işletim sistemi çekirdeği için 'scripts/genksyms/genksyms' yapılarının ve prototiplerinin bulunduğu C Header dosyasını yaz.
```c /* SPDX-License-Identifier: GPL-2.0-or-later */ /* Generate kernel symbol version hashes. Copyright 1996, 1997 Linux International. New implementation contributed by Richard Henderson <rth@tamu.edu> Based on original work by Bjorn Ekwall <bj0rn@blox.se> This file is part of the Linux modutils. */ ...
Linux kernel'inin 'scripts/livepatch/init' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* * Init code for a livepatch kernel module */ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt #include <linux/kernel.h> #include <linux/slab.h> #include <linux/livepatch.h> static struct klp_patch *patch; static int __init livepatch_mod_init(void) { struct klp_object_ext *o...
Linux kernel'inin 'samples/hung_task/hung_task_tests' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0-or-later /* * hung_task_tests.c - Sample code for testing hung tasks with mutex, * semaphore, etc. * * Usage: Load this module and read `<debugfs>/hung_task/mutex`, * `<debugfs>/hung_task/semaphore`, `<debugfs>/hung_task/rw_semaphore_read`, * `<debugfs>/hung_...
Linux kernel'inin 'samples/ftrace/ftrace-ops' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0-only #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt #include <linux/ftrace.h> #include <linux/ktime.h> #include <linux/module.h> #include <asm/barrier.h> /* * Arbitrary large value chosen to be sufficiently large to minimize noise but * sufficiently small to complete qu...
Linux kernel'inin 'samples/ftrace/ftrace-direct-too' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0-only #include <linux/module.h> #include <linux/mm.h> /* for handle_mm_fault() */ #include <linux/ftrace.h> #if !defined(CONFIG_ARM64) && !defined(CONFIG_PPC32) #include <asm/asm-offsets.h> #endif extern void my_direct_func(struct vm_area_struct *vma, unsigned long address, ...
Linux kernel'inin 'samples/ftrace/ftrace-direct-multi' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0-only #include <linux/module.h> #include <linux/mm.h> /* for handle_mm_fault() */ #include <linux/ftrace.h> #include <linux/sched/stat.h> #if !defined(CONFIG_ARM64) && !defined(CONFIG_PPC32) #include <asm/asm-offsets.h> #endif extern void my_direct_func(unsigned long ip); void...
Linux işletim sistemi çekirdeği için 'samples/ftrace/sample-trace-array' yapılarının ve prototiplerinin bulunduğu C Header dosyasını yaz.
```c /* SPDX-License-Identifier: GPL-2.0 */ /* * If TRACE_SYSTEM is defined, that will be the directory created * in the ftrace directory under /sys/kernel/tracing/events/<system> * * The define_trace.h below will also look for a file name of * TRACE_SYSTEM.h where TRACE_SYSTEM is what is defined here. * In this...
Linux kernel'inin 'samples/ftrace/ftrace-direct-modify' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0-only #include <linux/module.h> #include <linux/kthread.h> #include <linux/ftrace.h> #if !defined(CONFIG_ARM64) && !defined(CONFIG_PPC32) #include <asm/asm-offsets.h> #endif extern void my_direct_func1(void); extern void my_direct_func2(void); void my_direct_func1(void) { trac...
Linux kernel'inin 'samples/ftrace/ftrace-direct' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0-only #include <linux/module.h> #include <linux/sched.h> /* for wake_up_process() */ #include <linux/ftrace.h> #if !defined(CONFIG_ARM64) && !defined(CONFIG_PPC32) #include <asm/asm-offsets.h> #endif extern void my_direct_func(struct task_struct *p); void my_direct_func(struct...
Linux kernel'inin 'samples/ftrace/sample-trace-array' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0-only #include <linux/module.h> #include <linux/kthread.h> #include <linux/trace.h> #include <linux/trace_events.h> #include <linux/timer.h> #include <linux/err.h> #include <linux/jiffies.h> #include <linux/workqueue.h> /* * Any file that uses trace points, must include the hea...
Linux kernel'inin 'samples/ftrace/ftrace-direct-multi-modify' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0-only #include <linux/module.h> #include <linux/kthread.h> #include <linux/ftrace.h> #if !defined(CONFIG_ARM64) && !defined(CONFIG_PPC32) #include <asm/asm-offsets.h> #endif extern void my_direct_func1(unsigned long ip); extern void my_direct_func2(unsigned long ip); void my_di...
Linux kernel'inin 'samples/acrn/vm-sample' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* * A sample program to run a User VM on the ACRN hypervisor * * This sample runs in a Service VM, which is a privileged VM of ACRN. * CONFIG_ACRN_HSM needs to be enabled in the Service VM. * * Guest VM code in guest16.s will be executed after the VM launched. * * Copyr...
Linux kernel'inin 'samples/fanotify/fs-monitor' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* * Copyright 2021, Collabora Ltd. */ #define _GNU_SOURCE #include <errno.h> #include <err.h> #include <stdlib.h> #include <stdio.h> #include <fcntl.h> #include <sys/fanotify.h> #include <sys/types.h> #include <unistd.h> #ifndef __GLIBC__ #include <asm-generic/int-ll64.h> #e...
Linux kernel'inin 'samples/mei/mei-amt-version' alt sistemi için gerekli C kaynak kodunu implemente et.
```c /****************************************************************************** * Intel Management Engine Interface (Intel MEI) Linux driver * Intel MEI Interface Header * * This file is provided under a dual BSD/GPLv2 license. When using or * redistributing this file, you may do so under either license. * ...
Linux kernel'inin 'samples/uhid/uhid-example' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* * UHID Example * * Copyright (c) 2012-2013 David Herrmann <dh.herrmann@gmail.com> * * The code may be used by anyone for any purpose, * and can serve as a starting point for developing * applications using uhid. */ /* * UHID Example * This example emulates a basic ...
Linux kernel'inin 'samples/damon/prcl' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* * proactive reclamation: monitor access pattern of a given process, find * regions that seems not accessed, and proactively page out the regions. */ #define pr_fmt(fmt) "damon_sample_prcl: " fmt #include <linux/damon.h> #include <linux/init.h> #include <linux/kernel.h> #...
Linux kernel'inin 'samples/damon/mtier' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* * memory tiering: migrate cold pages in node 0 and hot pages in node 1 to node * 1 and node 0, respectively. Adjust the hotness/coldness threshold aiming * resulting 99.6 % node 0 utilization ratio. */ #define pr_fmt(fmt) "damon_sample_mtier: " fmt #include <linux/damo...
Linux kernel'inin 'samples/damon/wsse' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* * working set size estimation: monitor access pattern of given process and * print estimated working set size (total size of regions that showing some * access). */ #define pr_fmt(fmt) "damon_sample_wsse: " fmt #include <linux/damon.h> #include <linux/init.h> #include <...
Linux kernel'inin 'samples/timers/hpet_example' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <fcntl.h> #include <string.h> #include <memory.h> #include <malloc.h> #include <time.h> #include <ctype.h> #include <sys/types.h> #include <sys/wait.h> #include <signal.h> #include <errno.h> #include <sys/time.h...
Linux kernel'inin 'samples/trace_printk/trace-printk' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0-only #include <linux/module.h> #include <linux/kthread.h> #include <linux/irq_work.h> /* Must not be static to force gcc to consider these non constant */ char *trace_printk_test_global_str = "This is a dynamic string that will use trace_puts\n"; char *trace_printk_test_globa...
Linux kernel'inin 'samples/kdb/kdb_hello' alt sistemi için gerekli C kaynak kodunu implemente et.
```c /* * Created by: Jason Wessel <jason.wessel@windriver.com> * * Copyright (c) 2010 Wind River Systems, Inc. All Rights Reserved. * * This file is licensed under the terms of the GNU General Public * License version 2. This program is licensed "as is" without any * warranty of any kind, whether express or im...
Linux kernel'inin 'samples/connector/ucon' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0-or-later /* * ucon.c * * Copyright (c) 2004+ Evgeniy Polyakov <zbr@ioremap.net> */ #include <asm/types.h> #include <sys/types.h> #include <sys/socket.h> #include <sys/poll.h> #include <linux/netlink.h> #include <linux/rtnetlink.h> #include <arpa/inet.h> #include <stdbo...
Linux kernel'inin 'samples/connector/cn_test' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0-or-later /* * cn_test.c * * 2004+ Copyright (c) Evgeniy Polyakov <zbr@ioremap.net> * All rights reserved. */ #define pr_fmt(fmt) "cn_test: " fmt #include <linux/kernel.h> #include <linux/module.h> #include <linux/moduleparam.h> #include <linux/skbuff.h> #include <linux/...
Linux kernel'inin 'samples/kmemleak/kmemleak-test' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0-only /* * samples/kmemleak/kmemleak-test.c * * Copyright (C) 2008 ARM Limited * Written by Catalin Marinas <catalin.marinas@arm.com> */ #define pr_fmt(fmt) "kmemleak: " fmt #include <linux/init.h> #include <linux/kernel.h> #include <linux/module.h> #include <linux/slab.h>...
Linux kernel'inin 'samples/kprobes/kretprobe_example' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0-only /* * kretprobe_example.c * * Here's a sample kernel module showing the use of return probes to * report the return value and total time taken for probed function * to run. * * usage: insmod kretprobe_example.ko func=<func_name> * * If no func_name is specified, ker...
Linux kernel'inin 'samples/kprobes/kprobe_example' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0-only /* * Here's a sample kernel module showing the use of kprobes to dump a * stack trace and selected registers when kernel_clone() is called. * * For more information on theory of operation of kprobes, see * Documentation/trace/kprobes.rst * * You will see the trace da...
Linux kernel'inin 'samples/user_events/example' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0-only /* * Copyright (c) 2021, Microsoft Corporation. * * Authors: * Beau Belgrave <beaub@linux.microsoft.com> */ #include <errno.h> #include <sys/ioctl.h> #include <sys/mman.h> #include <sys/uio.h> #include <fcntl.h> #include <stdio.h> #include <unistd.h> #include <linux...
Linux kernel'inin 'samples/workqueue/stall_detector/wq_stall' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* * wq_stall - Test module for the workqueue stall detector. * * Deliberately creates a workqueue stall so the watchdog fires and * prints diagnostic output. Useful for verifying that the stall * detector correctly identifies stuck workers and produces useful * backtrace...
Linux kernel'inin 'samples/hidraw/hid-example' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* * Hidraw Userspace Example * * Copyright (c) 2010 Alan Ott <alan@signal11.us> * Copyright (c) 2010 Signal 11 Software * * The code may be used by anyone for any purpose, * and can serve as a starting point for developing * applications using hidraw. */ /* Linux */ #...
Linux kernel'inin 'samples/pfsm/pfsm-wakeup' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* * TPS6594 PFSM userspace example * * Copyright (C) 2023 BayLibre Incorporated - https://www.baylibre.com/ * * This example shows how to use PFSMs from a userspace application, * on TI j721s2 platform. The PMIC is armed to be triggered by a RTC * alarm to execute state ...
Linux kernel'inin 'samples/nitro_enclaves/ne_ioctl_sample' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* * Copyright 2020-2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. */ /** * DOC: Sample flow of using the ioctl interface provided by the Nitro Enclaves (NE) * kernel driver. * * Usage * ----- * * Load the nitro_enclaves module, setting also the enclave ...
Linux kernel'inin 'samples/cgroup/cgroup_event_listener' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* * cgroup_event_listener.c - Simple listener of cgroup events * * Copyright (C) Kirill A. Shutemov <kirill@shutemov.name> */ #include <assert.h> #include <err.h> #include <errno.h> #include <fcntl.h> #include <libgen.h> #include <limits.h> #include <stdio.h> #include <str...
Linux kernel'inin 'samples/cgroup/memcg_event_listener' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* * memcg_event_listener.c - Simple listener of memcg memory.events * * Copyright (c) 2023, SaluteDevices. All Rights Reserved. * * Author: Dmitry Rokosov <ddrokosov@salutedevices.com> */ #include <err.h> #include <errno.h> #include <limits.h> #include <poll.h> #include ...
Linux kernel'inin 'samples/rust/rust_print_events' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0-only /* * Copyright 2024 Google LLC */ #define CREATE_TRACE_POINTS #define CREATE_RUST_TRACE_POINTS #include <trace/events/rust_sample.h> ```
Linux kernel'inin 'samples/hid/hid_mouse.bpf' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include "vmlinux.h" #include <bpf/bpf_helpers.h> #include <bpf/bpf_tracing.h> #include "hid_bpf_helpers.h" static int hid_y_event(struct hid_bpf_ctx *hctx) { s16 y; __u8 *data = hid_bpf_get_data(hctx, 0 /* offset */, 9 /* size */); if (!data) return 0; /* EPERM check */...
Linux kernel'inin 'samples/hid/hid_surface_dial' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0-only /* Copyright (c) 2022 Benjamin Tissoires * * This program will morph the Microsoft Surface Dial into a mouse, * and depending on the chosen resolution enable or not the haptic feedback: * - a resolution (-r) of 3600 will report 3600 "ticks" in one full rotation * wit...
Linux işletim sistemi çekirdeği için 'samples/hid/hid_bpf_helpers' yapılarının ve prototiplerinin bulunduğu C Header dosyasını yaz.
```c /* SPDX-License-Identifier: GPL-2.0-only */ /* Copyright (c) 2022 Benjamin Tissoires */ #ifndef __HID_BPF_HELPERS_H #define __HID_BPF_HELPERS_H /* following are kfuncs exported by HID for HID-BPF */ extern __u8 *hid_bpf_get_data(struct hid_bpf_ctx *ctx, unsigned int offset, const size_t __sz) ...
Linux kernel'inin 'samples/hid/hid_surface_dial.bpf' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0-only /* Copyright (c) 2022 Benjamin Tissoires */ #include "vmlinux.h" #include <bpf/bpf_helpers.h> #include <bpf/bpf_tracing.h> #include "hid_bpf_helpers.h" #define HID_UP_BUTTON 0x0009 #define HID_GD_WHEEL 0x0038 SEC("struct_ops/hid_device_event") int BPF_PROG(hid_event, ...
Linux kernel'inin 'samples/hid/hid_mouse' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0-only /* Copyright (c) 2022 Benjamin Tissoires * * This is a pure HID-BPF example, and should be considered as such: * on the Etekcity Scroll 6E, the X and Y axes will be swapped and * inverted. On any other device... Not sure what this will do. * * This C main file is gene...
Linux kernel'inin 'samples/vfio-mdev/mdpy' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* * Mediated virtual PCI display host device driver * * See mdpy-defs.h for device specs * * (c) Gerd Hoffmann <kraxel@redhat.com> * * based on mtty driver which is: * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved. * Author: Neo Jia <cjia@nvidia.com>...
Linux kernel'inin 'samples/vfio-mdev/mdpy-fb' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* * Framebuffer driver for mdpy (mediated virtual pci display device). * * See mdpy-defs.h for device specs * * (c) Gerd Hoffmann <kraxel@redhat.com> * * Using some code snippets from simplefb and cirrusfb. * * This program is free software; you can redistribute it a...
Linux kernel'inin 'samples/vfio-mdev/mbochs' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* * Mediated virtual PCI display host device driver * * Emulate enough of qemu stdvga to make bochs-drm.ko happy. That is * basically the vram memory bar and the bochs dispi interface vbe * registers in the mmio register bar. Specifically it does *not* * include any lega...
Linux kernel'inin 'samples/vfio-mdev/mtty' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0-only /* * Mediated virtual PCI serial host device driver * * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved. * Author: Neo Jia <cjia@nvidia.com> * Kirti Wankhede <kwankhede@nvidia.com> * * Sample driver that creates mdev device that simulates ...
Linux işletim sistemi çekirdeği için 'samples/vfio-mdev/mdpy-defs' yapılarının ve prototiplerinin bulunduğu C Header dosyasını yaz.
```c /* SPDX-License-Identifier: GPL-2.0 */ /* * Simple pci display device. * * Framebuffer memory is pci bar 0. * Configuration (read-only) is in pci config space. * Format field uses drm fourcc codes. * ATM only DRM_FORMAT_XRGB8888 is supported. */ /* pci ids */ #define MDPY_PCI_VENDOR_ID PCI_VENDOR_ID_REDHAT...
Linux kernel'inin 'samples/coresight/coresight-cfg-sample' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* * Copyright(C) 2020 Linaro Limited. All rights reserved. * Author: Mike Leach <mike.leach@linaro.org> */ #include "coresight-config.h" #include "coresight-syscfg.h" /* create an alternate autofdo configuration */ /* we will provide 4 sets of preset parameter values */ #...
Linux kernel'inin 'samples/watchdog/watchdog-simple' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <fcntl.h> int main(void) { int fd = open("/dev/watchdog", O_WRONLY); int ret = 0; if (fd == -1) { perror("watchdog"); exit(EXIT_FAILURE); } while (1) { ret = write(fd, "\0", 1); if (ret != 1) { ...
Linux kernel'inin 'samples/binderfs/binderfs_example' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #define _GNU_SOURCE #include <errno.h> #include <fcntl.h> #include <sched.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <sys/ioctl.h> #include <sys/mount.h> #include <sys/stat.h> #include <sys/types.h> #include <unistd.h> #include <linux/android/binder....
Linux kernel'inin 'samples/bpf/lathist_user' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0-only /* Copyright (c) 2013-2015 PLUMgrid, http://plumgrid.com * Copyright (c) 2015 BMW Car IT GmbH */ #include <stdio.h> #include <unistd.h> #include <stdlib.h> #include <signal.h> #include <bpf/libbpf.h> #include <bpf/bpf.h> #define MAX_ENTRIES 20 #define MAX_CPU 4 #define ...
Linux kernel'inin 'samples/bpf/tcp_basertt_kern' alt sistemi için gerekli C kaynak kodunu implemente et.
```c /* Copyright (c) 2017 Facebook * * This program is free software; you can redistribute it and/or * modify it under the terms of version 2 of the GNU General Public * License as published by the Free Software Foundation. * * BPF program to set base_rtt to 80us when host is running TCP-NV and * both hosts are...
Linux işletim sistemi çekirdeği için 'samples/bpf/xdp_sample_user' yapılarının ve prototiplerinin bulunduğu C Header dosyasını yaz.
```c // SPDX-License-Identifier: GPL-2.0-only #ifndef XDP_SAMPLE_USER_H #define XDP_SAMPLE_USER_H #include <bpf/libbpf.h> #include <linux/compiler.h> #include "xdp_sample_shared.h" enum stats_mask { _SAMPLE_REDIRECT_MAP = 1U << 0, SAMPLE_RX_CNT = 1U << 1, SAMPLE_REDIRECT_ERR_CNT = 1U <...
Linux kernel'inin 'samples/bpf/parse_varlen' alt sistemi için gerekli C kaynak kodunu implemente et.
```c /* Copyright (c) 2016 Facebook * * This program is free software; you can redistribute it and/or * modify it under the terms of version 2 of the GNU General Public * License as published by the Free Software Foundation. */ #define KBUILD_MODNAME "foo" #include <linux/if_ether.h> #include <linux/if_vlan.h> #in...
Linux işletim sistemi çekirdeği için 'samples/bpf/sock_example' yapılarının ve prototiplerinin bulunduğu C Header dosyasını yaz.
```c /* SPDX-License-Identifier: GPL-2.0 */ #include <stdlib.h> #include <stdio.h> #include <linux/unistd.h> #include <unistd.h> #include <string.h> #include <errno.h> #include <linux/if_ether.h> #include <net/if.h> #include <linux/if_packet.h> #include <arpa/inet.h> static inline int open_raw_sock(const char *name) {...
Linux kernel'inin 'samples/bpf/syscall_nrs' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include <uapi/linux/unistd.h> #include <linux/kbuild.h> #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wmissing-prototypes" #define SYSNR(_NR) DEFINE(SYS ## _NR, _NR) void syscall_defines(void) { COMMENT("Linux system call numbers."); SYSNR(__NR_write); SYSN...
Linux işletim sistemi çekirdeği için 'samples/bpf/hbm' yapılarının ve prototiplerinin bulunduğu C Header dosyasını yaz.
```c /* SPDX-License-Identifier: GPL-2.0 * * Copyright (c) 2019 Facebook * * This program is free software; you can redistribute it and/or * modify it under the terms of version 2 of the GNU General Public * License as published by the Free Software Foundation. * * Include file for Host Bandwidth Management (HB...
Linux kernel'inin 'samples/bpf/tcp_cong_kern' alt sistemi için gerekli C kaynak kodunu implemente et.
```c /* Copyright (c) 2017 Facebook * * This program is free software; you can redistribute it and/or * modify it under the terms of version 2 of the GNU General Public * License as published by the Free Software Foundation. * * BPF program to set congestion control to dctcp when both hosts are * in the same dat...
Linux kernel'inin 'samples/bpf/test_lru_dist' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0-only /* * Copyright (c) 2016 Facebook */ #define _GNU_SOURCE #include <linux/types.h> #include <stdio.h> #include <unistd.h> #include <linux/bpf.h> #include <errno.h> #include <string.h> #include <assert.h> #include <sched.h> #include <sys/wait.h> #include <sys/stat.h> #includ...
Linux kernel'inin 'samples/bpf/hbm' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2019 Facebook * * This program is free software; you can redistribute it and/or * modify it under the terms of version 2 of the GNU General Public * License as published by the Free Software Foundation. * * Example program for Host Bandwidth Management * ...
Linux işletim sistemi çekirdeği için 'samples/bpf/xdp_sample.bpf' yapılarının ve prototiplerinin bulunduğu C Header dosyasını yaz.
```c // SPDX-License-Identifier: GPL-2.0 #ifndef _XDP_SAMPLE_BPF_H #define _XDP_SAMPLE_BPF_H #include "vmlinux.h" #include <bpf/bpf_tracing.h> #include <bpf/bpf_core_read.h> #include <bpf/bpf_helpers.h> #include "net_shared.h" #include "xdp_sample_shared.h" #define EINVAL 22 #define ENETDOWN 100 #define EMSGSIZE 90 ...
Linux kernel'inin 'samples/bpf/cpustat_kern' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include <linux/version.h> #include <linux/ptrace.h> #include <uapi/linux/bpf.h> #include <bpf/bpf_helpers.h> /* * The CPU number, cstate number and pstate number are based * on 96boards Hikey with octa CA53 CPUs. * * Every CPU have three idle states for cstate: * WFI, ...
Linux kernel'inin 'samples/bpf/xdp_sample.bpf' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* GPLv2, Copyright(c) 2017 Jesper Dangaard Brouer, Red Hat, Inc. */ #include "xdp_sample.bpf.h" #include <bpf/bpf_tracing.h> #include <bpf/bpf_core_read.h> #include <bpf/bpf_helpers.h> array_map rx_cnt SEC(".maps"); array_map redir_err_cnt SEC(".maps"); array_map cpumap_enqu...
Linux kernel'inin 'samples/bpf/sockex1_kern' alt sistemi için gerekli C kaynak kodunu implemente et.
```c #include <uapi/linux/bpf.h> #include <uapi/linux/if_ether.h> #include <uapi/linux/if_packet.h> #include <uapi/linux/ip.h> #include <bpf/bpf_helpers.h> #include "bpf_legacy.h" struct { __uint(type, BPF_MAP_TYPE_ARRAY); __type(key, u32); __type(value, long); __uint(max_entries, 256); } my_map SEC(".maps"); SEC...
Linux kernel'inin 'samples/bpf/trace_event_user' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0-only /* Copyright (c) 2016 Facebook */ #include <stdio.h> #include <unistd.h> #include <stdlib.h> #include <stdbool.h> #include <string.h> #include <linux/perf_event.h> #include <linux/bpf.h> #include <signal.h> #include <errno.h> #include <sys/resource.h> #include <bpf/bpf.h> ...
Linux kernel'inin 'samples/bpf/task_fd_query_kern' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include <linux/version.h> #include <linux/ptrace.h> #include <uapi/linux/bpf.h> #include <bpf/bpf_helpers.h> SEC("kprobe/blk_mq_start_request") int bpf_prog1(struct pt_regs *ctx) { return 0; } SEC("kretprobe/__blk_account_io_done") int bpf_prog2(struct pt_regs *ctx) { retur...
Linux kernel'inin 'samples/bpf/sockex1_user' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include <stdio.h> #include <assert.h> #include <linux/bpf.h> #include <bpf/bpf.h> #include <bpf/libbpf.h> #include "sock_example.h" #include <unistd.h> #include <arpa/inet.h> int main(int ac, char **argv) { struct bpf_object *obj; struct bpf_program *prog; int map_fd, prog_...
Linux kernel'inin 'samples/bpf/sockex2_user' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include <stdio.h> #include <assert.h> #include <linux/bpf.h> #include <bpf/bpf.h> #include <bpf/libbpf.h> #include "sock_example.h" #include <unistd.h> #include <arpa/inet.h> struct pair { __u64 packets; __u64 bytes; }; int main(int ac, char **argv) { struct bpf_program *p...
Linux kernel'inin 'samples/bpf/tcp_rwnd_kern' alt sistemi için gerekli C kaynak kodunu implemente et.
```c /* Copyright (c) 2017 Facebook * * This program is free software; you can redistribute it and/or * modify it under the terms of version 2 of the GNU General Public * License as published by the Free Software Foundation. * * BPF program to set initial receive window to 40 packets when using IPv6 * and the fi...
Linux kernel'inin 'samples/bpf/hbm_edt_kern' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2019 Facebook * * This program is free software; you can redistribute it and/or * modify it under the terms of version 2 of the GNU General Public * License as published by the Free Software Foundation. * * Sample Host Bandwidth Manager (HBM) BPF program. ...
Linux kernel'inin 'samples/bpf/tracex3_user' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0-only /* Copyright (c) 2013-2015 PLUMgrid, http://plumgrid.com */ #include <stdio.h> #include <stdlib.h> #include <signal.h> #include <unistd.h> #include <stdbool.h> #include <string.h> #include <bpf/bpf.h> #include <bpf/libbpf.h> #include "bpf_util.h" #define SLOTS 100 stati...
Linux kernel'inin 'samples/bpf/fds_example' alt sistemi için gerekli C kaynak kodunu implemente et.
```c #include <linux/unistd.h> #include <linux/bpf.h> #include <stdio.h> #include <stdlib.h> #include <stdint.h> #include <unistd.h> #include <string.h> #include <assert.h> #include <errno.h> #include <sys/types.h> #include <sys/socket.h> #include <bpf/bpf.h> #include <bpf/libbpf.h> #include "bpf_insn.h" #include "...
Linux işletim sistemi çekirdeği için 'samples/bpf/xdp_sample_shared' yapılarının ve prototiplerinin bulunduğu C Header dosyasını yaz.
```c // SPDX-License-Identifier: GPL-2.0-only #ifndef _XDP_SAMPLE_SHARED_H #define _XDP_SAMPLE_SHARED_H struct datarec { size_t processed; size_t dropped; size_t issue; union { size_t xdp_pass; size_t info; }; size_t xdp_drop; size_t xdp_redirect; } __attribute__((aligned(64))); #endif ```
Linux kernel'inin 'samples/bpf/tracex4.bpf' alt sistemi için gerekli C kaynak kodunu implemente et.
```c /* Copyright (c) 2015 PLUMgrid, http://plumgrid.com * * This program is free software; you can redistribute it and/or * modify it under the terms of version 2 of the GNU General Public * License as published by the Free Software Foundation. */ #include "vmlinux.h" #include <linux/version.h> #include <bpf/bpf_...
Linux kernel'inin 'samples/bpf/trace_output_user' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0-only #include <stdio.h> #include <fcntl.h> #include <poll.h> #include <time.h> #include <signal.h> #include <bpf/libbpf.h> static __u64 time_get_ns(void) { struct timespec ts; clock_gettime(CLOCK_MONOTONIC, &ts); return ts.tv_sec * 1000000000ull + ts.tv_nsec; } static __u6...
Linux kernel'inin 'samples/bpf/parse_ldabs' alt sistemi için gerekli C kaynak kodunu implemente et.
```c /* Copyright (c) 2016 Facebook * * This program is free software; you can redistribute it and/or * modify it under the terms of version 2 of the GNU General Public * License as published by the Free Software Foundation. */ #define KBUILD_MODNAME "foo" #include <linux/ip.h> #include <linux/ipv6.h> #include <li...
Linux kernel'inin 'samples/bpf/ibumad_kern' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB /* * ibumad BPF sample kernel side * * This program is free software; you can redistribute it and/or * modify it under the terms of version 2 of the GNU General Public * License as published by the Free Software Foundation. * * Copyright(c) 2018 Ira Weiny...
Linux kernel'inin 'samples/bpf/sampleip_user' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0-only /* * sampleip: sample instruction pointer and frequency count in a BPF map. * * Copyright 2016 Netflix, Inc. */ #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <errno.h> #include <signal.h> #include <string.h> #include <linux/perf_event.h> #include <...
Linux kernel'inin 'samples/bpf/task_fd_query_user' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include <stdio.h> #include <stdlib.h> #include <signal.h> #include <unistd.h> #include <stdbool.h> #include <string.h> #include <stdint.h> #include <fcntl.h> #include <linux/bpf.h> #include <sys/ioctl.h> #include <sys/types.h> #include <sys/stat.h> #include <linux/perf_event.h...
Linux kernel'inin 'samples/bpf/xdp_fwd_user' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2017-18 David Ahern <dsahern@gmail.com> * * This program is free software; you can redistribute it and/or * modify it under the terms of version 2 of the GNU General Public * License as published by the Free Software Foundation. * * This program is distrib...
Linux kernel'inin 'samples/bpf/xdp2skb_meta_kern' alt sistemi için gerekli C kaynak kodunu implemente et.
```c /* SPDX-License-Identifier: GPL-2.0 * Copyright (c) 2018 Jesper Dangaard Brouer, Red Hat Inc. * * Example howto transfer info from XDP to SKB, e.g. skb->mark * ----------------------------------------------------------- * This uses the XDP data_meta infrastructure, and is a cooperation * between two bpf-prog...
Linux kernel'inin 'samples/bpf/lwt_len_hist.bpf' alt sistemi için gerekli C kaynak kodunu implemente et.
```c /* Copyright (c) 2016 Thomas Graf <tgraf@tgraf.ch> * * This program is free software; you can redistribute it and/or * modify it under the terms of version 2 of the GNU General Public * License as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, b...
Linux kernel'inin 'samples/bpf/test_map_in_map.bpf' alt sistemi için gerekli C kaynak kodunu implemente et.
```c /* * Copyright (c) 2017 Facebook * * This program is free software; you can redistribute it and/or * modify it under the terms of version 2 of the GNU General Public * License as published by the Free Software Foundation. */ #define KBUILD_MODNAME "foo" #include "vmlinux.h" #include <linux/version.h> #includ...
Linux kernel'inin 'samples/bpf/tcp_tos_reflect_kern' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* * Copyright (c) 2018 Facebook * * BPF program to automatically reflect TOS option from received syn packet * * Use "bpftool cgroup attach $cg sock_ops $prog" to load this BPF program. */ #include <uapi/linux/bpf.h> #include <uapi/linux/tcp.h> #include <uapi/linux/if_et...
Linux kernel'inin 'samples/bpf/sampleip_kern' alt sistemi için gerekli C kaynak kodunu implemente et.
```c /* Copyright 2016 Netflix, Inc. * * This program is free software; you can redistribute it and/or * modify it under the terms of version 2 of the GNU General Public * License as published by the Free Software Foundation. */ #include <linux/ptrace.h> #include <uapi/linux/bpf.h> #include <uapi/linux/bpf_perf_ev...
Linux kernel'inin 'samples/bpf/tcbpf1_kern' alt sistemi için gerekli C kaynak kodunu implemente et.
```c #define KBUILD_MODNAME "foo" #include <uapi/linux/bpf.h> #include <uapi/linux/if_ether.h> #include <uapi/linux/if_packet.h> #include <uapi/linux/ip.h> #include <uapi/linux/in.h> #include <uapi/linux/tcp.h> #include <uapi/linux/filter.h> #include <uapi/linux/pkt_cls.h> #include <bpf/bpf_helpers.h> #include "bpf_leg...
Linux işletim sistemi çekirdeği için 'samples/bpf/bpf_insn' yapılarının ve prototiplerinin bulunduğu C Header dosyasını yaz.
```c /* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */ /* eBPF instruction mini library */ #ifndef __BPF_INSN_H #define __BPF_INSN_H struct bpf_insn; /* ALU ops on registers, bpf_add|sub|...: dst_reg += src_reg */ #define BPF_ALU64_REG(OP, DST, SRC) \ ((struct bpf_insn) { \ .code = BPF_ALU64 |...
Linux kernel'inin 'samples/bpf/trace_event_kern' alt sistemi için gerekli C kaynak kodunu implemente et.
```c /* Copyright (c) 2016 Facebook * * This program is free software; you can redistribute it and/or * modify it under the terms of version 2 of the GNU General Public * License as published by the Free Software Foundation. */ #include <linux/ptrace.h> #include <uapi/linux/bpf.h> #include <uapi/linux/bpf_perf_eve...
Linux kernel'inin 'samples/bpf/sockex3_kern' alt sistemi için gerekli C kaynak kodunu implemente et.
```c /* Copyright (c) 2015 PLUMgrid, http://plumgrid.com * * This program is free software; you can redistribute it and/or * modify it under the terms of version 2 of the GNU General Public * License as published by the Free Software Foundation. */ #include <uapi/linux/bpf.h> #include <uapi/linux/in.h> #include <u...
Linux kernel'inin 'samples/bpf/xdp_adjust_tail_user' alt sistemi için gerekli C kaynak kodunu implemente et.
```c /* SPDX-License-Identifier: GPL-2.0 * Copyright (c) 2018 Facebook * * This program is free software; you can redistribute it and/or * modify it under the terms of version 2 of the GNU General Public * License as published by the Free Software Foundation. */ #include <linux/bpf.h> #include <linux/if_link.h> #...
Linux kernel'inin 'samples/bpf/sockex3_user' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include <stdio.h> #include <assert.h> #include <bpf/bpf.h> #include <bpf/libbpf.h> #include "sock_example.h" #include <unistd.h> #include <arpa/inet.h> struct flow_key_record { __be32 src; __be32 dst; union { __be32 ports; __be16 port16[2]; }; __u32 ip_proto; }; stru...
Linux kernel'inin 'samples/bpf/xdp_tx_iptunnel_user' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0-only /* Copyright (c) 2016 Facebook */ #include <linux/bpf.h> #include <linux/if_link.h> #include <assert.h> #include <errno.h> #include <signal.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <net/if.h> #include <arpa/inet.h> #include <netinet/ether.h> #...
Linux kernel'inin 'samples/bpf/cpustat_user' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #define _GNU_SOURCE #include <errno.h> #include <stdio.h> #include <stdlib.h> #include <signal.h> #include <sched.h> #include <string.h> #include <unistd.h> #include <fcntl.h> #include <locale.h> #include <sys/types.h> #include <sys/stat.h> #include <sys/time.h> #include <sys/w...
Linux kernel'inin 'samples/bpf/tcp_bufs_kern' alt sistemi için gerekli C kaynak kodunu implemente et.
```c /* Copyright (c) 2017 Facebook * * This program is free software; you can redistribute it and/or * modify it under the terms of version 2 of the GNU General Public * License as published by the Free Software Foundation. * * BPF program to set initial receive window to 40 packets and send * and receive buffe...