Find the answer to your Linux question:
Results 1 to 2 of 2
I am using errno (global variable) in my socket.c file of the kernel and have also include <bits/errno.h> file and also define Extern int errno in the socket.c file. I ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Dec 2011
    Posts
    29

    undefined reference to errno


    I am using errno (global variable) in my socket.c file of the kernel
    and have also include <bits/errno.h> file and also define Extern int errno in the socket.c file. I have done this to check out the errors which are received when a client and server are running ....
    To include the changes which i have made in the socket.c file i am compiling the kernel. But it is giving me error as
    Undefined reference to errno

    So, anyone please help me out..

  2. #2
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, in Chicago, or in a galaxy far, far away.
    Posts
    11,448
    As far as I know, the errno variable is NOT defined in the kernel. The errno.h files simply contain the error macro values, such as EBADF, etc. You will need to implement and set/read your own variable inside your kernel module(s). Some modules use error, and others use things like si_errno, etc. Also, some are ints and others are uint32 variables. Using an int is preferred, since there are times (not too common) when you may want to set a negative value for an error.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •