2
* Copyright (C) 2007 The Android Open Source Project
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
* you may not use this file except in compliance with the License.
6
* You may obtain a copy of the License at
8
* http://www.apache.org/licenses/LICENSE-2.0
10
* Unless required by applicable law or agreed to in writing, software
11
* distributed under the License is distributed on an "AS IS" BASIS,
12
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
* See the License for the specific language governing permissions and
14
* limitations under the License.
17
#define LOG_TAG "NativeHandle"
25
#include <cutils/log.h>
26
#include <cutils/native_handle.h>
28
native_handle_t* native_handle_create(int numFds, int numInts)
30
native_handle_t* h = malloc(
31
sizeof(native_handle_t) + sizeof(int)*(numFds+numInts));
33
h->version = sizeof(native_handle_t);
39
int native_handle_delete(native_handle_t* h)
42
if (h->version != sizeof(native_handle_t))
49
int native_handle_close(const native_handle_t* h)
51
if (h->version != sizeof(native_handle_t))
54
const int numFds = h->numFds;
56
for (i=0 ; i<numFds ; i++) {