Re: Max string size of filePath+filenName

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Much better: pathconf(3). Use _PC_PATH_MAX and
_PC_NAME_MAX:

#include <unistd.h>
int GetMaxPath(void)
   {
   int						len;
   
   len=pathconf("/",_PC_PATH_MAX);
   return len;
   }

int GetMaxName(void)
{
   int						len;
   
	len=pathconf("/",_PC_NAME_MAX);
	return len;
}

--- nitin ahuja <nitin2ahuja@xxxxxxxxxxxxx> wrote:
> 
> Hi People,
> 
> >
> > When a user tries to open a file using the open()
> > function from user space, what is the max size of
> > "path to the file" + "Name of the file".  Does the
> > kernel have a say in the max size, if so, how can
> I
> > find this limit.  Can I "cat" any of the /proc
> file     > to find this limit.
> >
> 
> You can find this in /usr/include/linux/limits.h
> 
> #define NAME_MAX 255  /* # chars in a file name */
> #define PATH_MAX 4096 /* # chars in a path name
> including nul */
> 
> nitin
> 
> 
> 
> --
> Kernelnewbies: Help each other learn about the Linux
> kernel.
> Archive:      
> http://mail.nl.linux.org/kernelnewbies/
> FAQ:           http://kernelnewbies.org/faq/
> 
> 


		
__________________________________ 
Yahoo! Messenger 
Show us what our next emoticon should look like. Join the fun. 
http://www.advision.webevents.yahoo.com/emoticontest

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux