[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Adding syscall to embedded Linux

Posted on 2014-01-27
7
Medium Priority
?
364 Views
Last Modified: 2014-02-15
I'm trying to a new system call to my embedded system, but for some reason I cannot get it to compile.  The new <sys/my_time.h> is always not found.

Essentially I am trying to create a function that will pass back the number of jiffies from the kernel.  I have looked at several post on google, but they do not help to resolve the compilation issue I am having.

My system:
Linux 2.4-8 using uCLibc-0.9.8.

This system is quite particular, so it may be difficult to provide much assistance.  But I have already performed the following steps.  If there is anything that I am missing, please let me know.

1. Added "sys_my_time" to "call.S" (hosting the syscall table).
2. Added "__NR_my_time 257" to unistd.h.
3. Added function implementation to sys.c. (where "times()" has been implemented)
4. Added "my_time.h" file to uclibc/include/sys" directory. (same as "times.h").
5. Added "my_time.c" file to uclibc/libc/sysdeps/linux/common" directory. (same as "times.c")

Thank you.
0
Comment
Question by:sctccomm
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 35

Expert Comment

by:sarabande
ID: 39817085
2. Added "__NR_my_time 257" to unistd.h
generally it is a bad idea to changing system headers. for the the unistd.h it is worse cause the header was include by all library functions of all system and subsystem libraries your compiler provides. you would need to rebuild all these libraries to make sure that your new code could work.

also changes to sys.c  would require to rebuild the system libraries and rebuild the kernel. any update of the system in future would spoil all your work.

Sara
0
 
LVL 86

Expert Comment

by:jkr
ID: 39819844
Apart from different opinions, I'd like to assure you that altering kernel sources for your purpose is absolutely on point (wth the described impact, though), that's what they're meant for, sice you are building your very own kernel. What are the problems you are running into?
0
 

Author Comment

by:sctccomm
ID: 39822047
I have a file that is going to use my new system call, my_time().

But when I include the header file, "#include <sys/my_time.h>", I always get a compilation error saying that my_time.h is not found.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 12

Expert Comment

by:stefan73
ID: 39847263
Hmm, this could also be a permission issue. Did you check these?
0
 
LVL 35

Expert Comment

by:sarabande
ID: 39848150
when I include the header file, "#include <sys/my_time.h>", I always get a compilation error
if the compiler says file not found, it is true.  you may look for the following reasons:

- the 'sys' folder is not available at all

try to include <sys/time.h> instead of <sys/my_time.h>. if the time.h was not found either, the compiler does not have access to its own include folders. check the environment variable 'include'. probably you have to reinstall the compiler such that the system headers could be found.

- you have duplicate include folders

if the time.h was found, but not my_time.h, the sys folder was duplicated somehow and the compiler currently accesses the wrong one. you may search your disks and check environment variables 'include' and 'lib' for wrong paths.

Sara
0
 

Accepted Solution

by:
sctccomm earned 0 total points
ID: 39848193
There is not permission issue.

Also, <sys/times.h>, was included originally and so it does recognize the 'sys' directory.

I have discovered that the my <sys/my_times.h> will most likely never get recognized because it is not a standard file that exists in libc.  Thus, in the file in which I would like <sys/my_times.h> to be included get compiled, <sys/my_times.h> will not get recognized.

The only way for this to work would be to call the syscall() directly using the syscall_table ID.
0
 

Author Closing Comment

by:sctccomm
ID: 39861154
There is no good solution for this issue.  Only to force the system call.
0

Featured Post

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Q&A with Course Creator, Mark Lassoff, on the importance of HTML5 in the career of a modern-day developer.
The goal of this video is to provide viewers with basic examples to understand how to create, access, and change arrays in the C programming language.
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…
Suggested Courses

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question