sigchain_dummy.cc revision 277ccbd200ea43590dfc06a93ae184a765327ad0
1/* 2 * Copyright (C) 2014 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 */ 16 17#include <stdio.h> 18#include <stdlib.h> 19 20#ifdef HAVE_ANDROID_OS 21#include <android/log.h> 22#else 23#include <stdarg.h> 24#include <iostream> 25#endif 26 27#include "sigchain.h" 28 29#define ATTRIBUTE_UNUSED __attribute__((__unused__)) 30 31static void log(const char* format, ...) { 32 char buf[256]; 33 va_list ap; 34 va_start(ap, format); 35 vsnprintf(buf, sizeof(buf), format, ap); 36#ifdef HAVE_ANDROID_OS 37 __android_log_write(ANDROID_LOG_ERROR, "libsigchain", buf); 38#else 39 std::cout << buf << "\n"; 40#endif 41 va_end(ap); 42} 43 44namespace art { 45 46 47extern "C" void ClaimSignalChain(int signal ATTRIBUTE_UNUSED, 48 struct sigaction* oldaction ATTRIBUTE_UNUSED) { 49 log("ClaimSignalChain is not exported by the main executable."); 50 abort(); 51} 52 53extern "C" void UnclaimSignalChain(int signal ATTRIBUTE_UNUSED) { 54 log("UnclaimSignalChain is not exported by the main executable."); 55 abort(); 56} 57 58extern "C" void InvokeUserSignalHandler(int sig ATTRIBUTE_UNUSED, 59 siginfo_t* info ATTRIBUTE_UNUSED, 60 void* context ATTRIBUTE_UNUSED) { 61 log("InvokeUserSignalHandler is not exported by the main executable."); 62 abort(); 63} 64 65extern "C" void InitializeSignalChain() { 66 log("InitializeSignalChain is not exported by the main executable."); 67 abort(); 68} 69 70extern "C" void EnsureFrontOfChain(int signal ATTRIBUTE_UNUSED, 71 struct sigaction* expected_action ATTRIBUTE_UNUSED) { 72 log("EnsureFrontOfChain is not exported by the main executable."); 73 abort(); 74} 75 76} // namespace art 77