1c5d028fc913de84a781bd61084bf7ae2182fd48eElliott Hughes/* 2c5d028fc913de84a781bd61084bf7ae2182fd48eElliott Hughes * Copyright (C) 2013 The Android Open Source Project 3c5d028fc913de84a781bd61084bf7ae2182fd48eElliott Hughes * 4c5d028fc913de84a781bd61084bf7ae2182fd48eElliott Hughes * Licensed under the Apache License, Version 2.0 (the "License"); 5c5d028fc913de84a781bd61084bf7ae2182fd48eElliott Hughes * you may not use this file except in compliance with the License. 6c5d028fc913de84a781bd61084bf7ae2182fd48eElliott Hughes * You may obtain a copy of the License at 7c5d028fc913de84a781bd61084bf7ae2182fd48eElliott Hughes * 8c5d028fc913de84a781bd61084bf7ae2182fd48eElliott Hughes * http://www.apache.org/licenses/LICENSE-2.0 9c5d028fc913de84a781bd61084bf7ae2182fd48eElliott Hughes * 10c5d028fc913de84a781bd61084bf7ae2182fd48eElliott Hughes * Unless required by applicable law or agreed to in writing, software 11c5d028fc913de84a781bd61084bf7ae2182fd48eElliott Hughes * distributed under the License is distributed on an "AS IS" BASIS, 12c5d028fc913de84a781bd61084bf7ae2182fd48eElliott Hughes * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13c5d028fc913de84a781bd61084bf7ae2182fd48eElliott Hughes * See the License for the specific language governing permissions and 14c5d028fc913de84a781bd61084bf7ae2182fd48eElliott Hughes * limitations under the License. 15c5d028fc913de84a781bd61084bf7ae2182fd48eElliott Hughes */ 16c5d028fc913de84a781bd61084bf7ae2182fd48eElliott Hughes 17c5d028fc913de84a781bd61084bf7ae2182fd48eElliott Hughes#ifndef LIBC_PRIVATE_KERNEL_SIGSET_T_H_ 18c5d028fc913de84a781bd61084bf7ae2182fd48eElliott Hughes#define LIBC_PRIVATE_KERNEL_SIGSET_T_H_ 19c5d028fc913de84a781bd61084bf7ae2182fd48eElliott Hughes 20c5d028fc913de84a781bd61084bf7ae2182fd48eElliott Hughes// Our sigset_t is wrong for ARM and x86. It's 32-bit but the kernel expects 64 bits. 21c5d028fc913de84a781bd61084bf7ae2182fd48eElliott Hughes// This means we can't support real-time signals correctly until we can change the ABI. 22c5d028fc913de84a781bd61084bf7ae2182fd48eElliott Hughes// In the meantime, we can use this union to pass an appropriately-sized block of memory 23c5d028fc913de84a781bd61084bf7ae2182fd48eElliott Hughes// to the kernel, at the cost of not being able to refer to real-time signals. 24c5d028fc913de84a781bd61084bf7ae2182fd48eElliott Hughesunion kernel_sigset_t { 25c5d028fc913de84a781bd61084bf7ae2182fd48eElliott Hughes kernel_sigset_t() { 26c5d028fc913de84a781bd61084bf7ae2182fd48eElliott Hughes clear(); 27c5d028fc913de84a781bd61084bf7ae2182fd48eElliott Hughes } 28c5d028fc913de84a781bd61084bf7ae2182fd48eElliott Hughes 29c5d028fc913de84a781bd61084bf7ae2182fd48eElliott Hughes kernel_sigset_t(const sigset_t* value) { 30c5d028fc913de84a781bd61084bf7ae2182fd48eElliott Hughes clear(); 31c5d028fc913de84a781bd61084bf7ae2182fd48eElliott Hughes set(value); 32c5d028fc913de84a781bd61084bf7ae2182fd48eElliott Hughes } 33c5d028fc913de84a781bd61084bf7ae2182fd48eElliott Hughes 34c5d028fc913de84a781bd61084bf7ae2182fd48eElliott Hughes void clear() { 3511952073af22568bba0b661f7a9d4402c443a888Elliott Hughes __builtin_memset(this, 0, sizeof(*this)); 36c5d028fc913de84a781bd61084bf7ae2182fd48eElliott Hughes } 37c5d028fc913de84a781bd61084bf7ae2182fd48eElliott Hughes 38c5d028fc913de84a781bd61084bf7ae2182fd48eElliott Hughes void set(const sigset_t* value) { 39c5d028fc913de84a781bd61084bf7ae2182fd48eElliott Hughes bionic = *value; 40c5d028fc913de84a781bd61084bf7ae2182fd48eElliott Hughes } 41c5d028fc913de84a781bd61084bf7ae2182fd48eElliott Hughes 42c5d028fc913de84a781bd61084bf7ae2182fd48eElliott Hughes sigset_t* get() { 43c5d028fc913de84a781bd61084bf7ae2182fd48eElliott Hughes return &bionic; 44c5d028fc913de84a781bd61084bf7ae2182fd48eElliott Hughes } 45c5d028fc913de84a781bd61084bf7ae2182fd48eElliott Hughes 46c5d028fc913de84a781bd61084bf7ae2182fd48eElliott Hughes sigset_t bionic; 47c5d028fc913de84a781bd61084bf7ae2182fd48eElliott Hughes#ifndef __mips__ 48c5d028fc913de84a781bd61084bf7ae2182fd48eElliott Hughes uint32_t kernel[2]; 49c5d028fc913de84a781bd61084bf7ae2182fd48eElliott Hughes#endif 50c5d028fc913de84a781bd61084bf7ae2182fd48eElliott Hughes}; 51c5d028fc913de84a781bd61084bf7ae2182fd48eElliott Hughes 52c5d028fc913de84a781bd61084bf7ae2182fd48eElliott Hughes#endif 53