L
linux.lover
hello,
I have defined kernel data structure in LINUX kernel source code
and written linked list functionalities in kernel source file. My data
structure is
struct node {
char index[8];
char str1[8];
struct node *next;
};
this linked list has 2 fields in which one used to index.
I am writing to linked list via new system call implemented
void write_ll(char *buf,char *fn)
which writes to it in kernel as with ptr is linked list object
strncpy(ptr->str1,buf,8);
strcpy(ptr->index,fn);
printk(KERN_INFO " in ptr =%s\n",ptr->str1);
if i send kernel to write to linked list field str1 "XYZDEFGH" (only
always 8 bytes are sending) which it receives same when i try to print
in kernel but when i try to read that i got results as
XYZDEFGH ��?&
I am reading linked list with code in user space
char *out;
out=(char*)malloc(8);
memset(out,'\0',8);
out=display_ll(out,index);
where code for display_ll in kernel is
strcpy(out,ptr->str1);
return out;
I have defined kernel data structure in LINUX kernel source code
and written linked list functionalities in kernel source file. My data
structure is
struct node {
char index[8];
char str1[8];
struct node *next;
};
this linked list has 2 fields in which one used to index.
I am writing to linked list via new system call implemented
void write_ll(char *buf,char *fn)
which writes to it in kernel as with ptr is linked list object
strncpy(ptr->str1,buf,8);
strcpy(ptr->index,fn);
printk(KERN_INFO " in ptr =%s\n",ptr->str1);
if i send kernel to write to linked list field str1 "XYZDEFGH" (only
always 8 bytes are sending) which it receives same when i try to print
in kernel but when i try to read that i got results as
XYZDEFGH ��?&
I am reading linked list with code in user space
char *out;
out=(char*)malloc(8);
memset(out,'\0',8);
out=display_ll(out,index);
where code for display_ll in kernel is
strcpy(out,ptr->str1);
return out;