17ec681f3Smrg/************************************************************************** 27ec681f3Smrg * 37ec681f3Smrg * Copyright 2021 Snap Inc. 47ec681f3Smrg * SPDX-License-Identifier: MIT 57ec681f3Smrg * 67ec681f3Smrg * Permission is hereby granted, free of charge, to any person obtaining a 77ec681f3Smrg * copy of this software and associated documentation files (the 87ec681f3Smrg * "Software"), to deal in the Software without restriction, including 97ec681f3Smrg * without limitation the rights to use, copy, modify, merge, publish, 107ec681f3Smrg * distribute, sublicense, and/or sell copies of the Software, and to 117ec681f3Smrg * permit persons to whom the Software is furnished to do so, subject to 127ec681f3Smrg * the following conditions: 137ec681f3Smrg * 147ec681f3Smrg * The above copyright notice and this permission notice shall be included 157ec681f3Smrg * in all copies or substantial portions of the Software. 167ec681f3Smrg * 177ec681f3Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 187ec681f3Smrg * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 197ec681f3Smrg * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 207ec681f3Smrg * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 217ec681f3Smrg * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 227ec681f3Smrg * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 237ec681f3Smrg * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 247ec681f3Smrg * 257ec681f3Smrg **************************************************************************/ 267ec681f3Smrg 277ec681f3Smrg 287ec681f3Smrg/* 297ec681f3Smrg * Memory fd wrappers. 307ec681f3Smrg */ 317ec681f3Smrg 327ec681f3Smrg 337ec681f3Smrg#ifndef _OS_MEMORY_H_ 347ec681f3Smrg#error "Must not be included directly. Include os_memory.h instead" 357ec681f3Smrg#endif 367ec681f3Smrg 377ec681f3Smrg/** 387ec681f3Smrg * Imports memory from a file descriptor 397ec681f3Smrg */ 407ec681f3Smrgbool 417ec681f3Smrgos_import_memory_fd(int fd, void **ptr, uint64_t *size, char const *driver_id); 427ec681f3Smrg 437ec681f3Smrg/** 447ec681f3Smrg * Return memory on given byte alignment 457ec681f3Smrg */ 467ec681f3Smrgvoid * 477ec681f3Smrgos_malloc_aligned_fd(size_t size, size_t alignment, int *fd, char const *fd_name, char const *driver_id); 487ec681f3Smrg 497ec681f3Smrg/** 507ec681f3Smrg * Free memory returned by os_malloc_aligned_fd(). 517ec681f3Smrg */ 527ec681f3Smrgvoid 537ec681f3Smrgos_free_fd(void *ptr); 54