brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.0 KiB · 328ba04 Raw
36 lines · cpp
1//===---------- Linux implementation of the Linux pkey_free function ------===//2//3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.4// See https://llvm.org/LICENSE.txt for license information.5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception6//7//===----------------------------------------------------------------------===//8 9#include "src/sys/mman/pkey_free.h"10 11#include "hdr/errno_macros.h"             // For ENOSYS12#include "src/__support/OSUtil/syscall.h" // For internal syscall function.13#include "src/__support/common.h"14#include "src/__support/libc_errno.h"15#include "src/__support/macros/config.h"16 17#include <sys/syscall.h> // For syscall numbers.18 19namespace LIBC_NAMESPACE_DECL {20 21LLVM_LIBC_FUNCTION(int, pkey_free, (int pkey)) {22#if !defined(SYS_pkey_free)23  libc_errno = ENOSYS;24  return -1;25#else26  int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_pkey_free, pkey);27  if (ret < 0) {28    libc_errno = -ret;29    return -1;30  }31  return 0;32#endif33}34 35} // namespace LIBC_NAMESPACE_DECL36