blob: 9415fcf5d1f849db13bbd6fc3e0c1809a6b43193 [file] [log] [blame]
Elliott Hughesc5d028f2013-01-10 14:42:14 -08001/*
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
Dan Albert75ef63d2014-11-21 00:18:07 -080020#include <signal.h>
21
Elliott Hughesc5d028f2013-01-10 14:42:14 -080022// Our sigset_t is wrong for ARM and x86. It's 32-bit but the kernel expects 64 bits.
23// This means we can't support real-time signals correctly until we can change the ABI.
24// In the meantime, we can use this union to pass an appropriately-sized block of memory
25// to the kernel, at the cost of not being able to refer to real-time signals.
26union kernel_sigset_t {
27 kernel_sigset_t() {
28 clear();
29 }
30
31 kernel_sigset_t(const sigset_t* value) {
32 clear();
33 set(value);
34 }
35
36 void clear() {
Elliott Hughes11952072013-10-24 15:15:14 -070037 __builtin_memset(this, 0, sizeof(*this));
Elliott Hughesc5d028f2013-01-10 14:42:14 -080038 }
39
40 void set(const sigset_t* value) {
41 bionic = *value;
42 }
43
44 sigset_t* get() {
45 return &bionic;
46 }
47
48 sigset_t bionic;
49#ifndef __mips__
50 uint32_t kernel[2];
51#endif
52};
53
54#endif