Results 1 to 2 of 2
can anyone please help me out to find out how perror actually works???
In my client.c program i am receiving one error
send: Bad file decriptor
this is printed by ...
- 12-25-2011 #1Just Joined!
- Join Date
- Dec 2011
- Posts
- 29
detailed working of perror
can anyone please help me out to find out how perror actually works???
In my client.c program i am receiving one error
send: Bad file decriptor
this is printed by perror
as the errno variable is set to 9 which is EBADF
but i want to know from which file does perror seeks or maps this error??
Or more properly how does the kernel maintains the error logs from where the perror prints the latest error.
Please do reply as soon as possible.
- 12-25-2011 #2Linux Guru
- Join Date
- Apr 2009
- Location
- I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
- Posts
- 8,970
perror() simply takes the current errno value and output some sort of sensible string. It has nothing to do with error logs, and you are responsible for mapping the error to the file that caused it. Also, EBADF is a bad file descriptor error code, so perror() is simply telling you what you already know...
From the man page for errno:
Code:EBADF Bad file descriptor (POSIX.1) EBADFD File descriptor in bad stateSometimes, real fast is almost as good as real time.
Just remember, Semper Gumbi - always be flexible!


Reply With Quote