Re: Then there's PATH_MAX

Liste des GroupesRevenir à col advocacy 
Sujet : Re: Then there's PATH_MAX
De : OFeem1987 (at) *nospam* teleworm.us (Chris Ahlstrom)
Groupes : comp.os.linux.advocacy
Date : 10. Dec 2024, 14:46:30
Autres entêtes
Organisation : None
Message-ID : <vj9gnm$vomi$1@dont-email.me>
References : 1 2
User-Agent : slrn/1.0.3 (Linux)
Farley Flud wrote this post while blinking in Morse code:

On Mon, 09 Dec 2024 06:09:40 +0000, vallor wrote:
>
#include <stdio.h>
#include <limits.h>
 
#ifdef __linux__
#include <linux/limits.h>
#endif
 
int main (void)
{
printf("%d\n",PATH_MAX);
return 0;
}
>
This is bullshit.
>
PATH_MAX is filesystem dependent and since GNU/Linux, unlike that
pile of garbage Microslop, supports many, many different filesystems
the PATH_MAX macro is unreliable and may be undefined on some machines.

According to Kerrisk's Linux API book, PATH_MAX has a minimum value of
255, and is named _PC_PATH_MAX by pathconf()/sysconf(). NAME_MAX has a
minimum value of 14. These values are somewhat unrealistic.

You can check out all the values defined:

    $ getconf -a &> variables.text

Here are a few:

    NAME_MAX                           255
    _POSIX_NAME_MAX                    255
    PATH_MAX                           4096
    _POSIX_PATH_MAX                    4096
    ARG_MAX                            2097152
    PAGESIZE                           4096
    PAGE_SIZE                          4096

The best and only way to determine file name/path parameters is to
use "pathconf" of "fpathconf:"
                 ^^ or
>
https://pubs.opengroup.org/onlinepubs/9799919799/
>
From the link:
>
"The pathconf() function was proposed immediately after the sysconf()
function when it was realized that some configurable values may differ
across file system, directory, or device boundaries."

Note that the values provided by pathconf() or fpathconf() can change
over the lifetime of a process (e.g. when a different filesystem is mounted).

Anyway, for my application(s), including those running on Windows, I treat
PATH_MAX as a defining limit. We don't need no funking long pathnames!

--
!netgod:*! time flies when youre using linux
!doogie:*! yeah, infinite loops in 5 seconds.
!Teknix:*! has anyone re-tested that with 2.2.x ?
!netgod:*! yeah, 4 seconds now

Date Sujet#  Auteur
9 Dec 24 * Then there's PATH_MAX13vallor
9 Dec 24 +- Re: Then there's PATH_MAX1Chris Ahlstrom
10 Dec 24 +* Re: Then there's PATH_MAX5DFS
10 Dec 24 i`* Re: Then there's PATH_MAX4Lawrence D'Oliveiro
10 Dec 24 i +- Re: Then there's PATH_MAX1vallor
10 Dec 24 i +- Re: Then there's PATH_MAX1Chris Ahlstrom
11 Dec 24 i `- Re: Then there's PATH_MAX1DFS
10 Dec 24 `* Re: Then there's PATH_MAX6Farley Flud
10 Dec 24  +- Re: Then there's PATH_MAX1Chris Ahlstrom
10 Dec 24  `* Fine, let's see you using pathconf(3) on Windows (was: Re: Then there's PATH_MAX)4vallor
10 Dec 24   `* Re: Fine, let's see you using pathconf(3) on Windows (was: Re: Then there's PATH_MAX)3Farley Flud
10 Dec 24    `* Re: Fine, let's see you using pathconf(3) on Windows (was: Re: Then there's PATH_MAX)2vallor
11 Dec 24     `- Re: Fine, let's see you using pathconf(3) on Windows (was: Re: Then there's PATH_MAX)1vallor

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal