~ubuntu-branches/ubuntu/utopic/eglibc/utopic

« back to all changes in this revision

Viewing changes to ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/bits/sched.h

  • Committer: Package Import Robot
  • Author(s): Adam Conrad
  • Date: 2012-10-26 05:14:58 UTC
  • mfrom: (1.5.1) (4.4.22 experimental)
  • Revision ID: package-import@ubuntu.com-20121026051458-oryotr4i03ob5pab
Tags: 2.16-0ubuntu1
* Merge with unreleased 2.16 in Debian experimental, remaining changes:
  - Drop the Breaks line from libc6, which refers to a Debian transition
  - Remove the libc6 recommends on libc6-i686, which we don't build
  - Enable libc6{,-dev}-armel on armhf and libc6{-dev}-armhf on armel
  - Ship update-locale and validlocale in /usr/sbin in libc-bin
  - Don't build locales or locales-all in Ubuntu, we rely on langpacks
  - Heavily mangle the way we do service restarting on major upgrades
  - Use different MIN_KERNEL_SUPPORTED versions than Debian, due to
    buildd needs.  This should be universally bumped to 3.2.0 once all
    our buildds (including the PPA guests) are running precise kernels
  - Build i386 variants as -march=i686, build amd64 with -O3, and build
    ppc64 variants (both 64-bit and 32-bit) with -O3 -fno-tree-vectorize
  - Re-enable unsubmitted-ldconfig-cache-abi.diff and rebuild the cache
    on upgrades from previous versions that used a different constant
  - debian/patches/any/local-CVE-2012-3406.diff: switch to malloc when
    array grows too large to handle via alloca extension (CVE-2012-3406)
  - Build generic i386/i686 flavour with -mno-tls-direct-seg-refs
* Changes added/dropped with this merge while reducing our delta:
  - Stop building glibc docs from the eglibc source, and instead make
    the glibc-docs stub have a hard dependency on glibc-doc-reference
  - Remove outdated conflicts against ancient versions of ia32-libs
  - Drop the tzdata dependency from libc6, it's in required and minimal
  - Use gcc-4.7/g++-4.7 by default on all our supported architectures
  - Save our historical changelog as changelog.ubuntu in the source
  - Drop nscd's libaudit build-dep for now, as libaudit is in universe
  - Drop the unnecessary Breaks from libc6 to locales and locales-all
  - Ship xen's ld.so.conf.d snippet as /etc/ld.so.conf.d/libc6-xen.conf
* Disable hard failures on the test suite for the first upload to raring

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* Definitions of constants and data structure for POSIX 1003.1b-1993
 
2
   scheduling interface.
 
3
   Copyright (C) 1996-1999,2001-2003,2005,2006,2007,2008
 
4
   Free Software Foundation, Inc.
 
5
   This file is part of the GNU C Library.
 
6
 
 
7
   The GNU C Library is free software; you can redistribute it and/or
 
8
   modify it under the terms of the GNU Lesser General Public
 
9
   License as published by the Free Software Foundation; either
 
10
   version 2.1 of the License, or (at your option) any later version.
 
11
 
 
12
   The GNU C Library is distributed in the hope that it will be useful,
 
13
   but WITHOUT ANY WARRANTY; without even the implied warranty of
 
14
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
15
   Lesser General Public License for more details.
 
16
 
 
17
   You should have received a copy of the GNU Lesser General Public
 
18
   License along with the GNU C Library; if not, write to the Free
 
19
   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
 
20
   02111-1307 USA.  */
 
21
 
 
22
#ifndef __need_schedparam
 
23
 
 
24
#ifndef _SCHED_H
 
25
# error "Never include <bits/sched.h> directly; use <sched.h> instead."
 
26
#endif
 
27
 
 
28
 
 
29
/* Scheduling algorithms.  */
 
30
#define SCHED_OTHER     2
 
31
#define SCHED_FIFO      1
 
32
#define SCHED_RR        3
 
33
 
 
34
 
 
35
#ifdef __USE_MISC
 
