@@ -947,14 +947,12 @@ int main(void) {
947
947
948
948
This header exists in ANSI C, and POSIX extends it with several values.
949
949
950
- Defines current and possible maximuns, minimums for several resources.
950
+ Defines current and possible maximums and minimums for several resources.
951
951
952
952
Some resources cannot cannot be evaluated statically.
953
953
954
954
For example the maximum path length depends on which directory we are talking about,
955
- since diferent directories can be on differnet mount points.
956
-
957
- Also some resources can change maximum values at anytime while the program is executing.
955
+ since different directories can be on different mount points.
958
956
959
957
In those cases, limits defines a KEY value which can be passed to a function that gets
960
958
the actual values for a given key, for example pathconf or sysconf.
@@ -973,17 +971,6 @@ int main(void) {
973
971
}
974
972
975
973
/*
976
- # sysconf
977
-
978
- Get lots of info on the system configuration
979
-
980
- Meanings for the constants can be found under
981
- the `limits.h` and `unistd.h` corresponding variables
982
-
983
- If the value can be negative, it is necessary to check errno changes for error.
984
-
985
- It seems
986
-
987
974
# maximum path length
988
975
989
976
This is needed often when you need to deal with paths names.
@@ -997,19 +984,7 @@ int main(void) {
997
984
998
985
As a consequence of this, it does not make sense to have a macro constant and use it to create
999
986
fixed variable arrays: a function is needed, and memory must be allocated with malloc.
1000
- */
1001
- {
1002
- /* Number of processors: */
1003
- printf ("_SC_NPROCESSORS_ONLN = %ld\n" , sysconf (_SC_NPROCESSORS_ONLN ));
1004
-
1005
- /* Maximum lengh of command line arguments + environment variables: */
1006
- printf ("_SC_ARG_MAX (MiB) = %ld\n" , sysconf (_SC_ARG_MAX ) / (1 << 20 ));
1007
987
1008
- /* TODO find the number of processors / cpus / cores: not possible without glibc extension? */
1009
- /* http://stackoverflow.com/questions/2693948/how-do-i-retrieve-the-number-of-processors-on-c-linux */
1010
- }
1011
-
1012
- /*
1013
988
# pathconf
1014
989
1015
990
Similar to sysconf, but for parameters that depend on a path, such as maxium filename lengths.
0 commit comments