LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 12-29-2010, 03:56 AM   #1
nil_fergi
LQ Newbie
 
Registered: May 2009
Posts: 12

Rep: Reputation: 0
Problem with stat on cifs.


Hi,

i have Ubuntu10.10 (kernel-2.6.35-22-generic) installed.

struct stat StatBuff;

Example1:
iRet = stat("/mnt/win/data", &Statuff);
if (-1 == iRet)
{
perror("statfail");
}

Example2:
pDir = opendir("/mnt/win/data");
if (NULL != pDir)
{
if ((dp = readdir(pDir)) != NULL)
{
iRet = stat(dp->d_name, &StatBuff);
if (-1 == iRet)
{
perror("statfail");
}
}
}

I have mounted a windows share folder on /mnt. When i gave any directory within /mnt/ to stat function it fails with errorno 75. perror shows "Value too large for defined data type".

Example 1 is fail but Example 2 works fine.
Can any one tell me meanning of error or why Example 1 gets fail here?

Please help me. Its urgent.
 
Old 12-29-2010, 11:33 AM   #2
redhatstand
Member
 
Registered: Jul 2006
Location: Oxford, UK
Distribution: CentOS, Ubuntu
Posts: 37

Rep: Reputation: 7
Hi,

Maybe the following would be of use:

https://bugs.launchpad.net/ubuntu/+s...ts/+bug/455122

Especially if your dev environment is i386

Andy T
 
1 members found this post helpful.
Old 12-29-2010, 11:56 AM   #3
redhatstand
Member
 
Registered: Jul 2006
Location: Oxford, UK
Distribution: CentOS, Ubuntu
Posts: 37

Rep: Reputation: 7
Update: I found that by googling:

CIFS "Value too large for defined data type

As a quick fix apparently you can add:

noserverino, nounix

To the CIFS mount options - only a short term fix tho'

Alternatively you could post the code and some context in a bit more detail (I noticed a typo in your listing which would never have compiled...)

If you do, don't forget to wrap it in [code] tags.

Regards,

Andy T
 
1 members found this post helpful.
Old 12-30-2010, 06:01 AM   #4
nil_fergi
LQ Newbie
 
Registered: May 2009
Posts: 12

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by redhatstand View Post
Update: I found that by googling:

CIFS "Value too large for defined data type

As a quick fix apparently you can add:

noserverino, nounix

To the CIFS mount options - only a short term fix tho'

Alternatively you could post the code and some context in a bit more detail (I noticed a typo in your listing which would never have compiled...)

If you do, don't forget to wrap it in [code] tags.

Regards,

Andy T
Hi,

Thanks for reply...with "noserverino, nounix" solved the problem.

Following is the detail code if require:

Code:
Example1:
int main()
{
	int iRet;
	struct stat StatBuff;

	iRet = stat("/mnt/win/data", &StatBuff);
	if (-1 == iRet)
	{
		perror("statfail");
	}

	if ((StatBuff.st_mode & S_IFLNK) == S_IFLNK)
	{
		printf("\nS_IFLNK");
		return 0;
	}

	if ((StatBuff.st_mode & S_IFDIR) == S_IFDIR)
	{
		printf("\nS_IFDIR");
		return 0;
	}

	return 0;
}


Example2:
int main()
{
	int iRet;
	DIR *pDir;
	struct stat StatBuff;
	struct dirent *dp;
	pDir = opendir("/mnt/win/data");
	if (NULL != pDir)
	{
		if ((dp = readdir(pDir)) != NULL)
		{
			iRet = stat(dp->d_name, &StatBuff);
			if (-1 == iRet)
			{
				perror("statfail");
			}
			else
			{
				if ((StatBuff.st_mode & S_IFLNK) == S_IFLNK)
				{
					printf("\nS_IFLNK");
					return 0;
				}

				if ((StatBuff.st_mode & S_IFDIR) == S_IFDIR)
				{
					printf("\nS_IFDIR");
					return 0;
				}
			}
		}
	}

	return 0;
}

Last edited by nil_fergi; 12-30-2010 at 06:08 AM.
 
Old 12-30-2010, 06:35 AM   #5
redhatstand
Member
 
Registered: Jul 2006
Location: Oxford, UK
Distribution: CentOS, Ubuntu
Posts: 37

Rep: Reputation: 7
Excellent, glad I could help.

Since that did appear to fix the problem, that thread goes on to say something about a change in the defaults for gcc and large file support:

You may want to follow the thread as I have no idea what those options do! Hmm, maybe I should have mentioned that more clearly :-)

Regards,

Andy T
 
1 members found this post helpful.
Old 12-30-2010, 10:10 PM   #6
nil_fergi
LQ Newbie
 
Registered: May 2009
Posts: 12

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by redhatstand View Post
Excellent, glad I could help.

Since that did appear to fix the problem, that thread goes on to say something about a change in the defaults for gcc and large file support:

You may want to follow the thread as I have no idea what those options do! Hmm, maybe I should have mentioned that more clearly :-)

Regards,

Andy T
Sir, i gone through the thread but i can't understand it properly. If you explain it in more details that will be helpful for all of us.
 
Old 12-31-2010, 03:37 AM   #7
redhatstand
Member
 
Registered: Jul 2006
Location: Oxford, UK
Distribution: CentOS, Ubuntu
Posts: 37

Rep: Reputation: 7
Hi,

As it happens I am in the midst of a samba / cifs related project:

Mounting with noserverino forces the samba client to generate inode numbers, where without the option the inode numbers would be created by the server.

Looks like the server is generating huge (64 bit) inode numbers, but one or more apps on your system have been compiled without support for that by the distro maintainers.

I have not tried any of the below options as I work exclusively with 64 bit machines and I suspect your client is 32 bit, but:

It may be that you simply need to add -D_FILE_OFFSET_BITS=64 when compiling _your_ app, OR

If the compile problem is with your samba client software, you could try compiling samba-client from source with -D_FILE_OFFSET_BITS=64 as a configure option, OR

Alternatively it looks like this could be fixed by the distro maintainers, so you could just wait.


Looks like the nolinux mentioned was a blind alley, so I would remove that.

Andy T
 
1 members found this post helpful.
Old 01-03-2011, 07:21 AM   #8
nil_fergi
LQ Newbie
 
Registered: May 2009
Posts: 12

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by redhatstand View Post
Hi,

As it happens I am in the midst of a samba / cifs related project:

Mounting with noserverino forces the samba client to generate inode numbers, where without the option the inode numbers would be created by the server.

Looks like the server is generating huge (64 bit) inode numbers, but one or more apps on your system have been compiled without support for that by the distro maintainers.

I have not tried any of the below options as I work exclusively with 64 bit machines and I suspect your client is 32 bit, but:

It may be that you simply need to add -D_FILE_OFFSET_BITS=64 when compiling _your_ app, OR

If the compile problem is with your samba client software, you could try compiling samba-client from source with -D_FILE_OFFSET_BITS=64 as a configure option, OR

Alternatively it looks like this could be fixed by the distro maintainers, so you could just wait.


Looks like the nolinux mentioned was a blind alley, so I would remove that.

Andy T
Thank you sir
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] gcc linker error - hidden symbol `stat' in /usr/lib/libc_nonshared.a(stat.oS) chaosless Linux - Software 1 09-17-2009 12:33 PM
ssh login stat problem avijitp Linux - Software 7 08-07-2007 06:44 PM
sendmail problem stat=User unknown singying304 Linux - Networking 1 10-07-2005 06:59 PM
Linux stat to Windows Stat sridurai Programming 3 09-24-2004 04:07 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 12:34 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration