summaryrefslogtreecommitdiff
path: root/components/libc/posix/pthreads/pthread_attr.c
blob: 3255ac09f0313f4c965015a1d18f207ca747bc00 (plain)
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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
/*
 * Copyright (c) 2006-2023, RT-Thread Development Team
 *
 * SPDX-License-Identifier: Apache-2.0
 *
 * Change Logs:
 * Date           Author       Notes
 * 2010-10-26     Bernard      the first version
 */

#include <rtthread.h>
#include "pthread.h"
#include "sched.h"
#include <string.h>

#define DEFAULT_STACK_SIZE  2048
#define DEFAULT_PRIORITY    (RT_THREAD_PRIORITY_MAX/2 + RT_THREAD_PRIORITY_MAX/4)

const pthread_attr_t pthread_default_attr =
{
    0,                          /* stack base */
    DEFAULT_STACK_SIZE,         /* stack size */

    PTHREAD_INHERIT_SCHED,      /* Inherit parent prio/policy */
    SCHED_FIFO,                 /* scheduler policy */
    {
        DEFAULT_PRIORITY,       /* scheduler priority */
    },
    PTHREAD_CREATE_JOINABLE,    /* detach state */
};

/**
 * @brief    This function will initialize  thread attributes object.
 *
 * @note     The pthread_attr_t type should be treated as opaque: any access to the object other
 *           than via pthreads functions is nonportable and produces undefined results.
 *           The resulting attribute object (possibly modified by setting individual attribute values),
 *           when used by pthread_create(), defines the attributes of the thread created. A single attributes
 *           object can be used in multiple simultaneous calls to pthread_create().
 *
 * @see      pthread_create()
 *
 * @param    attr is a thread attributes object.
 *
 * @return   Upon successful completion, pthread_attr_init() return a value of 0.
 *           Otherwise, it means that the event detach failed.
 *
 * @warning  This function will fail if attr is null.
 */
int pthread_attr_init(pthread_attr_t *attr)
{
    RT_ASSERT(attr != RT_NULL);

    *attr = pthread_default_attr;

    return 0;
}
RTM_EXPORT(pthread_attr_init);

/**
 * @brief    This function will destroy thread attributes object.
 *
 * @note     When a thread attributes object is no longer required, it should be destroyed
 *           using the pthread_attr_destroy() function. Destroying a thread attributes object
 *           has no effect on threads that were created using that object.
 *           Once a thread attributes object has been destroyed, it can be reinitialized using pthread_attr_init().
 *           Any other use of a destroyed thread attributes object has undefined results.
 *
 * @see      pthread_attr_init(), pthread_attr_getdetachstate(), pthread_create()
 *
 * @param    attr is a thread attributes object.
 *
 * @return   Upon successful completion, pthread_attr_destroy() and shall return a value of 0;
 *           Otherwise, an error number shall be returned to indicate the error.
 *
 * @warning  This function will fail if attr is null.
 */
int pthread_attr_destroy(pthread_attr_t *attr)
{
    RT_ASSERT(attr != RT_NULL);

    memset(attr, 0, sizeof(pthread_attr_t));

    return 0;
}
RTM_EXPORT(pthread_attr_destroy);

/**
 * @brief    This function set detach state attribute in thread attributes object.
 *
 * @note     This function sets the detach state attribute of the thread attributes object
 *           referred to by attr to the value specified in detachstate.  The detach state
 *           attribute determines whether a thread created using the thread attributes
 *           object attr will be created in a joinable or a detached state.
 *
 * @see      pthread_attr_init(), pthread_create(), pthread_detach(), pthread_join(), pthreads()
 *
 * @param    attr is a thread attributes object.
 *
 * @param    state is attribute in the attr object.
 *           attribute controls whether the thread is created in a detached state.
 *           The detachstate can be ONE of the following values:
 *
 *              PTHREAD_CREATE_DETACHED          It causes all threads created with attr to be in the detached state.
 *
 *              PTHREAD_CREATE_JOINABLE          Default value, it causes all threads created with attr to be in the joinable state.
 *
 * @return   Upon successful completion, pthread_attr_setdetachstate() and return a value of 0.
 *           Otherwise, an error number is returned to indicate the error.
 *
 * @warning  The pthread_attr_setdetachstate() function will fail if:
 *           [EINVAL]
 *              The value of detach state was not valid
 */
int pthread_attr_setdetachstate(pthread_attr_t *attr, int state)
{
    RT_ASSERT(attr != RT_NULL);

    if (state != PTHREAD_CREATE_JOINABLE && state != PTHREAD_CREATE_DETACHED)
        return EINVAL;

    attr->detachstate = state;

    return 0;
}
RTM_EXPORT(pthread_attr_setdetachstate);

