~ubuntu-branches/ubuntu/jaunty/pcsc-lite/jaunty-security

« back to all changes in this revision

Viewing changes to pcsc-lite/win32/sched.h

  • Committer: Bazaar Package Importer
  • Author(s): Ludovic Rousseau
  • Date: 2005-11-27 18:04:59 UTC
  • mfrom: (1.2.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20051127180459-qrex2gzpq9d8jexd
Tags: 1.2.9-beta9-1
* New upstream version
* debian/compat: change from 3 to 4

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * Module: sched.h
3
 
 *
4
 
 * Purpose:
5
 
 *      Provides an implementation of POSIX realtime extensions
6
 
 *      as defined in 
7
 
 *
8
 
 *              POSIX 1003.1b-1993      (POSIX.1b)
9
 
 *
10
 
 * --------------------------------------------------------------------------
11
 
 *
12
 
 *      Pthreads-win32 - POSIX Threads Library for Win32
13
 
 *      Copyright(C) 1998 John E. Bossom
14
 
 *      Copyright(C) 1999,2002 Pthreads-win32 contributors
15
 
 * 
16
 
 *      Contact Email: rpj@ise.canberra.edu.au
17
 
 * 
18
 
 *      The current list of contributors is contained
19
 
 *      in the file CONTRIBUTORS included with the source
20
 
 *      code distribution. The list can also be seen at the
21
 
 *      following World Wide Web location:
22
 
 *      http://sources.redhat.com/pthreads-win32/contributors.html
23
 
 * 
24
 
 *      This library is free software; you can redistribute it and/or
25
 
 *      modify it under the terms of the GNU Lesser General Public
26
 
 *      License as published by the Free Software Foundation; either
27
 
 *      version 2 of the License, or (at your option) any later version.
28
 
 * 
29
 
 *      This library is distributed in the hope that it will be useful,
30
 
 *      but WITHOUT ANY WARRANTY; without even the implied warranty of
31
 
 *      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
32
 
 *      Lesser General Public License for more details.
33
 
 * 
34
 
 *      You should have received a copy of the GNU Lesser General Public
35
 
 *      License along with this library in the file COPYING.LIB;
36
 
 *      if not, write to the Free Software Foundation, Inc.,
37
 
 *      59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
38
 
 */
39
 
#ifndef _SCHED_H
40
 
#define _SCHED_H
41
 
 
42
 
#undef PTW32_LEVEL
43
 
 
44
 
#if defined(_POSIX_SOURCE)
45
 
#define PTW32_LEVEL 0
46
 
/* Early POSIX */
47
 
#endif
48
 
 
49
 
#if defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 199309
50
 
#undef PTW32_LEVEL
51
 
#define PTW32_LEVEL 1
52
 
/* Include 1b, 1c and 1d */
53
 
#endif
54
 
 
55
 
#if defined(INCLUDE_NP)
56
 
#undef PTW32_LEVEL
57
 
#define PTW32_LEVEL 2
58
 
/* Include Non-Portable extensions */
59
 
#endif
60
 
 
61
 
#define PTW32_LEVEL_MAX 3
62
 
 
63
 
#if !defined(PTW32_LEVEL)
64
 
#define PTW32_LEVEL PTW32_LEVEL_MAX
65
 
/* Include everything */
66
 
#endif
67
 
 
68
 
 
69
 
#if __GNUC__ && ! defined (__declspec)
70
 
# error Please upgrade your GNU compiler to one that supports __declspec.
71
 
#endif
72
 
 
73
 
/*
74
 
 * When building the DLL code, you should define PTW32_BUILD so that
75
 
 * the variables/functions are exported correctly. When using the DLL,
76
 
 * do NOT define PTW32_BUILD, and then the variables/functions will
77
 
 * be imported correctly.
78
 
 */
79
 
#ifdef PTW32_BUILD
80
 
# define PTW32_DLLPORT __declspec (dllexport)
81
 
#else
82
 
# define PTW32_DLLPORT __declspec (dllimport)
83
 
#endif
84
 
 
85
 
/*
86
 
 * This is a duplicate of what is in the autoconf config.h,
87
 
 * which is only used when building the pthread-win32 libraries.
88
 
 */
89
 
 
90
 
#ifndef PTW32_CONFIG_H
91
 
#  if defined(WINCE)
92
 
#    define NEED_ERRNO
93
 
#    define NEED_SEM
94
 
#  endif
95
 
#  if defined(_UWIN) || defined(__MINGW32__)
96
 
#    define HAVE_MODE_T
97
 
#  endif
98
 
#endif
99
 
 
100
 
/*
101
 
 *
102
 
 */
103
 
 
104
 
#if PTW32_LEVEL >= PTW32_LEVEL_MAX
105
 
#ifdef NEED_ERRNO
106
 
#include "need_errno.h"
107
 
#else
108
 
#include <errno.h>
109
 
#endif
110
 
#endif /* PTW32_LEVEL >= PTW32_LEVEL_MAX */
111
 
 
112
 
#if defined(__MINGW32__) || defined(_UWIN)
113
 
#if PTW32_LEVEL >= PTW32_LEVEL_MAX
114
 
/* For pid_t */
115
 
#  include <sys/types.h>
116
 
/* Required by Unix 98 */
117
 
#  include <time.h>
118
 
#endif /* PTW32_LEVEL >= PTW32_LEVEL_MAX */
119
 
#else
120
 
typedef int pid_t;
121
 
#endif
122
 
 
123
 
/* Thread scheduling policies */
124
 
 
125
 
enum {
126
 
  SCHED_OTHER = 0,
127
 
  SCHED_FIFO,
128
 
  SCHED_RR,
129
 
  SCHED_MIN   = SCHED_OTHER,
130
 
  SCHED_MAX   = SCHED_RR
131
 
};
132
 
 
133
 
struct sched_param {
134
 
  int sched_priority;
135
 
};
136
 
 
137
 
#ifdef __cplusplus
138
 
extern "C"
139
 
{
140
 
#endif                          /* __cplusplus */
141
 
 
142
 
PTW32_DLLPORT int sched_yield (void);
143
 
 
144
 
PTW32_DLLPORT int sched_get_priority_min (int policy);
145
 
 
146
 
PTW32_DLLPORT int sched_get_priority_max (int policy);
147
 
 
148
 
PTW32_DLLPORT int sched_setscheduler (pid_t pid, int policy);
149
 
 
150
 
PTW32_DLLPORT int sched_getscheduler (pid_t pid);
151
 
 
152
 
/*
153
 
 * Note that this macro returns ENOTSUP rather than
154
 
 * ENOSYS as might be expected. However, returning ENOSYS
155
 
 * should mean that sched_get_priority_{min,max} are
156
 
 * not implemented as well as sched_rr_get_interval.
157
 
 * This is not the case, since we just don't support
158
 
 * round-robin scheduling. Therefore I have chosen to
159
 
 * return the same value as sched_setscheduler when
160
 
 * SCHED_RR is passed to it.
161
 
 */
162
 
#define sched_rr_get_interval(_pid, _interval) \
163
 
  ( errno = ENOTSUP, (int) -1 )
164
 
 
165
 
 
166
 
#ifdef __cplusplus
167
 
}                               /* End of extern "C" */
168
 
#endif                          /* __cplusplus */
169
 
 
170
 
#undef PTW32_LEVEL
171
 
#undef PTW32_LEVEL_MAX
172
 
 
173
 
#endif                          /* !_SCHED_H */
174