16a9b888d7c4b246f6f66360789c72b754ff85021David 'Digit' Turner/* 29d40326830c2bd407427889c554adeb915ee6b4aNick Kralevich * Copyright (C) 2012 The Android Open Source Project 36a9b888d7c4b246f6f66360789c72b754ff85021David 'Digit' Turner * All rights reserved. 46a9b888d7c4b246f6f66360789c72b754ff85021David 'Digit' Turner * 56a9b888d7c4b246f6f66360789c72b754ff85021David 'Digit' Turner * Redistribution and use in source and binary forms, with or without 66a9b888d7c4b246f6f66360789c72b754ff85021David 'Digit' Turner * modification, are permitted provided that the following conditions 76a9b888d7c4b246f6f66360789c72b754ff85021David 'Digit' Turner * are met: 86a9b888d7c4b246f6f66360789c72b754ff85021David 'Digit' Turner * * Redistributions of source code must retain the above copyright 96a9b888d7c4b246f6f66360789c72b754ff85021David 'Digit' Turner * notice, this list of conditions and the following disclaimer. 106a9b888d7c4b246f6f66360789c72b754ff85021David 'Digit' Turner * * Redistributions in binary form must reproduce the above copyright 116a9b888d7c4b246f6f66360789c72b754ff85021David 'Digit' Turner * notice, this list of conditions and the following disclaimer in 126a9b888d7c4b246f6f66360789c72b754ff85021David 'Digit' Turner * the documentation and/or other materials provided with the 136a9b888d7c4b246f6f66360789c72b754ff85021David 'Digit' Turner * distribution. 146a9b888d7c4b246f6f66360789c72b754ff85021David 'Digit' Turner * 156a9b888d7c4b246f6f66360789c72b754ff85021David 'Digit' Turner * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 166a9b888d7c4b246f6f66360789c72b754ff85021David 'Digit' Turner * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 176a9b888d7c4b246f6f66360789c72b754ff85021David 'Digit' Turner * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 186a9b888d7c4b246f6f66360789c72b754ff85021David 'Digit' Turner * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 196a9b888d7c4b246f6f66360789c72b754ff85021David 'Digit' Turner * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 206a9b888d7c4b246f6f66360789c72b754ff85021David 'Digit' Turner * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 216a9b888d7c4b246f6f66360789c72b754ff85021David 'Digit' Turner * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS 226a9b888d7c4b246f6f66360789c72b754ff85021David 'Digit' Turner * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 236a9b888d7c4b246f6f66360789c72b754ff85021David 'Digit' Turner * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 246a9b888d7c4b246f6f66360789c72b754ff85021David 'Digit' Turner * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 256a9b888d7c4b246f6f66360789c72b754ff85021David 'Digit' Turner * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 266a9b888d7c4b246f6f66360789c72b754ff85021David 'Digit' Turner * SUCH DAMAGE. 276a9b888d7c4b246f6f66360789c72b754ff85021David 'Digit' Turner */ 286a9b888d7c4b246f6f66360789c72b754ff85021David 'Digit' Turner 296b56691a678420477595a531b2d2829980eb51c0Dmitriy Ivanov#include <stddef.h> 306b56691a678420477595a531b2d2829980eb51c0Dmitriy Ivanov 31589eaa4c728d39a1fcadc98030033cd60833fbb1synergydevextern void* __dso_handle; 32589eaa4c728d39a1fcadc98030033cd60833fbb1synergydev 33589eaa4c728d39a1fcadc98030033cd60833fbb1synergydevextern int __cxa_atexit(void (*)(void*), void*, void*); 3439640842823ba4cd42bd11514c0da39aa939519fBruce Beare 359d40326830c2bd407427889c554adeb915ee6b4aNick Kralevich__attribute__ ((visibility ("hidden"))) 366b56691a678420477595a531b2d2829980eb51c0Dmitriy Ivanovvoid __atexit_handler_wrapper(void* func) { 376b56691a678420477595a531b2d2829980eb51c0Dmitriy Ivanov if (func != NULL) { 386b56691a678420477595a531b2d2829980eb51c0Dmitriy Ivanov (*(void (*)(void))func)(); 396b56691a678420477595a531b2d2829980eb51c0Dmitriy Ivanov } 406b56691a678420477595a531b2d2829980eb51c0Dmitriy Ivanov} 416b56691a678420477595a531b2d2829980eb51c0Dmitriy Ivanov 426b56691a678420477595a531b2d2829980eb51c0Dmitriy Ivanov__attribute__ ((visibility ("hidden"))) 43589eaa4c728d39a1fcadc98030033cd60833fbb1synergydevint atexit(void (*func)(void)) { 446b56691a678420477595a531b2d2829980eb51c0Dmitriy Ivanov return (__cxa_atexit(&__atexit_handler_wrapper, func, &__dso_handle)); 459d40326830c2bd407427889c554adeb915ee6b4aNick Kralevich} 46