2009-11-24 22:44:07 +03:00
|
|
|
/*
|
2020-12-30 16:42:48 +03:00
|
|
|
* Copyright 2001-2020 Haiku, Inc. All rights reserved.
|
2009-11-24 22:44:07 +03:00
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*/
|
2005-11-09 21:01:16 +03:00
|
|
|
#ifndef _LIBC_LIMITS_H_
|
|
|
|
#define _LIBC_LIMITS_H_
|
2008-05-11 01:30:34 +04:00
|
|
|
/* Note: The header guard is checked in gcc's limits.h. */
|
2002-07-12 00:39:30 +04:00
|
|
|
|
2009-11-24 22:44:07 +03:00
|
|
|
|
|
|
|
#include <config/types.h>
|
|
|
|
|
2002-07-12 00:39:30 +04:00
|
|
|
#include <float.h> /* for DBL_DIG, FLT_DIG, etc */
|
|
|
|
|
2020-12-30 16:42:48 +03:00
|
|
|
#include __HAIKU_ARCH_HEADER(limits.h)
|
|
|
|
|
|
|
|
|
2002-07-12 00:39:30 +04:00
|
|
|
#define LONGLONG_MIN (-9223372036854775807LL - 1) /* these are Be specific */
|
|
|
|
#define LONGLONG_MAX (9223372036854775807LL)
|
2009-11-24 22:44:07 +03:00
|
|
|
#define ULONGLONG_MAX (0xffffffffffffffffULL)
|
2002-07-12 00:39:30 +04:00
|
|
|
|
2003-02-14 20:34:59 +03:00
|
|
|
#define ULLONG_MAX ULONGLONG_MAX
|
|
|
|
#define LLONG_MAX LONGLONG_MAX
|
|
|
|
#define LLONG_MIN LONGLONG_MIN
|
|
|
|
|
2011-11-22 20:40:45 +04:00
|
|
|
#define MB_LEN_MAX 16
|
|
|
|
|
2003-02-14 20:34:59 +03:00
|
|
|
#define OFF_MAX LLONG_MAX
|
|
|
|
#define OFF_MIN LLONG_MIN
|
|
|
|
|
2020-08-01 11:41:42 +03:00
|
|
|
#define ARG_MAX (128 * 1024)
|
2008-02-02 20:32:01 +03:00
|
|
|
#define ATEXIT_MAX (32)
|
2002-07-12 00:39:30 +04:00
|
|
|
#define CHILD_MAX (1024)
|
2007-08-21 23:07:10 +04:00
|
|
|
#define IOV_MAX (1024)
|
2002-07-12 00:39:30 +04:00
|
|
|
#define FILESIZEBITS (64)
|
2010-01-14 18:23:28 +03:00
|
|
|
#define HOST_NAME_MAX (255)
|
2008-02-02 20:32:01 +03:00
|
|
|
#define LINE_MAX (2048)
|
2002-07-12 00:39:30 +04:00
|
|
|
#define LINK_MAX (1)
|
2008-02-02 20:32:01 +03:00
|
|
|
#define LOGIN_NAME_MAX (32)
|
2002-07-12 00:39:30 +04:00
|
|
|
#define MAX_CANON (255)
|
|
|
|
#define MAX_INPUT (255)
|
|
|
|
#define NAME_MAX (256)
|
|
|
|
#define NGROUPS_MAX (32)
|
|
|
|
#define OPEN_MAX (128)
|
|
|
|
#define PATH_MAX (1024)
|
2017-04-19 18:52:28 +03:00
|
|
|
#define PIPE_BUF (4 * 1024)
|
2002-07-12 00:39:30 +04:00
|
|
|
#define PIPE_MAX (512)
|
2021-08-24 19:38:25 +03:00
|
|
|
#define PTHREAD_KEYS_MAX (256)
|
2017-04-13 22:14:41 +03:00
|
|
|
#define PTHREAD_STACK_MIN (2 * PAGESIZE)
|
2021-08-24 19:38:25 +03:00
|
|
|
#define PTHREAD_DESTRUCTOR_ITERATIONS (4)
|
2009-11-24 22:44:07 +03:00
|
|
|
#define SSIZE_MAX __HAIKU_SADDR_MAX
|
2002-07-12 00:39:30 +04:00
|
|
|
#define TTY_NAME_MAX (256)
|
|
|
|
#define TZNAME_MAX (32)
|
2006-06-21 17:49:16 +04:00
|
|
|
#define SYMLINK_MAX (1024)
|
|
|
|
#define SYMLOOP_MAX (16)
|
2002-07-12 00:39:30 +04:00
|
|
|
|
2020-08-01 11:41:42 +03:00
|
|
|
#define _POSIX_ARG_MAX (128 * 1024)
|
2002-07-12 00:39:30 +04:00
|
|
|
#define _POSIX_CHILD_MAX (1024)
|
2010-01-14 18:23:28 +03:00
|
|
|
#define _POSIX_HOST_NAME_MAX (255)
|
2002-07-12 00:39:30 +04:00
|
|
|
#define _POSIX_LINK_MAX (1)
|
2008-02-02 20:32:01 +03:00
|
|
|
#define _POSIX_LOGIN_NAME_MAX (9)
|
2002-07-12 00:39:30 +04:00
|
|
|
#define _POSIX_MAX_CANON (255)
|
|
|
|
#define _POSIX_MAX_INPUT (255)
|
2009-11-24 22:44:07 +03:00
|
|
|
#define _POSIX_NAME_MAX (255)
|
|
|
|
#define _POSIX_NGROUPS_MAX (8)
|
2002-07-12 00:39:30 +04:00
|
|
|
#define _POSIX_OPEN_MAX (128)
|
|
|
|
#define _POSIX_PATH_MAX (1024)
|
2009-11-24 22:44:07 +03:00
|
|
|
#define _POSIX_PIPE_BUF (512)
|
|
|
|
#define _POSIX_SSIZE_MAX __HAIKU_SADDR_MAX
|
2002-07-12 00:39:30 +04:00
|
|
|
#define _POSIX_STREAM_MAX (8)
|
|
|
|
#define _POSIX_TTY_NAME_MAX (256)
|
|
|
|
#define _POSIX_TZNAME_MAX (3)
|
2011-06-12 04:00:23 +04:00
|
|
|
#define _POSIX_SEM_VALUE_MAX INT_MAX
|
|
|
|
#define _POSIX_SIGQUEUE_MAX 32
|
|
|
|
#define _POSIX_RTSIG_MAX 8
|
|
|
|
#define _POSIX_CLOCKRES_MIN 20000000
|
|
|
|
#define _POSIX_TIMER_MAX 32
|
|
|
|
#define _POSIX_DELAYTIMER_MAX 32
|
2017-04-16 14:48:45 +03:00
|
|
|
#define _POSIX_SEM_NSEMS_MAX (256)
|
2002-07-12 00:39:30 +04:00
|
|
|
|
2008-02-02 20:32:01 +03:00
|
|
|
#define _POSIX2_LINE_MAX (2048)
|
|
|
|
|
2021-08-24 19:38:25 +03:00
|
|
|
#define BC_BASE_MAX (99)
|
|
|
|
#define BC_DIM_MAX (2048)
|
|
|
|
#define BC_SCALE_MAX (99)
|
|
|
|
#define BC_STRING_MAX (1000)
|
|
|
|
|
|
|
|
|
|
|
|
#define COLL_WEIGHTS_MAX (10)
|
|
|
|
#define EXPR_NEST_MAX (32)
|
|
|
|
#define LINE_MAX (2048)
|
|
|
|
|
|
|
|
#define MQ_OPEN_MAX (0) /* MSG */
|
|
|
|
#define MQ_PRIO_MAX (0) /* MSG */
|
|
|
|
|
|
|
|
#define RE_DUP_MAX (255) /* for conformance, redefined in regex.h */
|
|
|
|
|
libroot: add [gs]etpriority implementation
Implemented against POSIX-1.2013.
The implementation POSIX requirement thats setpriority() shall affect the
priority of all system scope threads only extends to POSIX threads. This
is implemented by modifying the default attributes for newly spawned
pthreads.
It is not possible to modify the default pthread attributes for different
processes with the current implementation, as default pthread attributes
are implemented in user-space. As a result, PRIO_PROCESS for which and 0
for who is the only supported combination for setpriority().
While it is possible to move the default attributes to the kernel, it
is chosen not to so as to keep the pthread implementation user-space only.
POSIX requires that lowering the nice value (increasing priority) can be
done only by processes with appropriate privileges. However, as Haiku
currently doesn't harbor any restrictions in setting the thread priority,
this is not implemented.
It is possible to have small precision errors when converting from Unix-
style thread priority to Be-style. For example, the following program
outputs "17" instead of the expected "18":
#include <stdio.h>
#include <sys/resource.h>
int
main()
{
setpriority(PRIO_PROCESS, 0, 18);
printf("%d\n", getpriority(PRIO_PROCESS, 0));
return 0;
}
The underlying reason is because when you setpriority() both 18 and 19
are converted to the Be-style "2". This problem should not happen with
priority levels lower than or equal to 20, when the Be notation is more
precise than the Unix-style.
Done as a part of GCI 2014. Fixes #2817.
Signed-off-by: Timothy Gu <timothygu99@gmail.com>
Co-authored-by: Leorize <leorize+oss@disroot.org>
Change-Id: Ie14f105b00fe8563d16b3562748e1c2e56c873a6
Reviewed-on: https://review.haiku-os.org/c/78
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2019-01-09 05:26:42 +03:00
|
|
|
#ifdef _XOPEN_SOURCE
|
2017-04-13 22:14:41 +03:00
|
|
|
/* The XSI name for PAGESIZE, with extra underscore included. Only define if
|
|
|
|
* _XOPEN_SOURCE was requested, otherwise it could conflict with the application.
|
|
|
|
*/
|
|
|
|
#define PAGE_SIZE PAGESIZE
|
libroot: add [gs]etpriority implementation
Implemented against POSIX-1.2013.
The implementation POSIX requirement thats setpriority() shall affect the
priority of all system scope threads only extends to POSIX threads. This
is implemented by modifying the default attributes for newly spawned
pthreads.
It is not possible to modify the default pthread attributes for different
processes with the current implementation, as default pthread attributes
are implemented in user-space. As a result, PRIO_PROCESS for which and 0
for who is the only supported combination for setpriority().
While it is possible to move the default attributes to the kernel, it
is chosen not to so as to keep the pthread implementation user-space only.
POSIX requires that lowering the nice value (increasing priority) can be
done only by processes with appropriate privileges. However, as Haiku
currently doesn't harbor any restrictions in setting the thread priority,
this is not implemented.
It is possible to have small precision errors when converting from Unix-
style thread priority to Be-style. For example, the following program
outputs "17" instead of the expected "18":
#include <stdio.h>
#include <sys/resource.h>
int
main()
{
setpriority(PRIO_PROCESS, 0, 18);
printf("%d\n", getpriority(PRIO_PROCESS, 0));
return 0;
}
The underlying reason is because when you setpriority() both 18 and 19
are converted to the Be-style "2". This problem should not happen with
priority levels lower than or equal to 20, when the Be notation is more
precise than the Unix-style.
Done as a part of GCI 2014. Fixes #2817.
Signed-off-by: Timothy Gu <timothygu99@gmail.com>
Co-authored-by: Leorize <leorize+oss@disroot.org>
Change-Id: Ie14f105b00fe8563d16b3562748e1c2e56c873a6
Reviewed-on: https://review.haiku-os.org/c/78
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2019-01-09 05:26:42 +03:00
|
|
|
/* XSI extension: Default process priority. This is used by the implementation
|
|
|
|
* of getpriority(), setpriority() and nice(). */
|
|
|
|
#define NZERO 20
|
2017-04-13 22:14:41 +03:00
|
|
|
#endif
|
|
|
|
|
2012-02-27 01:38:37 +04:00
|
|
|
/* _GCC_LIMITS_H_ is defined by GCC's internal limits.h to avoid
|
|
|
|
* collisions with any defines in this file.
|
|
|
|
*/
|
|
|
|
#ifndef _GCC_LIMITS_H_
|
|
|
|
# include_next <limits.h>
|
|
|
|
#endif
|
|
|
|
|
2005-11-09 21:01:16 +03:00
|
|
|
#endif /* _LIBC_LIMITS_H_ */
|