-1

I am a student who is new to the world of Linux and C. I am doing a bit of kernel programming, but I don't know how to import sys.c, since it's not in the include directory.

Specifically, I need it to use the getrusage function within my code. Is it possible/ok to include it, and if so how?

Ramsey Alsheikh
  • 179
  • 1
  • 1
  • 7
  • You don't normally include `.c` files. If you're looking for the linux development headers, you can normally find these at `/usr/src/linux-headers{some version name}` - but if you're actually doing kernel development you're probably trying to compile a modified linux kernel, in which case it wouldn't make sense to do that. Can you elaborate what exactly you're trying to do? – Cubic Jun 20 '19 at 14:24
  • Are you trying to build a module you can load into an existing kernel, or are you building a whole new kernel from scratch? – Steve Summit Jun 20 '19 at 14:50

1 Answers1

1

You have to include include/linux/resource.h file where the declaration of the function resides. In this case should not include the .c file where you have the definition of the function. Read about #including .c file here

Christina Jacob
  • 665
  • 5
  • 17