instruction
stringlengths
82
202
input
stringclasses
1 value
output
stringlengths
73
23.9M
Linux kernel'inin 'tools/testing/selftests/mm/mlock-random-test' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* * It tests the mlock/mlock2() when they are invoked * on randomly memory region. */ #include <unistd.h> #include <sys/resource.h> #include <sys/capability.h> #include <sys/mman.h> #include <linux/mman.h> #include <fcntl.h> #include <string.h> #include <sys/ipc.h> #include ...
Linux kernel'inin 'tools/testing/selftests/mm/hugepage-shm' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* * hugepage-shm: * * Example of using huge page memory in a user application using Sys V shared * memory system calls. In this example the app is requesting 256MB of * memory that is backed by huge pages. The application uses the flag * SHM_HUGETLB in the shmget system...
Linux kernel'inin 'tools/testing/selftests/mm/pkey_sighandler_tests' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* * Tests Memory Protection Keys (see Documentation/core-api/protection-keys.rst) * * The testcases in this file exercise various flows related to signal handling, * using an alternate signal stack, with the default pkey (pkey 0) disabled. * * Compile with: * gcc -mxsave...
Linux kernel'inin 'tools/testing/selftests/mm/write_to_hugetlbfs' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* * This program reserves and uses hugetlb memory, supporting a bunch of * scenarios needed by the charged_reserved_hugetlb.sh test. */ #include <err.h> #include <errno.h> #include <signal.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #in...
Linux kernel'inin 'tools/testing/selftests/mm/khugepaged' alt sistemi için gerekli C kaynak kodunu implemente et.
```c #define _GNU_SOURCE #include <ctype.h> #include <errno.h> #include <fcntl.h> #include <limits.h> #include <dirent.h> #include <signal.h> #include <stdio.h> #include <stdlib.h> #include <stdbool.h> #include <string.h> #include <unistd.h> #include <linux/mman.h> #include <sys/mman.h> #include <sys/wait.h> #include ...
Linux kernel'inin 'tools/testing/selftests/mm/hugetlb-soft-offline' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* * Test soft offline behavior for HugeTLB pages: * - if enable_soft_offline = 0, hugepages should stay intact and soft * offlining failed with EOPNOTSUPP. * - if enable_soft_offline = 1, a hugepage should be dissolved and * nr_hugepages/free_hugepages should be reduce...
Linux kernel'inin 'tools/testing/selftests/mm/memory-failure' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* * Memory-failure functional tests. * * Author(s): Miaohe Lin <linmiaohe@huawei.com> */ #include "../kselftest_harness.h" #include <sys/mman.h> #include <linux/mman.h> #include <linux/string.h> #include <unistd.h> #include <signal.h> #include <setjmp.h> #include <fcntl.h...
Linux kernel'inin 'tools/testing/selftests/mm/hmm-tests' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* * HMM stands for Heterogeneous Memory Management, it is a helper layer inside * the linux kernel to help device drivers mirror a process address space in * the device. This allows the device to use the same address space which * makes communication and data exchange a lot...
Linux kernel'inin 'tools/testing/selftests/mm/protection_keys' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* * Tests Memory Protection Keys (see Documentation/core-api/protection-keys.rst) * * There are examples in here of: * * how to set protection keys on memory * * how to set/clear bits in pkey registers (the rights register) * * how to handle SEGV_PKUERR signals and ext...
Linux işletim sistemi çekirdeği için 'tools/testing/selftests/mm/pkey-arm64' yapılarının ve prototiplerinin bulunduğu C Header dosyasını yaz.
```c /* SPDX-License-Identifier: GPL-2.0 */ /* * Copyright (C) 2023 Arm Ltd. */ #ifndef _PKEYS_ARM64_H #define _PKEYS_ARM64_H #include "vm_util.h" /* for signal frame parsing */ #include "../arm64/signal/testcases/testcases.h" #ifndef SYS_mprotect_key # define SYS_mprotect_key 288 #endif #ifndef SYS_pkey_alloc # d...
Linux kernel'inin 'tools/testing/selftests/mm/memfd_secret' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* * Copyright IBM Corporation, 2021 * * Author: Mike Rapoport <rppt@linux.ibm.com> */ #define _GNU_SOURCE #include <sys/uio.h> #include <sys/mman.h> #include <sys/wait.h> #include <sys/types.h> #include <sys/ptrace.h> #include <sys/syscall.h> #include <sys/resource.h> #inc...
Linux kernel'inin 'tools/testing/selftests/mm/split_huge_page_test' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* * A test of splitting PMD THPs and PTE-mapped THPs from a specified virtual * address range in a process via <debugfs>/split_huge_pages interface. */ #define _GNU_SOURCE #include <assert.h> #include <stdio.h> #include <stdlib.h> #include <stdarg.h> #include <unistd.h> #in...
Linux işletim sistemi çekirdeği için 'tools/testing/selftests/mm/pkey-x86' yapılarının ve prototiplerinin bulunduğu C Header dosyasını yaz.
```c /* SPDX-License-Identifier: GPL-2.0 */ #ifndef _PKEYS_X86_H #define _PKEYS_X86_H #ifdef __i386__ #define REG_IP_IDX REG_EIP #define si_pkey_offset 0x14 #else #define REG_IP_IDX REG_RIP #define si_pkey_offset 0x20 #endif #define MCONTEXT_IP(mc) mc.gregs[REG_IP_IDX] #define MCONTEXT_TRAPNO(mc) mc.gregs[R...
Linux kernel'inin 'tools/testing/selftests/mm/map_fixed_noreplace' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* * Test that MAP_FIXED_NOREPLACE works. * * Copyright 2018, Jann Horn <jannh@google.com> * Copyright 2018, Michael Ellerman, IBM Corporation. */ #include <sys/mman.h> #include <errno.h> #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include "kselftest.h" s...
Linux kernel'inin 'tools/testing/selftests/mm/gup_longterm' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0-only /* * GUP long-term page pinning tests. * * Copyright 2023, Red Hat, Inc. * * Author(s): David Hildenbrand <david@redhat.com> */ #define _GNU_SOURCE #include <stdlib.h> #include <string.h> #include <stdbool.h> #include <stdint.h> #include <unistd.h> #include <errno.h> ...
Linux kernel'inin 'tools/testing/selftests/mm/hugetlb_fault_after_madv' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include <pthread.h> #include <stdio.h> #include <stdlib.h> #include <sys/mman.h> #include <sys/types.h> #include <unistd.h> #include <setjmp.h> #include <signal.h> #include "vm_util.h" #include "kselftest.h" #define INLOOP_ITER 100 static char *huge_ptr; static size_t huge_p...
Linux kernel'inin 'tools/testing/selftests/mm/thp_settings' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include <fcntl.h> #include <limits.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include "vm_util.h" #include "thp_settings.h" #define THP_SYSFS "/sys/kernel/mm/transparent_hugepage/" #define MAX_SETTINGS_DEPTH 4 static struct thp_settings...
Linux kernel'inin 'tools/testing/selftests/mm/guard-regions' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0-or-later #define _GNU_SOURCE #include "kselftest_harness.h" #include <asm-generic/mman.h> /* Force the import of the tools version. */ #include <assert.h> #include <errno.h> #include <fcntl.h> #include <linux/limits.h> #include <linux/userfaultfd.h> #include <linux/fs.h> #inclu...
Linux işletim sistemi çekirdeği için 'tools/testing/selftests/mm/vm_util' yapılarının ve prototiplerinin bulunduğu C Header dosyasını yaz.
```c /* SPDX-License-Identifier: GPL-2.0 */ #include <stdint.h> #include <stdbool.h> #include <sys/mman.h> #include <err.h> #include <stdarg.h> #include <strings.h> /* ffsl() */ #include <unistd.h> /* _SC_PAGESIZE */ #include "kselftest.h" #include <linux/fs.h> #define BIT_ULL(nr) (1ULL << (nr)) #def...
Linux kernel'inin 'tools/testing/selftests/mm/va_high_addr_switch' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0-only /* * * Authors: Kirill A. Shutemov <kirill.shutemov@linux.intel.com> * Authors: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> */ #include <stdio.h> #include <sys/mman.h> #include <string.h> #include "vm_util.h" #include "kselftest.h" /* * The hint addr value is...
Linux kernel'inin 'tools/testing/selftests/mm/uffd-unit-tests' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0-only /* * Userfaultfd unit tests. * * Copyright (C) 2015-2023 Red Hat, Inc. */ #include "uffd-common.h" #include "../../../../mm/gup_test.h" #ifdef __NR_userfaultfd /* The unit test doesn't need a large or random size, make it 32MB for now */ #define UFFD_TEST_MEM_SIZ...
Linux kernel'inin 'tools/testing/selftests/mm/mseal_test' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #define _GNU_SOURCE #include <linux/mman.h> #include <sys/mman.h> #include <stdint.h> #include <asm-generic/unistd.h> #include <string.h> #include <sys/time.h> #include <sys/resource.h> #include <stdbool.h> #include "kselftest.h" #include <syscall.h> #include <errno.h> #include ...
Linux işletim sistemi çekirdeği için 'tools/testing/selftests/mm/mseal_helpers' yapılarının ve prototiplerinin bulunduğu C Header dosyasını yaz.
```c /* SPDX-License-Identifier: GPL-2.0 */ #define FAIL_TEST_IF_FALSE(test_passed) \ do { \ if (!(test_passed)) { \ ksft_test_result_fail("%s: line:%d\n", \ __func__, __LINE__); \ return; \ } \ } while (0) #define SKIP_TEST_IF_FALSE(test_passed) \ do { \ if ...
Linux kernel'inin 'tools/testing/selftests/mm/madv_populate' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0-only /* * MADV_POPULATE_READ and MADV_POPULATE_WRITE tests * * Copyright 2021, Red Hat, Inc. * * Author(s): David Hildenbrand <david@redhat.com> */ #define _GNU_SOURCE #include <stdlib.h> #include <string.h> #include <stdbool.h> #include <stdint.h> #include <unistd.h> #inc...
Linux kernel'inin 'tools/testing/selftests/mm/mremap_dontunmap' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* * Tests for mremap w/ MREMAP_DONTUNMAP. * * Copyright 2020, Brian Geffon <bgeffon@google.com> */ #define _GNU_SOURCE #include <sys/mman.h> #include <linux/mman.h> #include <errno.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include ...
Linux kernel'inin 'tools/testing/selftests/mm/pagemap_ioctl' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #define _GNU_SOURCE #include <stdio.h> #include <fcntl.h> #include <string.h> #include <sys/mman.h> #include <errno.h> #include <malloc.h> #include "vm_util.h" #include "kselftest.h" #include <linux/types.h> #include <linux/memfd.h> #include <linux/userfaultfd.h> #include <linu...
Linux kernel'inin 'tools/testing/selftests/mm/uffd-stress' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0-only /* * Stress userfaultfd syscall. * * Copyright (C) 2015 Red Hat, Inc. * * This test allocates two virtual areas and bounces the physical * memory across the two virtual areas (from area_src to area_dst) * using userfaultfd. * * There are three threads running per...
Linux kernel'inin 'tools/testing/selftests/mm/mlock2-tests' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #define _GNU_SOURCE #include <sys/mman.h> #include <stdint.h> #include <unistd.h> #include <string.h> #include <sys/time.h> #include <sys/resource.h> #include <stdbool.h> #include "kselftest.h" #include "mlock2.h" struct vm_boundaries { unsigned long start; unsigned long end;...
Linux kernel'inin 'tools/testing/selftests/mm/prctl_thp_disable' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* * Basic tests for PR_GET/SET_THP_DISABLE prctl calls * * Author(s): Usama Arif <usamaarif642@gmail.com> */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include <sys/mman.h> #include <linux/mman.h> #include <sys/prctl.h> #include <sys/wai...
Linux kernel'inin 'tools/testing/selftests/mm/hugepage-mmap' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* * hugepage-mmap: * * Example of using huge page memory in a user application using the mmap * system call. Before running this application, make sure that the * administrator has mounted the hugetlbfs filesystem (on some directory * like /mnt) using the command mount -...
Linux işletim sistemi çekirdeği için 'tools/testing/selftests/mm/mlock2' yapılarının ve prototiplerinin bulunduğu C Header dosyasını yaz.
```c /* SPDX-License-Identifier: GPL-2.0 */ #include <syscall.h> #include <errno.h> #include <stdio.h> #include <stdlib.h> static int mlock2_(void *start, size_t len, int flags) { int ret = syscall(__NR_mlock2, start, len, flags); if (ret) { errno = ret; return -1; } return 0; } static FILE *seek_to_smaps_en...
Linux kernel'inin 'tools/testing/selftests/mm/uffd-common' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0-only /* * Userfaultfd tests util functions * * Copyright (C) 2015-2023 Red Hat, Inc. */ #include "uffd-common.h" uffd_test_ops_t *uffd_test_ops; uffd_test_case_ops_t *uffd_test_case_ops; /* pthread_mutex_t starts at page offset 0 */ pthread_mutex_t *area_mutex(char *are...
Linux kernel'inin 'tools/testing/selftests/mm/page_frag/page_frag_test' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* * Test module for page_frag cache * * Copyright (C) 2024 Yunsheng Lin <linyunsheng@huawei.com> */ #include <linux/module.h> #include <linux/cpumask.h> #include <linux/completion.h> #include <linux/ptr_ring.h> #include <linux/kthread.h> #include <linux/page_frag_cache.h>...
Linux kernel'inin 'tools/testing/selftests/damon/access_memory_even' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* * Artificial memory access program for testing DAMON. * * Receives number of regions and size of each region from user. Allocate the * regions and repeatedly access even numbered (starting from zero) regions. */ #include <stdio.h> #include <stdlib.h> #include <string.h...
Linux kernel'inin 'tools/testing/selftests/damon/access_memory' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* * Artificial memory access program for testing DAMON. */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <time.h> enum access_mode { ACCESS_MODE_ONCE, ACCESS_MODE_REPEAT, }; int main(int argc, char *argv[]) { char **regions; clock_t start_clock; ...
Linux kernel'inin 'tools/testing/selftests/lsm/lsm_get_self_attr_test' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* * Linux Security Module infrastructure tests * Tests for the lsm_get_self_attr system call * * Copyright © 2022 Casey Schaufler <casey@schaufler-ca.com> */ #define _GNU_SOURCE #include <linux/lsm.h> #include <fcntl.h> #include <string.h> #include <stdio.h> #include <uni...
Linux kernel'inin 'tools/testing/selftests/lsm/lsm_set_self_attr_test' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* * Linux Security Module infrastructure tests * Tests for the lsm_set_self_attr system call * * Copyright © 2022 Casey Schaufler <casey@schaufler-ca.com> */ #define _GNU_SOURCE #include <linux/lsm.h> #include <string.h> #include <stdio.h> #include <unistd.h> #include <sy...
Linux kernel'inin 'tools/testing/selftests/lsm/common' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* * Linux Security Module infrastructure tests * * Copyright © 2023 Casey Schaufler <casey@schaufler-ca.com> */ #define _GNU_SOURCE #include <linux/lsm.h> #include <fcntl.h> #include <string.h> #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <sys/types....
Linux işletim sistemi çekirdeği için 'tools/testing/selftests/lsm/common' yapılarının ve prototiplerinin bulunduğu C Header dosyasını yaz.
```c /* SPDX-License-Identifier: GPL-2.0 */ /* * Linux Security Module infrastructure tests * * Copyright © 2023 Casey Schaufler <casey@schaufler-ca.com> */ #ifndef lsm_get_self_attr static inline int lsm_get_self_attr(unsigned int attr, struct lsm_ctx *ctx, __u32 *size, __u32 flags) { return syscall(__NR...
Linux kernel'inin 'tools/testing/selftests/lsm/lsm_list_modules_test' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* * Linux Security Module infrastructure tests * Tests for the lsm_list_modules system call * * Copyright © 2022 Casey Schaufler <casey@schaufler-ca.com> */ #define _GNU_SOURCE #include <linux/lsm.h> #include <string.h> #include <stdio.h> #include <unistd.h> #include <sys...
Linux kernel'inin 'tools/testing/selftests/timers/clocksource-switch' alt sistemi için gerekli C kaynak kodunu implemente et.
```c /* Clocksource change test * by: john stultz (johnstul@us.ibm.com) * (C) Copyright IBM 2012 * Licensed under the GPLv2 * * NOTE: This is a meta-test which quickly changes the clocksource and * then uses other tests to detect problems. Thus this test requires * that the inconsistency-check and nanoslee...
Linux kernel'inin 'tools/testing/selftests/timers/set-timer-lat' alt sistemi için gerekli C kaynak kodunu implemente et.
```c /* set_timer latency test * John Stultz (john.stultz@linaro.org) * (C) Copyright Linaro 2014 * Licensed under the GPLv2 * * This test makes sure the set_timer api is correct * * To build: * $ gcc set-timer-lat.c -o set-timer-lat -lrt * * This program is free software: you ...
Linux kernel'inin 'tools/testing/selftests/timers/set-tai' alt sistemi için gerekli C kaynak kodunu implemente et.
```c /* Set tai offset * by: John Stultz <john.stultz@linaro.org> * (C) Copyright Linaro 2013 * Licensed under the GPLv2 * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * t...
Linux kernel'inin 'tools/testing/selftests/timers/change_skew' alt sistemi için gerekli C kaynak kodunu implemente et.
```c /* ADJ_FREQ Skew change test * by: john stultz (johnstul@us.ibm.com) * (C) Copyright IBM 2012 * Licensed under the GPLv2 * * NOTE: This is a meta-test which cranks the ADJ_FREQ knob and * then uses other tests to detect problems. Thus this test requires * that the raw_skew, inconsistency-check and nan...
Linux kernel'inin 'tools/testing/selftests/timers/mqueue-lat' alt sistemi için gerekli C kaynak kodunu implemente et.
```c /* Measure mqueue timeout latency * by: john stultz (john.stultz@linaro.org) * (C) Copyright Linaro 2013 * * Inspired with permission from example test by: * Romain Francoise <romain@orebokech.com> * Licensed under the GPLv2 * * To build: * $ gcc mqueue-lat.c -o mqueue-lat -...
Linux kernel'inin 'tools/testing/selftests/timers/set-tz' alt sistemi için gerekli C kaynak kodunu implemente et.
```c /* Set tz value * by: John Stultz <john.stultz@linaro.org> * (C) Copyright Linaro 2016 * Licensed under the GPLv2 * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the...
Linux kernel'inin 'tools/testing/selftests/timers/valid-adjtimex' alt sistemi için gerekli C kaynak kodunu implemente et.
```c /* valid adjtimex test * by: John Stultz <john.stultz@linaro.org> * (C) Copyright Linaro 2015 * Licensed under the GPLv2 * * This test validates adjtimex interface with valid * and invalid test data. * * Usage: valid-adjtimex * * To build: * $ gcc valid-adjtime...
Linux kernel'inin 'tools/testing/selftests/timers/nsleep-lat' alt sistemi için gerekli C kaynak kodunu implemente et.
```c /* Measure nanosleep timer latency * by: john stultz (john.stultz@linaro.org) * (C) Copyright Linaro 2013 * Licensed under the GPLv2 * * To build: * $ gcc nsleep-lat.c -o nsleep-lat -lrt * * This program is free software: you can redistribute it and/or modify * it under the...
Linux kernel'inin 'tools/testing/selftests/timers/leap-a-day' alt sistemi için gerekli C kaynak kodunu implemente et.
```c /* Leap second stress test * by: John Stultz (john.stultz@linaro.org) * (C) Copyright IBM 2012 * (C) Copyright 2013, 2015 Linaro Limited * Licensed under the GPLv2 * * This test signals the kernel to insert a leap second * every day at midnight GMT. This...
Linux kernel'inin 'tools/testing/selftests/timers/skew_consistency' alt sistemi için gerekli C kaynak kodunu implemente et.
```c /* ADJ_FREQ Skew consistency test * by: john stultz (johnstul@us.ibm.com) * (C) Copyright IBM 2012 * Licensed under the GPLv2 * * NOTE: This is a meta-test which cranks the ADJ_FREQ knob back * and forth and watches for consistency problems. Thus this test requires * that the inconsistency-check tests...
Linux kernel'inin 'tools/testing/selftests/timers/nanosleep' alt sistemi için gerekli C kaynak kodunu implemente et.
```c /* Make sure timers don't return early * by: john stultz (johnstul@us.ibm.com) * John Stultz (john.stultz@linaro.org) * (C) Copyright IBM 2012 * (C) Copyright Linaro 2013 2015 * Licensed under the GPLv2 * * To build: * $ gcc nanosleep.c -o nanosleep...
Linux kernel'inin 'tools/testing/selftests/timers/set-2038' alt sistemi için gerekli C kaynak kodunu implemente et.
```c /* Time bounds setting test * by: john stultz (johnstul@us.ibm.com) * (C) Copyright IBM 2012 * Licensed under the GPLv2 * * NOTE: This is a meta-test which sets the time to edge cases then * uses other tests to detect problems. Thus this test requires that * the inconsistency-check and nanosleep tests...
Linux kernel'inin 'tools/testing/selftests/timers/leapcrash' alt sistemi için gerekli C kaynak kodunu implemente et.
```c /* Demo leapsecond deadlock * by: John Stultz (john.stultz@linaro.org) * (C) Copyright IBM 2012 * (C) Copyright 2013, 2015 Linaro Limited * Licensed under the GPL * * This test demonstrates leapsecond deadlock that is possible * on kernels from 2.6.26 to 3...
Linux kernel'inin 'tools/testing/selftests/timers/posix_timers' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0-only /* * Copyright (C) 2013 Red Hat, Inc., Frederic Weisbecker <fweisbec@redhat.com> * * Selftests for a few posix timers interface. * * Kernel loop code stolen from Steven Rostedt <srostedt@redhat.com> */ #define _GNU_SOURCE #include <sys/prctl.h> #include <sys/time.h> #...
Linux kernel'inin 'tools/testing/selftests/timers/freq-step' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0-only /* * This test checks the response of the system clock to frequency * steps made with adjtimex(). The frequency error and stability of * the CLOCK_MONOTONIC clock relative to the CLOCK_MONOTONIC_RAW clock * is measured in two intervals following the step. The test fails...
Linux kernel'inin 'tools/testing/selftests/timers/rtcpie' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* * Real Time Clock Periodic Interrupt test program * * Since commit 6610e0893b8bc ("RTC: Rework RTC code to use timerqueue for * events"), PIE are completely handled using hrtimers, without actually using * any underlying hardware RTC. * */ #include <stdio.h> #include ...
Linux kernel'inin 'tools/testing/selftests/timers/raw_skew' alt sistemi için gerekli C kaynak kodunu implemente et.
```c /* CLOCK_MONOTONIC vs CLOCK_MONOTONIC_RAW skew test * by: john stultz (johnstul@us.ibm.com) * John Stultz <john.stultz@linaro.org> * (C) Copyright IBM 2012 * (C) Copyright Linaro Limited 2015 * Licensed under the GPLv2 * * To build: * $ gcc raw_skew.c -o raw_skew -lrt * * This program is free...
Linux kernel'inin 'tools/testing/selftests/timers/alarmtimer-suspend' alt sistemi için gerekli C kaynak kodunu implemente et.
```c /* alarmtimer suspend test * John Stultz (john.stultz@linaro.org) * (C) Copyright Linaro 2013 * Licensed under the GPLv2 * * This test makes sure the alarmtimer & RTC wakeup code is * functioning. * * To build: * $ gcc alarmtimer-suspend.c -o alarmtimer-suspend -lrt * * ...
Linux kernel'inin 'tools/testing/selftests/timers/adjtick' alt sistemi için gerekli C kaynak kodunu implemente et.
```c /* adjtimex() tick adjustment test * by: John Stultz <john.stultz@linaro.org> * (C) Copyright Linaro Limited 2015 * Licensed under the GPLv2 * * To build: * $ gcc adjtick.c -o adjtick -lrt * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Ge...
Linux kernel'inin 'tools/testing/selftests/timers/inconsistency-check' alt sistemi için gerekli C kaynak kodunu implemente et.
```c /* Time inconsistency check test * by: john stultz (johnstul@us.ibm.com) * (C) Copyright IBM 2003, 2004, 2005, 2012 * (C) Copyright Linaro Limited 2015 * Licensed under the GPLv2 * * To build: * $ gcc inconsistency-check.c -o inconsistency-check -lrt * * This program is free software: you can redis...
Linux kernel'inin 'tools/testing/selftests/timers/threadtest' alt sistemi için gerekli C kaynak kodunu implemente et.
```c /* threadtest.c * by: john stultz (johnstul@us.ibm.com) * (C) Copyright IBM 2004, 2005, 2006, 2012 * Licensed under the GPLv2 * * To build: * $ gcc threadtest.c -o threadtest -lrt * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Publi...
Linux kernel'inin 'tools/testing/selftests/splice/splice_read' 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 <limits.h> #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <sys/types.h> #include <sys/stat.h> int main(int argc, char *argv[]) { int fd; size_t size; ssize_t spliced; if (argc < 2) { ...
Linux kernel'inin 'tools/testing/selftests/splice/default_file_splice_read' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #define _GNU_SOURCE #include <fcntl.h> int main(int argc, char **argv) { splice(0, 0, 1, 0, 1<<30, 0); return 0; } ```
Linux kernel'inin 'tools/testing/selftests/uevent/uevent_filtering' 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 <linux/netlink.h> #include <signal.h> #include <stdbool.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <sys/prctl.h> #include <sys/socket.h> #include <sched.h> #include <sys/eventfd.h> #i...
Linux işletim sistemi çekirdeği için 'tools/testing/selftests/ublk/kublk' yapılarının ve prototiplerinin bulunduğu C Header dosyasını yaz.
```c /* SPDX-License-Identifier: GPL-2.0 */ #ifndef KUBLK_INTERNAL_H #define KUBLK_INTERNAL_H #include <unistd.h> #include <stdlib.h> #include <assert.h> #include <stdio.h> #include <stdarg.h> #include <string.h> #include <pthread.h> #include <getopt.h> #include <limits.h> #include <poll.h> #include <fcntl.h> #include...
Linux işletim sistemi çekirdeği için 'tools/testing/selftests/ublk/ublk_dep' yapılarının ve prototiplerinin bulunduğu C Header dosyasını yaz.
```c #ifndef UBLK_DEP_H #define UBLK_DEP_H #ifndef UBLK_U_IO_REGISTER_IO_BUF #define UBLK_U_IO_REGISTER_IO_BUF \ _IOWR('u', 0x23, struct ublksrv_io_cmd) #define UBLK_U_IO_UNREGISTER_IO_BUF \ _IOWR('u', 0x24, struct ublksrv_io_cmd) #endif #ifndef UBLK_F_USER_RECOVERY_FAIL_IO #define UBLK_F_USER_RECOVERY_FAIL_IO (1UL...
Linux kernel'inin 'tools/testing/selftests/ublk/kublk' alt sistemi için gerekli C kaynak kodunu implemente et.
```c /* SPDX-License-Identifier: MIT */ /* * Description: uring_cmd based ublk */ #include <linux/fs.h> #include <sys/un.h> #include "kublk.h" #define MAX_NR_TGT_ARG 64 unsigned int ublk_dbg_mask = UBLK_LOG; static const struct ublk_tgt_ops *tgt_ops_list[] = { &null_tgt_ops, &loop_tgt_ops, &stripe_tgt_ops, &f...
Linux kernel'inin 'tools/testing/selftests/ublk/stripe' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include "kublk.h" #define NR_STRIPE MAX_BACK_FILES struct stripe_conf { unsigned nr_files; unsigned shift; }; struct stripe { loff_t start; unsigned nr_sects; int seq; struct iovec *vec; unsigned nr_vec; unsigned cap; }; struct stripe_array { struct stri...
Linux kernel'inin 'tools/testing/selftests/ublk/null' alt sistemi için gerekli C kaynak kodunu implemente et.
```c /* SPDX-License-Identifier: GPL-2.0 */ #include "kublk.h" #ifndef IORING_NOP_INJECT_RESULT #define IORING_NOP_INJECT_RESULT (1U << 0) #endif #ifndef IORING_NOP_FIXED_BUFFER #define IORING_NOP_FIXED_BUFFER (1U << 3) #endif static int ublk_null_tgt_init(const struct dev_ctx *ctx, struct ublk_dev *...
Linux kernel'inin 'tools/testing/selftests/ublk/metadata_size' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include <fcntl.h> #include <linux/fs.h> #include <stdio.h> #include <sys/ioctl.h> int main(int argc, char **argv) { struct logical_block_metadata_cap cap = {}; const char *filename; int fd; int result; if (argc != 2) { fprintf(stderr, "Usage: %s BLOCK_DEVICE\n", argv[0...
Linux işletim sistemi çekirdeği için 'tools/testing/selftests/ublk/utils' yapılarının ve prototiplerinin bulunduğu C Header dosyasını yaz.
```c /* SPDX-License-Identifier: GPL-2.0 */ #ifndef KUBLK_UTILS_H #define KUBLK_UTILS_H #ifndef min #define min(a, b) ((a) < (b) ? (a) : (b)) #endif #define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0])) #ifndef offsetof #define offsetof(TYPE, MEMBER) ((size_t)&((TYPE *)0)->MEMBER) #endif #ifndef container_of #define co...
Linux kernel'inin 'tools/testing/selftests/ublk/fault_inject' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* * Fault injection ublk target. Hack this up however you like for * testing specific behaviors of ublk_drv. Currently is a null target * with a configurable delay before completing each I/O. This delay can * be used to test ublk_drv's handling of I/O outstanding to the ub...
Linux kernel'inin 'tools/testing/selftests/ublk/batch' alt sistemi için gerekli C kaynak kodunu implemente et.
```c /* SPDX-License-Identifier: MIT */ /* * Description: UBLK_F_BATCH_IO buffer management */ #include "kublk.h" static inline void *ublk_get_commit_buf(struct ublk_thread *t, unsigned short buf_idx) { unsigned idx; if (buf_idx < t->commit_buf_start || buf_idx >= t->commit_buf_start + t->nr_commit_buf) ...
Linux kernel'inin 'tools/testing/selftests/ublk/common' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include "kublk.h" void backing_file_tgt_deinit(struct ublk_dev *dev) { int i; for (i = 1; i < dev->nr_fds; i++) { fsync(dev->fds[i]); close(dev->fds[i]); } } int backing_file_tgt_init(struct ublk_dev *dev, unsigned int nr_direct) { int fd, i; ublk_assert(dev->nr_f...
Linux kernel'inin 'tools/testing/selftests/ublk/file_backed' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include "kublk.h" static enum io_uring_op ublk_to_uring_op(const struct ublksrv_io_desc *iod, int zc) { unsigned ublk_op = ublksrv_get_op(iod); if (ublk_op == UBLK_IO_OP_READ) return zc ? IORING_OP_READ_FIXED : IORING_OP_READ; else if (ublk_op == UBLK_IO_OP_WRITE) ret...
Linux kernel'inin 'tools/testing/selftests/syscall_user_dispatch/sud_test' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0-only /* * Copyright (c) 2020 Collabora Ltd. * * Test code for syscall user dispatch */ #define _GNU_SOURCE #include <sys/prctl.h> #include <sys/sysinfo.h> #include <sys/syscall.h> #include <signal.h> #include <stdbool.h> #include <stdlib.h> #include <asm/unistd.h> #include...
Linux kernel'inin 'tools/testing/selftests/syscall_user_dispatch/sud_benchmark' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0-only /* * Copyright (c) 2020 Collabora Ltd. * * Benchmark and test syscall user dispatch */ #define _GNU_SOURCE #include <stdio.h> #include <string.h> #include <stdlib.h> #include <signal.h> #include <errno.h> #include <time.h> #include <sys/time.h> #include <unistd.h> #inc...
Linux kernel'inin 'tools/testing/selftests/mqueue/mq_perf_tests' alt sistemi için gerekli C kaynak kodunu implemente et.
```c /* * This application is Copyright 2012 Red Hat, Inc. * Doug Ledford <dledford@redhat.com> * * mq_perf_tests is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, version 3. * * mq_perf_tests is distrib...
Linux kernel'inin 'tools/testing/selftests/mqueue/mq_open_tests' alt sistemi için gerekli C kaynak kodunu implemente et.
```c /* * This application is Copyright 2012 Red Hat, Inc. * Doug Ledford <dledford@redhat.com> * * mq_open_tests is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, version 3. * * mq_open_tests is distrib...
Linux kernel'inin 'tools/testing/selftests/exec/null-argv' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0-only /* Test that empty argvs are swapped out for a single empty string. */ #include <stdio.h> #include <unistd.h> #include <sys/types.h> #include <sys/wait.h> #include "kselftest.h" #define FORK(exec) \ do { \ pid = fork(); \ if (pid == 0) { \ /* Child */ ...
Linux kernel'inin 'tools/testing/selftests/exec/execveat' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0-only /* * Copyright (c) 2014 Google, Inc. * * Selftests for execveat(2). */ #ifndef _GNU_SOURCE #define _GNU_SOURCE /* to get O_PATH, AT_EMPTY_PATH */ #endif #include <sys/sendfile.h> #include <sys/stat.h> #include <sys/syscall.h> #include <sys/types.h> #include <sys/wait....
Linux kernel'inin 'tools/testing/selftests/exec/check-exec' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* * Test execveat(2) with AT_EXECVE_CHECK, and prctl(2) with * SECBIT_EXEC_RESTRICT_FILE, SECBIT_EXEC_DENY_INTERACTIVE, and their locked * counterparts. * * Copyright © 2018-2020 ANSSI * Copyright © 2024 Microsoft Corporation * * Author: Mickaël Salaün <mic@digikod.net>...
Linux kernel'inin 'tools/testing/selftests/exec/non-regular' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0+ #include <errno.h> #include <fcntl.h> #include <stdio.h> #include <string.h> #include <unistd.h> #include <sys/socket.h> #include <sys/stat.h> #include <sys/sysmacros.h> #include <sys/types.h> #include "kselftest_harness.h" /* Remove a file, ignoring the result if it didn't e...
Linux kernel'inin 'tools/testing/selftests/exec/recursion-depth' alt sistemi için gerekli C kaynak kodunu implemente et.
```c /* * Copyright (c) 2019 Alexey Dobriyan <adobriyan@gmail.com> * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "A...
Linux kernel'inin 'tools/testing/selftests/exec/false' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 int main(void) { return 1; } ```
Linux kernel'inin 'tools/testing/selftests/exec/load_address' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0-only #ifndef _GNU_SOURCE #define _GNU_SOURCE #endif #include <link.h> #include <stdio.h> #include <stdlib.h> #include <stdbool.h> #include "kselftest.h" struct Statistics { unsigned long long load_address; unsigned long long alignment; bool interp; }; int ExtractStatistics(...
Linux kernel'inin 'tools/testing/selftests/core/unshare_test' 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 <linux/kernel.h> #include <limits.h> #include <stdbool.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <syscall.h> #include <unistd.h> #include <sys/resource.h> #include <linux/close_range...
Linux kernel'inin 'tools/testing/selftests/core/close_range_test' 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 <linux/kernel.h> #include <limits.h> #include <stdbool.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <syscall.h> #include <unistd.h> #include <sys/resource.h> #include <linux/close_range...
Linux kernel'inin 'tools/testing/selftests/pid_namespace/pid_max' alt sistemi için gerekli C kaynak kodunu implemente et.
```c /* SPDX-License-Identifier: GPL-2.0 */ #define _GNU_SOURCE #include <assert.h> #include <errno.h> #include <fcntl.h> #include <linux/types.h> #include <sched.h> #include <signal.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <syscall.h> #include <sys/mount.h> #include <sys/wait.h> #include...
Linux kernel'inin 'tools/testing/selftests/pid_namespace/pidns_init_via_setns' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #define _GNU_SOURCE #include <fcntl.h> #include <sched.h> #include <stdio.h> #include <sys/types.h> #include <unistd.h> #include "kselftest_harness.h" #include "../pidfd/pidfd.h" /* * Test that a process can become PID 1 (init) in a new PID namespace * created via unshare() ...
Linux kernel'inin 'tools/testing/selftests/pid_namespace/regression_enomem' alt sistemi için gerekli C kaynak kodunu implemente et.
```c #define _GNU_SOURCE #include <assert.h> #include <errno.h> #include <fcntl.h> #include <linux/types.h> #include <sched.h> #include <signal.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <syscall.h> #include <sys/wait.h> #include "kselftest_harness.h" #include "../pidfd/pidfd.h" /* * Regr...
Linux kernel'inin 'tools/testing/selftests/mseal_system_mappings/sysmap_is_sealed' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0-only /* * test system mappings are sealed when * KCONFIG_MSEAL_SYSTEM_MAPPINGS=y */ #define _GNU_SOURCE #include <stdio.h> #include <errno.h> #include <unistd.h> #include <string.h> #include <stdbool.h> #include "kselftest.h" #include "kselftest_harness.h" #define VMFLAGS ...
Linux kernel'inin 'tools/testing/selftests/ring-buffer/map_test' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* * Ring-buffer memory mapping tests * * Copyright (c) 2024 Vincent Donnefort <vdonnefort@google.com> */ #include <fcntl.h> #include <sched.h> #include <stdbool.h> #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <linux/trace_mmap.h> #include <sys/mman....
Linux kernel'inin 'tools/testing/selftests/intel_pstate/msr' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include <math.h> #include <unistd.h> #include <stdio.h> #include <stdlib.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <sys/timeb.h> #include <sched.h> #include <errno.h> int main(int argc, char **argv) { int cpu, fd; long long msr; char msr_f...
Linux kernel'inin 'tools/testing/selftests/intel_pstate/aperf' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include <math.h> #include <unistd.h> #include <stdio.h> #include <stdlib.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <sys/timeb.h> #include <sched.h> #include <errno.h> #include <string.h> #include <time.h> #include "kselftest.h" #define MSEC_PE...
Linux kernel'inin 'tools/testing/selftests/connector/proc_filter' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0-only #include <sys/types.h> #include <sys/epoll.h> #include <sys/socket.h> #include <linux/netlink.h> #include <linux/connector.h> #include <linux/cn_proc.h> #include <stddef.h> #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <strings.h> #include <errno.h> ...
Linux kernel'inin 'tools/testing/selftests/efivarfs/create-read' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include <stdio.h> #include <stdint.h> #include <stdlib.h> #include <unistd.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <errno.h> #include <string.h> int main(int argc, char **argv) { const char *path; char buf[4]; int fd, rc; if (argc < 2) ...
Linux kernel'inin 'tools/testing/selftests/efivarfs/open-unlink' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include <errno.h> #include <stdio.h> #include <stdint.h> #include <stdlib.h> #include <unistd.h> #include <sys/ioctl.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <linux/fs.h> static int set_immutable(const char *path, int immutable) { unsigned i...
Linux kernel'inin 'tools/testing/selftests/tmpfs/bug-link-o-tmpfile' alt sistemi için gerekli C kaynak kodunu implemente et.
```c /* * Copyright (c) 2019 Alexey Dobriyan <adobriyan@gmail.com> * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "A...
Linux kernel'inin 'tools/testing/selftests/filesystems/anon_inode_test' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #define _GNU_SOURCE #define __SANE_USERSPACE_TYPES__ #include <fcntl.h> #include <stdio.h> #include <sys/stat.h> #include "kselftest_harness.h" #include "wrappers.h" TEST(anon_inode_no_chown) { int fd_context; fd_context = sys_fsopen("tmpfs", 0); ASSERT_GE(fd_context, 0);...