/**
 * @brief    This function get detach state attribute in thread attributes object.
 *
 * @note     The detachstate attribute controls whether the thread is created in a detached state.
 *           If the thread is created detached, then use of the ID of the newly created thread by
 *           the pthread_detach() or pthread_join() function is an error.
 *
 * @see      pthread_attr_destroy(), pthread_attr_getstackaddr(), pthread_attr_getstacksize(), pthread_create()
 *
 * @param    attr is a thread attributes object.
 *
 * @param    state is attribute in the attr object.
 *           attribute controls whether the thread is created in a detached state.
 *           The detachstate can be ONE of the following values:
 *
 *              PTHREAD_CREATE_DETACHED          It causes all threads created with attr to be in the detached state.
 *
 *              PTHREAD_CREATE_JOINABLE          Default value, it causes all threads created with attr to be in the joinable state.
 *
 * @return   Upon successful completion, pthread_attr_getdetachstate() and shall return a value of 0;
 *           otherwise, an error number shall be returned to indicate the error.
 *
 *           The pthread_attr_getdetachstate() function stores the value of the detachstate
 *           attribute in detachstate if successful.
 */
int pthread_attr_getdetachstate(pthread_attr_t const *attr, int *state)
{
    RT_ASSERT(attr != RT_NULL);

    *state = (int)attr->detachstate;

    return 0;
}
RTM_EXPORT(pthread_attr_getdetachstate);

/**
 * @brief    This function sets schedpolicy attribute.
 *
 * @note     The function function sets the scheduling policy attribute of the thread
 *           attributes object referred to by attr to the value specified in policy.
 *
 * @see      pthread_attr_init(), pthread_attr_setscope(), pthread_attr_setinheritsched(), pthread_attr_setschedparam(), pthread_create()
 *
 * @param    attr is a thread attributes object.
 *
 * @param    policy is attribute in the attr object.
 *           The policy can be ONE of the following values:
 *
 *              SCHED_FIFO         First in-first out scheduling.
 *
 *              SCHED_RR           Round-robin scheduling.
 *
 *              SCHED_OTHER        Default Linux time-sharing scheduling.
 *
 * @return   On success, these functions return 0.
 */
int pthread_attr_setschedpolicy(pthread_attr_t *attr, int policy)
{
    RT_ASSERT(attr != RT_NULL);

    attr->schedpolicy = policy;

    return 0;
}
RTM_EXPORT(pthread_attr_setschedpolicy);

/**
 * @brief    This function gets schedpolicy attribute.
 *
 * @note     The function gets the schedpolicy attribute in the attr argument.
 *
 * @see      pthread_attr_destroy(), pthread_attr_getscope(), pthread_attr_getinheritsched(), pthread_attr_getschedparam(), pthread_create()
 *
 * @param    attr is a thread attributes object.
 *
 * @param    policy is attribute in the attr object.
 *           The policy can be ONE of the following values:
 *
 *              SCHED_FIFO         First in-first out scheduling.
 *
 *              SCHED_RR           Round-robin scheduling.
 *
 *              SCHED_OTHER        Default Linux time-sharing scheduling.
 *
 * @return   On success, these functions return 0.
 */
int pthread_attr_getschedpolicy(pthread_attr_t const *attr, int *policy)
{
    RT_ASSERT(attr != RT_NULL);

    *policy = (int)attr->schedpolicy;

    return 0;
}
RTM_EXPORT(pthread_attr_getschedpolicy);

/**
 * @brief    This function set the scheduling parameter attributes in the attr argument.

 * @see      pthread_attr_init(), pthread_attr_setscope(), pthread_attr_setinheritsched(), pthread_attr_setschedpolicy()
 *
 * @param    attr is a thread attributes object.
 *
 * @param    param is scheduling parameter attributes in the attr argument.
 *           The contents of the param structure are defined in <pthread.h>.
 *           For the SCHED_FIFO and SCHED_RR policies, the only required member of param is sched_priority.
 *
 * @return   On success, these functions return 0.
 */
int pthread_attr_setschedparam(pthread_attr_t           *attr,
                               struct sched_param const *param)
{
    RT_ASSERT(attr != RT_NULL);
    RT_ASSERT(param != RT_NULL);

    attr->schedparam.sched_priority = param->sched_priority;

    return 0;
}
RTM_EXPORT(pthread_attr_setschedparam);

