Operating System - Linux
1828359 Members
3178 Online
109976 Solutions
New Discussion

how to call fstat() with -1 file descriptor.

 
dudekulashameer
Occasional Contributor

how to call fstat() with -1 file descriptor.

Hi All,

Please can you tell me how to proceede with this..
Thanks,
Shammer
4 REPLIES 4
James R. Ferguson
Acclaimed Contributor

Re: how to call fstat() with -1 file descriptor.

Steven Schweda
Honored Contributor

Re: how to call fstat() with -1 file descriptor.

At least one of us seems to be confused.

How do you get a file descriptor of -1,
except as an error indication?

http://docs.hp.com/en/B3921-60631/open.2.html

And if it is only an error indication, what
do you expect to get from fstat()?
Dennis Handly
Acclaimed Contributor

Re: how to call fstat() with -1 file descriptor.

>Steven: At least one of us seems to be confused.

You sure are. :-)

>How do you get a file descriptor of -1, except as an error indication?

That's exactly it. Or you can do "int fd = -1;" dudekulashameer must be writing conformance tests.

>And if it is only an error indication, what do you expect to get from fstat(2)?

An explicit setting of errno, EBADF.
Steven Schweda
Honored Contributor

Re: how to call fstat() with -1 file descriptor.

> dudekulashameer must be writing conformance
> tests.

My psychic powers are admittedly weak.
Much weaker than yours, apparently.