Home | History | Annotate | Download | only in private
      1 /*
      2  * Copyright (C) 2013 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 #ifndef LIBC_PRIVATE_KERNEL_SIGSET_T_H_
     18 #define LIBC_PRIVATE_KERNEL_SIGSET_T_H_
     19 
     20 // Our sigset_t is wrong for ARM and x86. It's 32-bit but the kernel expects 64 bits.
     21 // This means we can't support real-time signals correctly until we can change the ABI.
     22 // In the meantime, we can use this union to pass an appropriately-sized block of memory
     23 // to the kernel, at the cost of not being able to refer to real-time signals.
     24 union kernel_sigset_t {
     25   kernel_sigset_t() {
     26     clear();
     27   }
     28 
     29   kernel_sigset_t(const sigset_t* value) {
     30     clear();
     31     set(value);
     32   }
     33 
     34   void clear() {
     35     memset(this, 0, sizeof(*this));
     36   }
     37 
     38   void set(const sigset_t* value) {
     39     bionic = *value;
     40   }
     41 
     42   sigset_t* get() {
     43     return &bionic;
     44   }
     45 
     46   sigset_t bionic;
     47 #ifndef __mips__
     48   uint32_t kernel[2];
     49 #endif
     50 };
     51 
     52 #endif
     53