tools: Use posix_memalign instead of valloc for NetBSD

More similar to other implementation.
posix_memalign was adde in NetBSD 8.0, released on July 17, 2018
and went out of support on May 4, 2024.

Signed-off-by: Frediano Ziglio <frediano.ziglio@cloud.com>
Acked-by: Anthony PERARD <anthony.perard@vates.tech>
This commit is contained in:
Frediano Ziglio authored and Jan Beulich committed 2026-07-06 09:40:17 +02:00
1 parent f0161d2d89
commit ac840e066f
2 files changed
+13 -1

No files matched your search

+5
View File
@@ -1390,6 +1390,11 @@ int xc_lockprof_query(xc_interface *xch,
uint64_t *time,
xc_hypercall_buffer_t *data);
/**
* Allocate memory with a given alignment.
* The alignment must be a power of 2 and at least sizeof(void*).
* It returns NULL on error, errno is not set.
*/
void *xc_memalign(xc_interface *xch, size_t alignment, size_t size);
/**
+8 -1
View File
@@ -60,7 +60,14 @@ void discard_file_cache(xc_interface *xch, int fd, int flush)
void *xc_memalign(xc_interface *xch, size_t alignment, size_t size)
{
return valloc(size);
int ret;
void *ptr;
ret = posix_memalign(&ptr, alignment, size);
if (ret != 0 || !ptr)
return NULL;
return ptr;
}
int xc_pcidev_get_gsi(xc_interface *xch, uint32_t sbdf)
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.