Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 78541b71 authored by Isaac J. Manjarres's avatar Isaac J. Manjarres Committed by Isaac Manjarres
Browse files

ashmem: Expose has_memfd_support() for ashmem-tests to use



has_memfd_support() can be used to determine if memfds support ashmem
ioctl commands. This will be useful for the ashmem test suite, as it
can use that information to determine if it should test the
implementation of the memfd-ashmem ioctls.

Therefore, expose has_memfd_support() but only for ashmem-tests to use.
Ashmem clients do not need/must not use this function.

Bug: 111903542
Change-Id: If1378f73ddbba9a94c45375357ebf56fb0170b51
Signed-off-by: default avatarIsaac J. Manjarres <isaacmanjarres@google.com>
parent facb64dc
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -44,6 +44,8 @@
#include <android-base/strings.h>
#include <android-base/unique_fd.h>

#include "ashmem-internal.h"

/* ashmem identity */
static dev_t __ashmem_rdev;
/*
@@ -156,7 +158,7 @@ static bool __has_memfd_support() {
    return true;
}

static bool has_memfd_support() {
bool has_memfd_support() {
    static bool memfd_supported = __has_memfd_support();
    return memfd_supported;
}
+19 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2025 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#pragma once

bool has_memfd_support();