blob: 17bfe8f729e2f78a2c2d2b81fd52105a9ec572a8 [file] [log] [blame]
Dmitriy Ivanovf57874d2014-10-07 13:43:23 -07001/*
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
Ian Rogerscf7f1912014-10-22 22:06:39 -070017#include <stdio.h>
18#include <stdlib.h>
19
Dmitriy Ivanovf57874d2014-10-07 13:43:23 -070020#ifdef HAVE_ANDROID_OS
21#include <android/log.h>
22#else
23#include <stdarg.h>
24#include <iostream>
25#endif
26
Dmitriy Ivanovf57874d2014-10-07 13:43:23 -070027#include "sigchain.h"
28
29static void log(const char* format, ...) {
30 char buf[256];
31 va_list ap;
32 va_start(ap, format);
33 vsnprintf(buf, sizeof(buf), format, ap);
34#ifdef HAVE_ANDROID_OS
35 __android_log_write(ANDROID_LOG_ERROR, "libsigchain", buf);
36#else
37 std::cout << buf << "\n";
38#endif
39 va_end(ap);
40}
41
42extern "C" void ClaimSignalChain(int signal, struct sigaction* oldaction) {
43 log("ClaimSignalChain is not exported by the main executable.");
44 abort();
45}
46
47extern "C" void UnclaimSignalChain(int signal) {
48 log("UnclaimSignalChain is not exported by the main executable.");
49 abort();
50}
51
52extern "C" void InvokeUserSignalHandler(int sig, siginfo_t* info, void* context) {
53 log("InvokeUserSignalHandler is not exported by the main executable.");
54 abort();
55}
56
57extern "C" void InitializeSignalChain() {
58 log("InitializeSignalChain is not exported by the main executable.");
59 abort();
60}
Mathieu Chartierd0004802014-10-15 16:59:47 -070061
62extern "C" void EnsureFrontOfChain(int signal, struct sigaction* expected_action) {
63 log("EnsureFrontOfChain is not exported by the main executable.");
64 abort();
65}