stat fails HP unix


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users stat fails HP unix
# 1  
Old 10-10-2008
MySQL stat fails HP unix

Hi all,

I have scenario here , In my C program i check the stat for a file as
stat(fname, &stat_buf);

If it is succesfull, i will process else i will make my program to fail.

The file which i am checking has no stat information. What might be the reason, file has no stat information even though it has all data loaded

I am using HP unix

(sys05Smilienmx:/pmx/d4>) ll 173_i.001
-rw-rw-rw- 1 pmx00 pmx 4941517719 Oct 6 13:37 173_i.001



(sys05Smilienmx:/pmx/d4>)stat 173_i.001
Can't lstat 100373_ipd.001



Please help, stat is working for all other files , only for this file it is not working what might be the reason.

Thanks in Advance,
Arun
# 2  
Old 10-10-2008
The stat() function call returns -1 on error. Are you checking the return code?
Then finding what errno references to produce a meaningful error message?
perror() will do that for you.

lstat() works on symlinks only -- you aren't calling lstat? Even though your error message says so.

These are the two calls you should be using. stat() is a much more likely choice.
Code:
int stat(const char *path, struct stat *buf);
int fstat(int filesdes, struct stat *buf);

# 3  
Old 10-10-2008
This is my Code

ret = stat(fname, &stat_buf);
if (ret == 0)
return &stat_buf;
else
{
fprintf(stderr,"stat: Can't get filesystem information\n");
fprintf(stderr,"stat: Current file %s\n", fname);
perror("stat");
abort();
}


The below is the error

stat: Can't get filesystem information
stat: Current file /pmx/d4/173_i.001
stat: Value too large to be stored in data type
sm_au3[336]: 4740 Abort(coredump)



I am trying to find the stat for a file with size 4.60215 GB , Is it caousing the problem,
I mean the file size is a problem ???

Thanks in Advance,
Arun
# 4  
Old 10-10-2008
You have a largefiles problem. Base stat has a size_t st.size element. It can handle up to the max un unsigned loing value can store.

If the output of this:
Code:
getconf ULONG_MAX

is less than the size of the file then that is your problem. You will have to do some reading on large files for your system - there may be a stat64 or fstat64 call which will handle the issue. What OS?
# 5  
Old 10-10-2008
Thanks for your answer

This is in HP UNIX
# 6  
Old 10-10-2008
Then you do have stat64(), fopen64() etc.

man stat64 will explain it.
# 7  
Old 10-11-2008
Do a Web search for LFS (Large File Summit) for more information about file size limitations on ILP32 data models and how this problem was overcome.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Stat value changes

Die to what all operations, the "Modify" and "Change" values of stat output changes for a file. I found, during editing a file, Change and Modify alters. When chmod'ing Change alters, while Modify doesnot alters. Is there more situations where these changes? (1 Reply)
Discussion started by: anil510
1 Replies

2. UNIX for Dummies Questions & Answers

stat output

hi guys i got confused about stat output stat manual says File : Size in Bytes Blocks : Number of blocks used IO Block : Size in bytes of every block. when i use stat command for passwd file it says ~#stat /etc/passwd File: `/etc/passwd' Size: 999 Blocks: 8 IO... (4 Replies)
Discussion started by: mhs
4 Replies

3. UNIX for Dummies Questions & Answers

read fails in Unix, but succeeds in Linux. Why?

Hi, When I use "read" to parse the sftp command sent via ptty, I ran into a very mysterious case below: --- In Unix, the command ‘quit' is lost. === Fri 13Apr12 15:42:47GMT-sftp_send_command: SENT Fri 13Apr12 15:42:47GMT-sftp_read_resp_line: Parse buffer=quit^M --> Command sent correctly... (2 Replies)
Discussion started by: HgHK
2 Replies

4. Shell Programming and Scripting

hp-unix stat command to get last change date of file

I'm on hp-unix. I would like a variable to hold the last change date of a file. I looked at the man pages for stat, but I don't see any examples and can't get the syntax right. Can anyone help me? Thank you. (2 Replies)
Discussion started by: sboxtops
2 Replies

5. Programming

Parsing unix STAT structure

Hi I am creating a utility which needs to create a log file under the path represented by an environment variable. The condition is that this path must be a valid DIRECTORY PATH. So i need to determine that the path is indeed a VALID DIRECTORY PATH. I have written a function which will return... (2 Replies)
Discussion started by: skyineyes
2 Replies

6. Programming

Q with stat()

From reading various articles on the net, I know stat() is used on files to get things like permissions, sizes etc... As a folder is a special type of file in Unix, I assumed that stat() could work on it as well as any general file. However, from running my program, perror() reported that the... (3 Replies)
Discussion started by: JamesGoh
3 Replies

7. UNIX for Advanced & Expert Users

stat

the output of stat command is Size: 238 Blocks: 8 IO Block: 4096 regular file Device: 80ah/2058d Inode: 736783 Links: 1 Access: (0664/-rw-rw-r--) Uid: ( 500/ gajju) Gid: ( 500/ gajju) Access: 2008-09-08 20:00:15.000000000 +0530 Modify: 2008-09-08... (6 Replies)
Discussion started by: gajju
6 Replies

8. UNIX for Dummies Questions & Answers

Cannot stat?

Hi! I ran into a problem with a job I'm running. All it is doing is a "touch" on a filename. However, when I ran the job, it error'd out and got the message 'cannot stat'. When I restarted the job (making no changes) it worked just fine. Anyone know what this means? (1 Reply)
Discussion started by: lgardner
1 Replies

9. Shell Programming and Scripting

stat command

how can ư use "stat command"????.. (2 Replies)
Discussion started by: emreatlier
2 Replies

10. Programming

stat() fails!!! what can i do?

Hi all, I can not understand why my stat() function fails all the time when function tries to go recursevly. Someone suggested that it might be poiter problem. Please, look up my code at: www.donnelly.cc.ks.us/readdir_test.c. How can i solve this problem? Any suggestion are welcome! Thank you... (3 Replies)
Discussion started by: solvman
3 Replies
Login or Register to Ask a Question