/**
 * @brief    This function get the scheduling parameter attributes in the attr argument.

 * @see      pthread_attr_init(), pthread_attr_setscope(), pthread_attr_setinheritsched(), pthread_attr_setschedpolicy()
 *
 * @param    attr is a thread attributes object.
 *
 * @param    param is scheduling parameter attributes in the attr argument.
 *           The contents of the param structure are defined in <pthread.h>.
 *           For the SCHED_FIFO and SCHED_RR policies, the only required member of param is sched_priority.
 *
 * @return   On success, these functions return 0.
 */
int pthread_attr_getschedparam(pthread_attr_t const *attr,
                               struct sched_param   *param)
{
    RT_ASSERT(attr != RT_NULL);
    RT_ASSERT(param != RT_NULL);

    param->sched_priority = attr->schedparam.sched_priority;

    return 0;
}
RTM_EXPORT(pthread_attr_getschedparam);

/**
 * @brief    This function set the thread creation stacksize attribute in the attr object.
 *
 * @see      pthread_attr_init(), pthread_attr_setstackaddr(), pthread_attr_setdetachstate()
 *
 * @param    attr is a thread attributes object.
 *
 * @param    stack_size is the minimum stack size (in bytes) allocated for the created threads stack.
 *
 * @return   Upon successful completion, This function return a value of 0.
 */
int pthread_attr_setstacksize(pthread_attr_t *attr, size_t stack_size)
{
    RT_ASSERT(attr != RT_NULL);

    attr->stacksize = stack_size;

    return 0;
}
RTM_EXPORT(pthread_attr_setstacksize);

/**
 * @brief    This function get the thread creation stacksize attribute in the attr object.
 *
 * @see      pthread_attr_init(), pthread_attr_getstackaddr(), pthread_attr_getdetachstate()
 *
 * @param    attr is a thread attributes object.
 *
 * @param    stack_size is the minimum stack size (in bytes) allocated for the created threads stack.
 *
 * @return   Upon successful completion, This function return a value of 0.
 */
int pthread_attr_getstacksize(pthread_attr_t const *attr, size_t *stack_size)
{
    RT_ASSERT(attr != RT_NULL);

    *stack_size = attr->stacksize;

    return 0;
}
RTM_EXPORT(pthread_attr_getstacksize);

/**
 * @brief    This function sets the thread creation stackaddr attribute in the attr object.
 *
 * @see      pthread_attr_init(), pthread_attr_setdetachstate(), pthread_attr_setstacksize()
 *
 * @param    attr is a thread attributes object.
 *
 * @param    The stack_addr attribute specifies the location of storage to be used for the created
 *           thread's stack.
 *
 * @return   Upon successful completion, This function return a value of 0.
 */
int pthread_attr_setstackaddr(pthread_attr_t *attr, void *stack_addr)
{
    RT_ASSERT(attr != RT_NULL);

    return EOPNOTSUPP;
}
RTM_EXPORT(pthread_attr_setstackaddr);

/**
 * @brief    This function gets the thread creation stackaddr attribute in the attr object.
 *
 * @see      pthread_attr_init(), pthread_attr_setdetachstate(), pthread_attr_setstacksize()
 *
 * @param    attr is a thread attributes object.
 *
 * @param    The stack_addr attribute specifies the location of storage to be used for the created
 *           thread's stack.
 *
 * @return   Upon successful completion, This function return a value of 0.
 */
int pthread_attr_getstackaddr(pthread_attr_t const *attr, void **stack_addr)
{
    RT_ASSERT(attr != RT_NULL);

    return EOPNOTSUPP;
}
RTM_EXPORT(pthread_attr_getstackaddr);

/**
 * @brief    This function set the thread creation stack attributes stackaddr and stacksize in the attr object.
 *
 * @note     The stack attributes specify the area of storage to be used for the created thread's stack.
 *           The base (lowest addressable byte) of the storage shall be stack_base, and the size of the storage
 *           shall be stack_size bytes.
 *           All pages within the stack described by stackaddr and stacksize shall be both readable
 *           and writable by the thread.
 *
 * @see      pthread_attr_destroy, pthread_attr_getdetachstate, pthread_attr_getstacksize, pthread_create
 *
 * @param    attr is a thread attributes object.
 *
 * @param    stack_base is the base (lowest addressable byte) of the storage.
 *
 * @param    stack_size is the size of the storage.
 *
 * @return   Upon successful completion, these functions shall return a value of 0;
 *           otherwise, an error number shall be returned to indicate the error.
 *
 * @warning  The behavior is undefined if the value specified by the attr argument to or pthread_attr_setstack()
 *           does not refer to an initialized thread attributes object.
 */
int pthread_attr_setstack(pthread_attr_t *attr,
                          void           *stack_base,
                          size_t          stack_size)
{
    RT_ASSERT(attr != RT_NULL);

    attr->stackaddr = stack_base;
    attr->stacksize = RT_ALIGN_DOWN(stack_size, RT_ALIGN_SIZE);

    return 0;
}
RTM_EXPORT(pthread_attr_setstack);

/**
 * @brief    This function shall get the thread creation stack attributes stackaddr and stacksize in the attr object.
 *
 * @note     The stack attributes specify the area of storage to be used for the created thread's stack.
 *           The base (lowest addressable byte) of the storage shall be stack_base, and the size of the storage
 *           shall be stack_size bytes.
 *           All pages within the stack described by stack_base and stack_size shall be both readable
 *           and writable by the thread.
 *
 * @see      pthread_attr_destroy, pthread_attr_getdetachstate, pthread_attr_getstacksize, pthread_create
 *
 * @param    attr is a thread attributes object.
 *
 * @param    stack_base is the base (lowest addressable byte) of the storage.
 *
 * @param    stack_size is the size of the storage.
 *
 * @return   Upon successful completion, these functions shall return a value of 0;
 *           otherwise, an error number shall be returned to indicate the error.
 *           This function shall store the stack attribute values in stack_base and stack_size if successful.
 */
int pthread_attr_getstack(pthread_attr_t const *attr,
                          void                **stack_base,
                          size_t               *stack_size)
{
    RT_ASSERT(attr != RT_NULL);

    *stack_base = attr->stackaddr;
    *stack_size = attr->stacksize;

    return 0;
}
RTM_EXPORT(pthread_attr_getstack);

/**
 * @brief    This function shall set the guardsize attribute in the attr object.
 *
 * @note     The guardsize attribute controls the size of the guard area for the created thread's stack.
 *           The guardsize attribute provides protection against overflow of the stack pointer.
 *           If a thread's stack is created with guard protection, the implementation allocates extra
 *           memory at the overflow end of the stack as a buffer against stack overflow of the stack pointer.
 *           If an application overflows into this buffer an error shall result (possibly in a SIGSEGV signal
 *           being delivered to the thread).
 *
 * @see      <pthread.h>, <sys/mman.h>
 *
 * @param    attr is a thread attributes object.
 *
 * @param    guard_size is the size of the guard area for the created thread's stack.
 *
 * @return   Upon successful completion, these functions shall return a value of 0;
 *
 * @warning  The guardsize attribute is provided to the application for two reasons:
 *
 *              1. Overflow protection can potentially result in wasted system resources.
 *              An application that creates a large number of threads, and which knows its threads
 *              never overflow their stack, can save system resources by turning off guard areas.
 *
 *              2. When threads allocate large data structures on the stack, large guard areas may be
 *              needed to detect stack overflow.
 *
 *           The default size of the guard area is left implementation-defined since on systems
 *           supporting very large page sizes, the overhead might be substantial if at least one guard
 *           page is required by default.
 */
int pthread_attr_setguardsize(pthread_attr_t *attr, size_t guard_size)
{
    return EOPNOTSUPP;
}

/**
 * @brief    This function get the guardsize attribute in the attr object.
 *           This attribute shall be returned in the guard_size parameter.
 *
 * @note     The guardsize attribute controls the size of the guard area for the created thread's stack.
 *           The guardsize attribute provides protection against overflow of the stack pointer.
 *           If a thread's stack is created with guard protection, the implementation allocates extra
 *           memory at the overflow end of the stack as a buffer against stack overflow of the stack pointer.
 *
 * @see      <pthread.h>, <sys/mman.h>
 *
 * @param    attr is a thread attributes object.
 *
 * @param    guard_size is the size of the guard area for the created thread's stack.
 *
 * @return   Upon successful completion, these functions shall return a value of 0;
 *
 * @warning  The guardsize attribute is provided to the application for two reasons:
 *
 *              1. Overflow protection can potentially result in wasted system resources.
 *              An application that creates a large number of threads, and which knows its threads
 *              never overflow their stack, can save system resources by turning off guard areas.
 *
 *              2. When threads allocate large data structures on the stack, large guard areas may be
 *              needed to detect stack overflow.
 *
 *           The default size of the guard area is left implementation-defined since on systems
 *           supporting very large page sizes, the overhead might be substantial if at least one guard
 *           page is required by default.
 */
int pthread_attr_getguardsize(pthread_attr_t const *attr, size_t *guard_size)
{
    return EOPNOTSUPP;
}
RTM_EXPORT(pthread_attr_getguardsize);

/**
 * @brief    This function sets inherit-scheduler attribute in thread attributes object.
 *
 * @note     The function sets the inherit-scheduler attribute of the thread attributes object
 *           referred to by attr to the value specified in inheritsched.
 *           The inherit-scheduler attribute determines whether a thread created using the thread
 *           attributes object attr will inherit its scheduling attributes from the calling thread
 *           or whether it will take them from attr.
 *
 * @see      pthread_attr_init(), pthread_attr_setschedpolicy(), pthread_attr_setschedparam()
 *
 * @param    attr is a thread attributes object.
 *
 * @param    inheritsched the inheritsched attribute determines how the other scheduling attributes of the created thread are to be set:
 *           The policy can be ONE of the following values:
 *
 *              PTHREAD_INHERIT_SCHED          Specifies that the scheduling policy and associated attributes are
 *                                             to be inherited from the creating thread, and the scheduling attributes
 *                                             in this attr argument are to be ignored.
 *
 *              PTHREAD_EXPLICIT_SCHED         Specifies that the scheduling policy and associated attributes are to be
 *                                             set to the corresponding values from this attribute object.
 *
 * @return   Upon successful completion, these functions shall return a value of 0;
 */
int pthread_attr_setinheritsched(pthread_attr_t *attr, int inheritsched)
{
    RT_ASSERT(attr != RT_NULL);

    attr->inheritsched = inheritsched;

    return 0;
}
RTM_EXPORT(pthread_attr_setinheritsched);

/**
 * @brief    This function get and set the inheritsched attribute in the attr argument.
 *
 * @note     The function sets the inherit-scheduler attribute of the thread attributes object
 *           referred to by attr to the value specified in inheritsched.
 *           The inherit-scheduler attribute determines whether a thread created using the thread
 *           attributes object attr will inherit its scheduling attributes from the calling thread
 *           or whether it will take them from attr.
 *
 * @see      pthread_attr_init(), pthread_attr_getschedpolicy(), pthread_attr_getschedparam()
 *
 * @param    attr is a thread attributes object.
 *
 * @param    inheritsched the inheritsched attribute determines how the other scheduling attributes of the created thread are to be set:
 *           The inheritsched can be ONE of the following values:
 *
 *              PTHREAD_INHERIT_SCHED          Specifies that the scheduling policy and associated attributes are
 *                                             to be inherited from the creating thread, and the scheduling attributes
 *                                             in this attr argument are to be ignored.
 *
 *              PTHREAD_EXPLICIT_SCHED         Specifies that the scheduling policy and associated attributes are to be
 *                                             set to the corresponding values from this attribute object.
 *
 * @return   Upon successful completion, these functions shall return a value of 0;
 */
int pthread_attr_getinheritsched(const pthread_attr_t *attr, int *inheritsched)
{
    RT_ASSERT(attr != RT_NULL);

    *inheritsched = attr->inheritsched;

    return 0;
}
RTM_EXPORT(pthread_attr_getinheritsched);

/**
 * @brief    This function set contentionscope attribute.
 *
 * @note     The function are used to set the contentionscope attribute in the attr object.
 *
 * @param    attr is a thread attributes object.
 *
 * @param    scope is the value of contentionscope attribute.
 *           The scope can be ONE of the following values:
 *
 *              PTHREAD_SCOPE_SYSTEM           signifying system scheduling contention scope.
 *
 *              PTHREAD_SCOPE_PROCESS          signifying process scheduling contention scope.
 *
 * @return   Upon successful completion, these functions shall return a value of 0;
 */
int pthread_attr_setscope(pthread_attr_t *attr, int scope)
{
    if (scope == PTHREAD_SCOPE_SYSTEM)
        return 0;
    if (scope == PTHREAD_SCOPE_PROCESS)
        return EOPNOTSUPP;

    return EINVAL;
}
RTM_EXPORT(pthread_attr_setscope);

/**
 * @brief    This function get contentionscope attribute.
 *
 * @note     The function are used to get the contentionscope attribute in the attr object.
 *
 * @param    attr is a thread attributes object.
 *
 * @param    scope is the value of contentionscope attribute.
 *           The scope can be ONE of the following values:
 *
 *              PTHREAD_SCOPE_SYSTEM           signifying system scheduling contention scope.
 *
 *              PTHREAD_SCOPE_PROCESS          signifying process scheduling contention scope.
 *
 * @return   Upon successful completion, these functions shall return a value of 0;
 */
int pthread_attr_getscope(pthread_attr_t const *attr, int *scope)
{
    return PTHREAD_SCOPE_SYSTEM;
}
RTM_EXPORT(pthread_attr_getscope);