From: hlu@phys1.physics.wsu.edu (Hongjiu Lu) Subject: Re: Problems with extfs (a way to find the max file name length) Date: 2 Aug 1992 22:17:51 GMT
That is a very good idea. POSIX has functions
long pathconf(const char *path, int name);
long fpathconf(int fildes, int name);
The problem is it is not very easy to know how long the filename can be.
I wish stat could give me some info. Only thing I can think of now is
1. create a file with very long filename (300 chars)
2. find out how many chars are valid.
3. delete the file and return that number.
But, I think that is not very nice.
-- H.J. Gcc/libc maintainer for Linux.In article <Aug.2.15.20.25.1992.25614@dumas.rutgers.edu>, hedrick@dumas.rutgers.edu (Charles Hedrick) writes: |> I think it probably is a good idea to supply a way to find the maximum |> file name size on a file system. For most programs it doesn't matter, |> but programs that tack on a suffix would like to make sure that the |> new name is really different from the old. Otherwise foo~ or foo.Z |> overwrite foo, This is an issue that SVr4 also has to deal with, since |> they also have multiple file types, both sys5 -- with short names, and |> ufs -- with long names. Why not do it compatibly? Implement statvfs. |> One of the fields it returns is f_namemax, the maximum file name size |> for the file system.