Skip to content

Commit 8c0aecd

Browse files
committed
sysconf: move to lkmc
1 parent bb3e3a8 commit 8c0aecd

File tree

1 file changed

+2
-27
lines changed

1 file changed

+2
-27
lines changed

posix/main.c

Lines changed: 2 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -947,14 +947,12 @@ int main(void) {
947947
948948
This header exists in ANSI C, and POSIX extends it with several values.
949949
950-
Defines current and possible maximuns, minimums for several resources.
950+
Defines current and possible maximums and minimums for several resources.
951951
952952
Some resources cannot cannot be evaluated statically.
953953
954954
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.
958956
959957
In those cases, limits defines a KEY value which can be passed to a function that gets
960958
the actual values for a given key, for example pathconf or sysconf.
@@ -973,17 +971,6 @@ int main(void) {
973971
}
974972

975973
/*
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-
987974
# maximum path length
988975
989976
This is needed often when you need to deal with paths names.
@@ -997,19 +984,7 @@ int main(void) {
997984
998985
As a consequence of this, it does not make sense to have a macro constant and use it to create
999986
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));
1007987
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-
/*
1013988
# pathconf
1014989
1015990
Similar to sysconf, but for parameters that depend on a path, such as maxium filename lengths.

0 commit comments

Comments
 (0)