OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [linux/] [uClibc/] [libc/] [signal/] [allocrtsig.c] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1325 phoenix
/* Handle real-time signal allocation.
2
   Copyright (C) 1997, 1998, 1999 Free Software Foundation, Inc.
3
   This file is part of the GNU C Library.
4
   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
5
 
6
   The GNU C Library is free software; you can redistribute it and/or
7
   modify it under the terms of the GNU Lesser General Public
8
   License as published by the Free Software Foundation; either
9
   version 2.1 of the License, or (at your option) any later version.
10
 
11
   The GNU C Library is distributed in the hope that it will be useful,
12
   but WITHOUT ANY WARRANTY; without even the implied warranty of
13
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14
   Lesser General Public License for more details.
15
 
16
   You should have received a copy of the GNU Lesser General Public
17
   License along with the GNU C Library; if not, write to the Free
18
   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
19
   02111-1307 USA.  */
20
 
21
#include <features.h>
22
#include <signal.h>
23
#include <sys/types.h>
24
#include <sys/syscall.h>
25
 
26
/* Only enable rt signals when it is supported at compile time */
27
#ifndef __NR_rt_sigaction
28
/* In these variables we keep track of the used variables.  If the
29
   platform does not support any real-time signals we will define the
30
   values to some unreasonable value which will signal failing of all
31
   the functions below.  */
32
static int current_rtmin = -1;
33
static int current_rtmax = -1;
34
#else
35
static int current_rtmin = __SIGRTMIN;
36
static int current_rtmax = __SIGRTMAX;
37
#endif
38
 
39
/* Return number of available real-time signal with highest priority.  */
40
int __libc_current_sigrtmin (void)
41
{
42
  return current_rtmin;
43
}
44
 
45
/* Return number of available real-time signal with lowest priority.  */
46
int __libc_current_sigrtmax (void)
47
{
48
  return current_rtmax;
49
}
50
 
51
/* Allocate real-time signal with highest/lowest available
52
   priority.  Please note that we don't use a lock since we assume
53
   this function to be called at program start.  */
54
int __libc_allocate_rtsig (int high)
55
{
56
  if (current_rtmin == -1 || current_rtmin > current_rtmax)
57
    /* We don't have anymore signal available.  */
58
    return -1;
59
 
60
  return high ? current_rtmin++ : current_rtmax--;
61
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.