Skip to content

Commit 7fa7f0e

Browse files
committed
system/VmaName: use std::span
1 parent 227ccd8 commit 7fa7f0e

2 files changed

Lines changed: 8 additions & 5 deletions

File tree

src/memory/HugeAllocator.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ HugeFree(std::span<std::byte> p) noexcept
3434
void
3535
HugeSetName(std::span<std::byte> p, const char *name) noexcept
3636
{
37-
SetVmaName(p.data(), p.size(), name);
37+
SetVmaName(p, name);
3838
}
3939

4040
void

src/system/VmaName.hxx

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44

55
#pragma once
66

7+
#include <cstddef> // for std::byte
8+
#include <span>
9+
710
#ifdef __linux__
811
# include <sys/prctl.h>
912

@@ -22,14 +25,14 @@
2225
* This feature requires Linux 5.17.
2326
*/
2427
inline void
25-
SetVmaName(const void *start, size_t len, const char *name)
28+
SetVmaName(std::span<const std::byte> vma, const char *name)
2629
{
2730
#ifdef __linux__
28-
prctl(PR_SET_VMA, PR_SET_VMA_ANON_NAME, (unsigned long)start, len,
31+
prctl(PR_SET_VMA, PR_SET_VMA_ANON_NAME,
32+
(unsigned long)vma.data(), vma.size(),
2933
(unsigned long)name);
3034
#else
31-
(void)start;
32-
(void)len;
35+
(void)vma;
3336
(void)name;
3437
#endif
3538
}

0 commit comments

Comments
 (0)