media/omx-plugin/include/gb/cutils/native_handle.h

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     1 /*
     2  * Copyright (C) 2009 The Android Open Source Project
     3  *
     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
     7  *
     8  *      http://www.apache.org/licenses/LICENSE-2.0
     9  *
    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.
    15  */
    17 #ifndef NATIVE_HANDLE_H_
    18 #define NATIVE_HANDLE_H_
    20 #ifdef __cplusplus
    21 extern "C" {
    22 #endif
    24 typedef struct
    25 {
    26     int version;        /* sizeof(native_handle_t) */
    27     int numFds;         /* number of file-descriptors at &data[0] */
    28     int numInts;        /* number of ints at &data[numFds] */
    29     int data[0];        /* numFds + numInts ints */
    30 } native_handle_t;
    33 /* keep the old definition for backward source-compatibility */
    34 typedef native_handle_t native_handle;
    36 /*
    37  * native_handle_close
    38  * 
    39  * closes the file descriptors contained in this native_handle_t
    40  * 
    41  * return 0 on success, or a negative error code on failure
    42  * 
    43  */
    44 int native_handle_close(const native_handle_t* h);
    47 /*
    48  * native_handle_create
    49  * 
    50  * creates a native_handle_t and initializes it. must be destroyed with
    51  * native_handle_delete().
    52  * 
    53  */
    54 native_handle_t* native_handle_create(int numFds, int numInts);
    56 /*
    57  * native_handle_delete
    58  * 
    59  * frees a native_handle_t allocated with native_handle_create().
    60  * This ONLY frees the memory allocated for the native_handle_t, but doesn't
    61  * close the file descriptors; which can be achieved with native_handle_close().
    62  * 
    63  * return 0 on success, or a negative error code on failure
    64  * 
    65  */
    66 int native_handle_delete(native_handle_t* h);
    69 #ifdef __cplusplus
    70 }
    71 #endif
    73 #endif /* NATIVE_HANDLE_H_ */

mercurial