From: Geoff Clare on 12 Feb 2010 08:37 Maxwell Lol wrote: > Phred Phungus <Phred(a)example.invalid> writes: > >> dan(a)dan-desktop:~$ ls -ld /usr/bin >> drwxr-xr-x 2 root root 36864 2010-02-08 19:24 /usr/bin >> dan(a)dan-desktop:~$ >> >> My next question is how do I determine what the max path is for this >> directory. > > Do you mean maximum pathlength (i.e. a the length of a string needed to hold > the largest file/pathname?) > > There is a constant in the /usr/include files that gives the exact > limit if you are interested. > > > /usr/include/linux/limits.h:#define PATH_MAX 4096 \ > /* # chars in a path name including nul */ It's only defined in limits.h on systems where the value is fixed. If it can vary between file systems then there is no constant defined in limits.h and applications need to get the value using pathconf() or the getconf utility. In any case, typing getconf PATH_MAX /usr/bin seems like less work than hunting through include files. -- Geoff Clare <netnews(a)gclare.org.uk>
From: Janis Papanagnou on 12 Feb 2010 12:53 Maxwell Lol wrote: > Janis Papanagnou <janis_papanagnou(a)hotmail.com> writes: > >>> drwxr-xr-x 2 root root 36864 2010-02-08 19:24 /usr/bin > 4214-14-1 > > or 755 > [ Wrong attribution; I didn't post that.]
From: Maxwell Lol on 13 Feb 2010 19:47 Janis Papanagnou <janis_papanagnou(a)hotmail.com> writes: > Maxwell Lol wrote: >> Janis Papanagnou <janis_papanagnou(a)hotmail.com> writes: >> >>>> drwxr-xr-x 2 root root 36864 2010-02-08 19:24 /usr/bin >> 4214-14-1 >> >> or 755 >> > > [ Wrong attribution; I didn't post that.] Sorry.
From: Maxwell Lol on 13 Feb 2010 19:49 Geoff Clare <geoff(a)clare.See-My-Signature.invalid> writes: > In any case, typing > > getconf PATH_MAX /usr/bin > > seems like less work than hunting through include files. .... assuming you know the name of the variable beforehand. If not, i find that fine find, xargs and grep help.
From: Phred Phungus on 14 Feb 2010 01:13
Maxwell Lol wrote: > Geoff Clare <geoff(a)clare.See-My-Signature.invalid> writes: > >> In any case, typing >> >> getconf PATH_MAX /usr/bin >> >> seems like less work than hunting through include files. > > > ... assuming you know the name of the variable beforehand. > If not, i find that fine find, xargs and grep help. > oh balls. The more I talk about this, the more I think I should hardcode PATH_MAX at 4096. -- Ph |