36
/* Cloning flags.  */
 
37
# define CSIGNAL       0x000000ff /* Signal mask to be sent at exit.  */
 
38
# define CLONE_VM      0x00000100 /* Set if VM shared between processes.  */
 
39
# define CLONE_FS      0x00000200 /* Set if fs info shared between processes.  */
 
40
# define CLONE_FILES   0x00000400 /* Set if open files shared between processes.  */
 
41
# define CLONE_SIGHAND 0x00000800 /* Set if signal handlers shared.  */
 
42
# define CLONE_PTRACE  0x00002000 /* Set if tracing continues on the child.  */
 
43
# define CLONE_VFORK   0x00004000 /* Set if the parent wants the child to
 
44
                                     wake it up on mm_release.  */
 
45
# define CLONE_SYSVSEM 0x00040000 /* share system V SEM_UNDO semantics */
 
46
#endif
 
47
 
 
48
/* The official definition.  */
 
49
struct sched_param
 
50
  {
 
51
    int __sched_priority;
 
52
  };
 
53
 
 
54
__BEGIN_DECLS
 
55
 
 
56
#ifdef __USE_MISC
 
57
/* Clone current process.  */
 
58
extern int clone (int (*__fn) (void *__arg), void *__child_stack,
 
59
                  int __flags, void *__arg) __THROW;
 
60
 
 
61
/* Unshare the specified resources.  */
 
62
extern int unshare (int __flags) __THROW;
 
63
 
 
64
/* Get index of currently used CPU.  */
 
65
extern int sched_getcpu (void) __THROW;
 
66
#endif
 
67
 
 
68
__END_DECLS
 
69
 
 
70
#endif  /* need schedparam */
 
71
 
 
72
#if !defined __defined_schedparam \
 
73
    && (defined __need_schedparam || defined _SCHED_H)
 
74
# define __defined_schedparam   1
 
75
/* Data structure to describe a process' schedulability.  */
 
76
struct __sched_param
 
77
  {
 
78
    int __sched_priority;
 
79
  };
 
80
# undef __need_schedparam
 
81
#endif
 
82
 
 
83
 
 
84
#if defined _SCHED_H && !defined __cpu_set_t_defined
 
85
# define __cpu_set_t_defined
 
86
/* Size definition for CPU sets.  */
 
87
# define __CPU_SETSIZE  128
 
88
# define __NCPUBITS     (8 * sizeof (__cpu_mask))
 
89
 
 
90
/* Type for array elements in 'cpu_set_t'.  */
 
91
typedef unsigned long int __cpu_mask;
 
92
 
 
93
/* Basic access functions.  */
 
94
# define __CPUELT(cpu)  ((cpu) / __NCPUBITS)
 
95
# define __CPUMASK(cpu) ((__cpu_mask) 1 << ((cpu) % __NCPUBITS))
 
96
 
 
97
/* Data structure to describe CPU mask.  */
 
98
typedef struct
 
99
{
 
100
  __cpu_mask __bits[__CPU_SETSIZE / __NCPUBITS];
 
101
} cpu_set_t;
 
102
 
 
103
/* Access functions for CPU masks.  */
 
104
# if __GNUC_PREREQ (2, 91)
 
105
#  define __CPU_ZERO_S(setsize, cpusetp) \
 
106
  do __builtin_memset (cpusetp, '\0', setsize); while (0)
 
107
# else
 
108
#  define __CPU_ZERO_S(setsize, cpusetp) \
 
109
  do {                                                                        \
 
110
    size_t __i;                                                               \
 
111
    size_t __imax = (setsize) / sizeof (__cpu_mask);                          \
 
112
    __cpu_mask *__bits = (cpusetp)->__bits;                                   \
 
113
    for (__i = 0; __i < __imax; ++__i)                                        \
 
114
      __bits[__i] = 0;                                                        \
 
115
  } while (0)
 
116
# endif
 
117
# define __CPU_SET_S(cpu, setsize, cpusetp) \
 
