Re: #include <unistd.h> header in kernel ?
Cliff Frey <[email protected]> Sun, 25 Aug 2013 17:23:58 -0700
| Newsgroups | gmane.network.routing.click |
|---|---|
| Message-ID | <CAFtVOq=Pgsd2UT5891c+7bPP4rQqvP6yD6WYaRg1QBwrG-UqNw@mail.gmail.com> |
You cannot use unistd.h (or any other standard userlevel headers) in the kernel. Whatever you are trying to do must be done in a different way. Specifically you cannot use getpid(). What do you want/need getpid for? Cliff On Sun, Aug 25, 2013 at 1:35 PM, ndritsos <[email protected]> wrote: > Hello everyone , > > i have created an element that uses the library unistd.h, and in the > user level it works fine . > Now i'm working in kernel level , and it doesn't work. > > in kernel level i have imported : > > #include <linux/unistd.h> > > and i have this compile time error: > --- > In file included from > /home/dritsos/click/linuxmodule/../elements/local/ndritso.cc:23:0: > /home/dritsos/click/include/click-linuxmodule/include2/linux/unistd.h:5:3: > error: #error "missing #include <click/cxxprotect.h>" > In file included from > /home/dritsos/click/include/click-linuxmodule/include2/linux/unistd.h:12:0, > from > /home/dritsos/click/linuxmodule/../elements/local/ndritso.cc:23: > /home/dritsos/click/include/click-linuxmodule/include0/asm/unistd.h:4:3: > error: #error "missing #include <click/cxxprotect.h>" > In file included from > /home/dritsos/click/include/click-linuxmodule/include0/asm/unistd.h:8:0, > from > /home/dritsos/click/include/click-linuxmodule/include2/linux/unistd.h:12, > from /home/dritsos/click/linuxmodule/../elements/local/ndritso.cc:23: > /home/dritsos/click/include/click-linuxmodule/include0/asm/unistd_32.h:5:3: > error: #error "missing #include <click/cxxprotect.h>" > /home/dritsos/click/linuxmodule/../elements/local/ndritso.cc: In member > function 'virtual int NdritsoElement::initialize(ErrorHandler*)': > /home/dritsos/click/linuxmodule/../elements/local/ndritso.cc:59:8: > error: 'getpid' was not declared in this scope > make[3]: *** [/home/dritsos/click/linuxmodule/ndritso.o] Error 1 > make[2]: *** [_module_/home/dritsos/click/linuxmodule] Error 2 > make[2]: Leaving directory `/usr/src/linux-headers-3.0.0-12-generic' > make[1]: *** [all] Error 2 > make[1]: Leaving directory `/home/dritsos/click/linuxmodule' > make: *** [install-linuxmodule] Error 2 > > > --- > > > Any idea how i can fix this error?? > > thanks in advance > _______________________________________________ > click mailing list > [email protected] > https://amsterdam.lcs.mit.edu/mailman/listinfo/click >