This file is indexed.

/usr/include/rtai/rtai_signal.h is in librtai-dev 3.8.1-4build1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
/*
 * Copyright (C) 2006 Paolo Mantegazza <mantegazza@aero.polimi.it>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.

 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA.
 *
 */

#ifndef _RTAI_SIGNAL_H_
#define _RTAI_SIGNAL_H_

#define RTAI_SIGNALS_IDX  BIDX

#include <rtai_sched.h>

#define MAXSIGNALS  16

#define SIGNAL_TASK_INIPRIO     0

struct rt_signal_t { unsigned long flags; RT_TASK *sigtask; };

struct sigsuprt_t { RT_TASK *sigtask; RT_TASK *task; long signal; void (*sighdl)(long, RT_TASK *); unsigned long cpuid; };

#ifdef __KERNEL__

#define SIGNAL_ENBIT   0
#define SIGNAL_PNDBIT  1

#define SIGNAL_TASK_STACK_SIZE  8192

RTAI_SYSCALL_MODE int rt_signal_helper(RT_TASK *task);

int rt_request_signal(long signal, void (*sighdl)(long, RT_TASK *));

RTAI_SYSCALL_MODE int rt_request_signal_(RT_TASK *sigtask, RT_TASK *task, long signal);

RTAI_SYSCALL_MODE int rt_release_signal(long signal, RT_TASK *task);

RTAI_SYSCALL_MODE void rt_enable_signal(long signal, RT_TASK *task);

RTAI_SYSCALL_MODE void rt_disable_signal(long signal, RT_TASK *task);

RTAI_SYSCALL_MODE void rt_trigger_signal(long signal, RT_TASK *task);

RTAI_SYSCALL_MODE int rt_wait_signal(RT_TASK *sigtask, RT_TASK *task);

#else /* !__KERNEL__ */

#include <sys/mman.h>

#include <rtai_lxrt.h>

#define SIGNAL_TASK_STACK_SIZE  64*1024

#ifndef __SIGNAL_SUPPORT_FUN__
#define __SIGNAL_SUPPORT_FUN__

static void signal_suprt_fun(struct sigsuprt_t *funarg)
{		
	struct sigtsk_t { RT_TASK *sigtask; RT_TASK *task; };
	struct sigreq_t { RT_TASK *sigtask; RT_TASK *task; long signal; void (*sighdl)(int, RT_TASK *); };
	struct sigsuprt_t arg = *funarg;

	if ((arg.sigtask = rt_thread_init(rt_get_name(0), SIGNAL_TASK_INIPRIO, 0, SCHED_FIFO, 1 << arg.cpuid))) {
		if (!rtai_lxrt(RTAI_SIGNALS_IDX, sizeof(struct sigreq_t), RT_SIGNAL_REQUEST, &arg).i[LOW]) {
			rt_grow_and_lock_stack(SIGNAL_TASK_STACK_SIZE/2);
			rt_make_hard_real_time();
			while (rtai_lxrt(RTAI_SIGNALS_IDX, sizeof(struct sigtsk_t), RT_SIGNAL_WAITSIG, &arg).i[LOW]) {
				arg.sighdl(arg.signal, arg.task);
			}
			rt_make_soft_real_time();
		}
		rt_task_delete(arg.sigtask);
	}
}

#endif /* __SIGNAL_SUPPORT_FUN__ */

RTAI_PROTO(int, rt_request_signal, (long signal, void (*sighdl)(long, RT_TASK *)))
{
	if (signal >= 0 && sighdl) {
		struct sigsuprt_t arg = { NULL, rt_buddy(), signal, sighdl };
		arg.cpuid = rtai_lxrt(RTAI_SIGNALS_IDX, sizeof(void *), RT_SIGNAL_HELPER, &arg.sigtask).i[LOW];
		if (rt_thread_create((void *)signal_suprt_fun, &arg, SIGNAL_TASK_STACK_SIZE)) {
			return rtai_lxrt(RTAI_SIGNALS_IDX, sizeof(RT_TASK *), RT_SIGNAL_HELPER, &arg.task).i[LOW];
		}
	}
	return -EINVAL;
}

RTAI_PROTO(int, rt_release_signal, (long signal, RT_TASK *task))
{
	struct { long signal; RT_TASK *task; } arg = { signal, task };
	return rtai_lxrt(RTAI_SIGNALS_IDX, SIZARG, RT_SIGNAL_RELEASE, &arg).i[LOW];
}

RTAI_PROTO(void, rt_enable_signal, (long signal, RT_TASK *task))
{
	struct { long signal; RT_TASK *task; } arg = { signal, task };
	rtai_lxrt(RTAI_SIGNALS_IDX, SIZARG, RT_SIGNAL_ENABLE, &arg);
}

RTAI_PROTO(void, rt_disable_signal, (long signal, RT_TASK *task))
{
	struct { long signal; RT_TASK *task; } arg = { signal, task };
	rtai_lxrt(RTAI_SIGNALS_IDX, SIZARG, RT_SIGNAL_DISABLE, &arg);
}

RTAI_PROTO(void, rt_trigger_signal, (long signal, RT_TASK *task))
{
	struct { long signal; RT_TASK *task; } arg = { signal, task };
	rtai_lxrt(RTAI_SIGNALS_IDX, SIZARG, RT_SIGNAL_TRIGGER, &arg);
}

#endif /* __KERNEL__ */

#endif /* !_RTAI_SIGNAL_H_ */