118
  (__extension__                                                              \
 
119
   ({ size_t __cpu = (cpu);                                                   \
 
120
      __cpu < 8 * (setsize)                                                   \
 
121
      ? (((__cpu_mask *) ((cpusetp)->__bits))[__CPUELT (__cpu)]               \
 
122
         |= __CPUMASK (__cpu))                                                \
 
123
      : 0; }))
 
124
# define __CPU_CLR_S(cpu, setsize, cpusetp) \
 
125
  (__extension__                                                              \
 
126
   ({ size_t __cpu = (cpu);                                                   \
 
127
      __cpu < 8 * (setsize)                                                   \
 
128
      ? (((__cpu_mask *) ((cpusetp)->__bits))[__CPUELT (__cpu)]               \
 
129
         &= ~__CPUMASK (__cpu))                                               \
 
130
      : 0; }))
 
131
# define __CPU_ISSET_S(cpu, setsize, cpusetp) \
 
132
  (__extension__                                                              \
 
133
   ({ size_t __cpu = (cpu);                                                   \
 
134
      __cpu < 8 * (setsize)                                                   \
 
135
      ? ((((__const __cpu_mask *) ((cpusetp)->__bits))[__CPUELT (__cpu)]              \
 
136
          & __CPUMASK (__cpu))) != 0                                          \
 
137
      : 0; }))
 
138
 
 
139
# define __CPU_COUNT_S(setsize, cpusetp) \
 
140
  __sched_cpucount (setsize, cpusetp)
 
141
 
 
142
# if __GNUC_PREREQ (2, 91)
 
143
#  define __CPU_EQUAL_S(setsize, cpusetp1, cpusetp2) \
 
144
  (__builtin_memcmp (cpusetp1, cpusetp2, setsize) == 0)
 
145
# else
 
146
#  define __CPU_EQUAL_S(setsize, cpusetp1, cpusetp2) \
 
147
  (__extension__                                                              \
 
148
   ({ __const __cpu_mask *__arr1 = (cpusetp1)->__bits;                                \
 
149
      __const __cpu_mask *__arr2 = (cpusetp2)->__bits;                                \
 
150
      size_t __imax = (setsize) / sizeof (__cpu_mask);                        \
 
151
      size_t __i;                                                             \
 
152
      for (__i = 0; __i < __imax; ++__i)                                      \
 
153
        if (__bits[__i] != __bits[__i])                                       \
 
154
          break;                                                              \
 
155
      __i == __imax; }))
 
156
# endif
 
157
 
 
158
# define __CPU_OP_S(setsize, destset, srcset1, srcset2, op) \
 
159
  (__extension__                                                              \
 
160
   ({ cpu_set_t *__dest = (destset);                                          \
 
161
      __const __cpu_mask *__arr1 = (srcset1)->__bits;                                 \
 
162
      __const __cpu_mask *__arr2 = (srcset2)->__bits;                                 \
 
163
      size_t __imax = (setsize) / sizeof (__cpu_mask);                        \
 
164
      size_t __i;                                                             \
 
165
      for (__i = 0; __i < __imax; ++__i)                                      \
 
166
        ((__cpu_mask *) __dest->__bits)[__i] = __arr1[__i] op __arr2[__i];    \
 
167
      __dest; }))
 
168
 
 
169
# define __CPU_ALLOC_SIZE(count) \
 
170
  ((((count) + __NCPUBITS - 1) / __NCPUBITS) * sizeof (__cpu_mask))
 
171
# define __CPU_ALLOC(count) __sched_cpualloc (count)
 
172
# define __CPU_FREE(cpuset) __sched_cpufree (cpuset)
 
173
 
 
174
__BEGIN_DECLS
 
175
 
 
176
extern int __sched_cpucount (size_t __setsize, const cpu_set_t *__setp)
 
177
  __THROW;
 
178
extern cpu_set_t *__sched_cpualloc (size_t __count) __THROW __wur;
 
179
extern void __sched_cpufree (cpu_set_t *__set) __THROW;
 
180
 
 
181
__END_DECLS
 
182
 
 
183
#endif