GIDForums  

Go Back   GIDForums > Computer Programming Forums > OpenGL Programming
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 30-Oct-2008, 21:51
nancycoder nancycoder is offline
New Member
 
Join Date: Oct 2008
Posts: 14
nancycoder is an unknown quantity at this point

Write a kernel code for a new system call


I am a beginner kernel programmer. I need to write a kernel code for a new system call called
int sys_printstr(void *buf);

This system call returns the usual success/failure codes. The buf argument that it gets is an encoded string as follows:
  • the first byte in buf contains the length of the string in bytes
  • the bytes that follow in buf contain the actual string, excluding the terminating null it should correctly printk this encoded string which is passed from user-land.

Any clue/suggestion?

Thanks in advance.
  #2  
Old 21-Jan-2009, 07:36
Mexican Bob's Avatar
Mexican Bob Mexican Bob is offline
Member
 
Join Date: Mar 2008
Location: Chicxulub, Yucatán
Posts: 226
Mexican Bob is a jewel in the roughMexican Bob is a jewel in the roughMexican Bob is a jewel in the rough

Re: Write a kernel code for a new system call


Quote:
Originally Posted by nancycoder
Any clue/suggestion?

Yeah. I'd ask this question in a Linux-specific forum area. This is an OpenGL forum for platform agnostic 2D and 3D graphics processing.

If you're looking for help with the C code needed to implement the function, you may want to try the C programming language forum area.

http://www.gidforums.com/f-41.html

Basically, you will want to cast buf (if not NULL) to an unsigned char* (check your data type names for the actual typename to use). Then you will want to call printk with %s and pass-n-cast the address of buf[1] to a char* if the first byte is not zero.


MxB
 
 

Recent GIDBlogProgramming ebook direct download available by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Can anyone change this program for linux kernel? nancycoder C Programming Language 4 05-Oct-2008 06:52
RedHat Linux memory problem nzmose Computer Software Forum - Linux 1 02-Aug-2008 10:07
Printing problems--->ARG! toddm123 .NET Forum 0 31-Mar-2005 13:51
kernel compiling & Geforce updating crystalattice Computer Software Forum - Linux 5 16-Jun-2004 08:38
Linux Kernel Upgrade Mini Howto dsmith Computer Software Forum - Linux 3 05-Apr-2004 23:10

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 01:59.


vBulletin, Copyright © 2000 - 2009, Jelsoft Enterprises Ltd.