cdefs.h: fix "__clang_major" typo
[glibc.git] / support / next_to_fault.h
blob16da5c8732d08bfa8c93afeec7924ca26a1f1feb
1 /* Memory allocation next to an unmapped page.
2 Copyright (C) 2017-2023 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <https://www.gnu.org/licenses/>. */
19 #ifndef SUPPORT_NEXT_TO_FAULT_H
20 #define SUPPORT_NEXT_TO_FAULT_H
22 #include <sys/cdefs.h>
23 #include <sys/types.h>
25 __BEGIN_DECLS
27 /* The memory region created by next_to_fault_allocate. */
28 struct support_next_to_fault
30 /* The user data. */
31 char *buffer;
32 size_t length;
34 /* The entire allocated region. */
35 void *region_start;
36 size_t region_size;
39 /* Allocate a buffer of SIZE bytes just before a page which is mapped
40 with PROT_NONE (so that overrunning the buffer will cause a
41 fault). */
42 struct support_next_to_fault support_next_to_fault_allocate (size_t size);
44 /* Deallocate the memory region allocated by
45 next_to_fault_allocate. */
46 void support_next_to_fault_free (struct support_next_to_fault *);
48 #endif /* SUPPORT_NEXT_TO_FAULT_H */