Kernel backup

2014-05-27 Thread Nada Saif
Hi,

I'm working on a project and might do multiple making - I'm afraid if
things go wrong. How to keep a backup of the current kernel?

Thanks
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Kernel backup

2014-05-27 Thread Kristofer Hallin
Before even trying to do any development, I think that you need to
learn about GRUB (or what bootloader you are using) and how to be able
to chose from multiple kernels when booting.

On Tue, May 27, 2014 at 7:56 AM, Nada Saif nada.sa...@gmail.com wrote:
 Hi,

 I'm working on a project and might do multiple making - I'm afraid if things
 go wrong. How to keep a backup of the current kernel?

 Thanks


 ___
 Kernelnewbies mailing list
 Kernelnewbies@kernelnewbies.org
 http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Download Linus's latest git tree

2014-05-27 Thread Anand Moon
Hi All,

You can try following steps to checkout to the latest stable kernel.

# First clone to the current release.
git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
linux-stable
cd linux-stable

# Create local branch stable
git checkout -b stable

# Added a remote git tree to the .git/config using following command.
git remote add stable 
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git

# Now fetch the changes to the current stable release. Will checkout the 
changes to v3.14.y stable.
git fetch stable v3.14.y

# Now this kernel will merge the changes in to stable branch.
git merge FETCH_HEAD

Please share your thoughts on this.

-Anand Moon
 



On Tuesday, May 27, 2014 7:48 AM, valdis.kletni...@vt.edu 
valdis.kletni...@vt.edu wrote:
On Mon, 26 May 2014 15:04:17 -0300, Lucas Tanure said:


 git clone --depth 1 
 git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git

Note that '--depth 1' results in a faster initial download, but it has
a number of disadvatages - you can't clone it into another tree of yours,
nor can you push or pull from it.  And most notably, you can't use it
for a git bisect.

I'd recommend biting the bullet, and doing a full clone (you only have to
do that the first time - the next time, even if you need a new copy of the
tree, you can clone your original for the basis and not have to refetch it).




___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Open and copy a file from the kernel

2014-05-27 Thread Nada Saif
Hi,

I want to process a copy operation from file sent from user space - this
copying should be inside the kernel..

I read about using filp_open , will this help me ?

Thanks,
Nada
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Kernel backup

2014-05-27 Thread Kai Bojens
On 27-05-14 08:56:27, Nada Saif wrote:
 
 I'm working on a project and might do multiple making - I'm afraid if
 things go wrong. How to keep a backup of the current kernel?

Just use the packet management of your distribution to build and install
new kernels. Under normal circumstances you'd then have several kernels
to choose from as the old ones are kept. Your bootmanager also gives you
the opportunity to choose from several different kernels and can fall
back to older version if something goes wrong.

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Open and copy a file from the kernel

2014-05-27 Thread Valdis . Kletnieks
On Tue, 27 May 2014 10:19:37 +0300, Nada Saif said:
 I want to process a copy operation from file sent from user space - this
 copying should be inside the kernel..

Why? What problem are you trying to solve by doing this?  This is almost
certainly a bad design, for a number of reasons.

And there's probably a better way to do what you're trying to accomplish.

 I read about using filp_open , will this help me ?

Probably not.



pgp7KmA4oUE65.pgp
Description: PGP signature
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Open and copy a file from the kernel

2014-05-27 Thread enjoy mindful
how about call_usermodehelper?


On Tue, May 27, 2014 at 3:19 PM, Nada Saif nada.sa...@gmail.com wrote:

 Hi,

 I want to process a copy operation from file sent from user space - this
 copying should be inside the kernel..

 I read about using filp_open , will this help me ?

 Thanks,
 Nada

 ___
 Kernelnewbies mailing list
 Kernelnewbies@kernelnewbies.org
 http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Open and copy a file from the kernel

2014-05-27 Thread Pranay Srivastava
On Tue, May 27, 2014 at 12:49 PM, Nada Saif nada.sa...@gmail.com wrote:
 Hi,

 I want to process a copy operation from file sent from user space - this
 copying should be inside the kernel..

 I read about using filp_open , will this help me ?

I guess you want to open the files inside kernel and then copy from
one to another.

That's just not good. If you are trying to learn something like
passing data from user space to
kernel, you should probably look at sysfs.

Very simple wrappers exist that allow you to create a dummy sysfs
file(s) where you can have your store and show callbacks do the magic
you want to learn.



 Thanks,
 Nada

 ___
 Kernelnewbies mailing list
 Kernelnewbies@kernelnewbies.org
 http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies




-- 
---P.K.S

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Download Linus's latest git tree

2014-05-27 Thread Valdis . Kletnieks
On Tue, 27 May 2014 00:16:52 -0700, Anand Moon said:
 Please share your thoughts on this.

I'd do it slightly differently, by keeping a master copy of Linus's
tree, and a separate tree for the -stable additions (and other separate
trees for linux-next or whatever else you feel like...)

I keep my git trees under /usr/src - feel free to stick them elsewhere if
that makes your workflow or disk management easier. Just remember to fix
any pathnames.. :)

1) Get yourself a copy of Linus's tree, almost same as before:

cd /usr/src
git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git linux

Note we called it 'linux', not 'linux-stable'.  Remember the full path for this
(I keep this one in /usr/src/linux, so that's what I'll use below)

Note - this tree should be updated via this.  The other trees are different

cd /usr/src/linux
git pull

2) Make a clone of that tree to use as 'stable':

cd /usr/src
git clone --local /usr/src/linux linux-stable 

You now have a copy in /usr/src/linux-stable.  Also, *this* clone is
local only, so you don't have to re-fetch Linus's tree.

git remote add stable 
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git
git fetch stable
git fetch --tags stable

This tree you should *NOT* use 'git pull' - use 'git remote update' or
'git fetch v3.specifictag'

3) If you want to get a copy of the linux-next tree as well, it's easy, almost 
the
same workflow:

cd /usr/src/
git clode --local /usr/src/linux linux-next
git remote add linux-next 
git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
git fetch linux-next

(And again, update via 'git remote update' or 'git fetch')

Now the interesting part is that you can do 'git checkout' on all 3 trees
*and they're independent* - so you can (for instance) have 3 different
'git bisects' in different stages of completion.  Or check out the
Linus 3.10 kernel to see how code *used* to be, and the linux-stable
3.14.5 to see how it is *now*, and so on.  Or you can check out the Linus
v3.15-rc7 or the current linux-next, and see what patches *aren't* in
the current linux-stable... or whatever else you feel like doing




pgpW8t1D3lCL6.pgp
Description: PGP signature
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Download Linus's latest git tree

2014-05-27 Thread Anand Moon
Hi Validis,

Thanks for this new approach.

-Anand Moon



On Tuesday, May 27, 2014 2:07 PM, valdis.kletni...@vt.edu 
valdis.kletni...@vt.edu wrote:
On Tue, 27 May 2014 00:16:52 -0700, Anand Moon said:
 Please share your thoughts on this.

I'd do it slightly differently, by keeping a master copy of Linus's
tree, and a separate tree for the -stable additions (and other separate
trees for linux-next or whatever else you feel like...)

I keep my git trees under /usr/src - feel free to stick them elsewhere if
that makes your workflow or disk management easier. Just remember to fix
any pathnames.. :)

1) Get yourself a copy of Linus's tree, almost same as before:

cd /usr/src
git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git linux

Note we called it 'linux', not 'linux-stable'.  Remember the full path for this
(I keep this one in /usr/src/linux, so that's what I'll use below)

Note - this tree should be updated via this.  The other trees are different

cd /usr/src/linux
git pull

2) Make a clone of that tree to use as 'stable':

cd /usr/src
git clone --local /usr/src/linux linux-stable    

You now have a copy in /usr/src/linux-stable.  Also, *this* clone is
local only, so you don't have to re-fetch Linus's tree.




git remote add stable 
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git
git fetch stable
git fetch --tags stable

This tree you should *NOT* use 'git pull' - use 'git remote update' or
'git fetch v3.specifictag'

3) If you want to get a copy of the linux-next tree as well, it's easy, almost 
the
same workflow:

cd /usr/src/
git clode --local /usr/src/linux linux-next
git remote add linux-next 
git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
git fetch linux-next

(And again, update via 'git remote update' or 'git fetch')

Now the interesting part is that you can do 'git checkout' on all 3 trees
*and they're independent* - so you can (for instance) have 3 different
'git bisects' in different stages of completion.  Or check out the
Linus 3.10 kernel to see how code *used* to be, and the linux-stable
3.14.5 to see how it is *now*, and so on.  Or you can check out the Linus
v3.15-rc7 or the current linux-next, and see what patches *aren't* in
the current linux-stable... or whatever else you feel like doing



___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Open and copy a file from the kernel

2014-05-27 Thread Pranay Srivastava
On Tue, May 27, 2014 at 3:05 PM, Nada Saif nada.sa...@gmail.com wrote:
 Hi Srivastava,
 Thanks for your answer.

 I want to make a backup of any opened file.. whenever the file is opened or
 updated , it's reflected on its backup..

Hmm, not really done this but i guess you need inotify hooks and some
sort of user space daemon that hooks those inotify events. I've not
done this but
i know it shouldn't be too hard. Just search for inotify.

What you are trying isn't kernel thing to do, however i guess you are
trying to do something sort of snapshot per change of a file. But
again
since you are not doing this at file system level I won't recommend
doing this inside kernel (opening and copying). Just hook the inotify
events
in the userspace daemon and let it worry about maintaining a separate
version for all files changed.

But if you do this won't you run out of space so soon, plus the files
you'll create will eat up the inodes which really are earlier versions
you are maintaining.
Probably you should come up with a consolidated layout of versions you
are going to save. Maybe what you can do is have diffs of file in a
particular custom format
which can then all be zipped into a version database you can maintain.

Now just think of doing all this inside kernel. See it's a bad idea
and you know it!. You can use scripts to simplify everything. The
search operations within your
database to lookup a particular version, like going from version 3 to
version 8 would require applying diffs which you can easily do in
script.

If you are not doing the above things I said, then my bad. You need to
tell some more about project then maybe I can help.


 Regards

 On May 27, 2014 11:29 AM, Pranay Srivastava pran...@gmail.com wrote:

 On Tue, May 27, 2014 at 12:49 PM, Nada Saif nada.sa...@gmail.com wrote:
  Hi,
 
  I want to process a copy operation from file sent from user space - this
  copying should be inside the kernel..
 
  I read about using filp_open , will this help me ?

 I guess you want to open the files inside kernel and then copy from
 one to another.

 That's just not good. If you are trying to learn something like
 passing data from user space to
 kernel, you should probably look at sysfs.

 Very simple wrappers exist that allow you to create a dummy sysfs
 file(s) where you can have your store and show callbacks do the magic
 you want to learn.


 
  Thanks,
  Nada
 
  ___
  Kernelnewbies mailing list
  Kernelnewbies@kernelnewbies.org
  http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
 



 --
 ---P.K.S



-- 
---P.K.S

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: How to trace the send() in client call

2014-05-27 Thread Robert Clove
Hi Augusto,


But there will be other packets also coming from the network like if some
one is browsing the net on mozilla.
I only want to trace the send() calls that i have used in my code,is that
possible?


Regards



On Tue, May 27, 2014 at 3:49 AM, Augusto Mecking Caringi 
augustocari...@gmail.com wrote:

 On Mon, May 26, 2014 at 1:48 PM, Robert Clove cloverob...@gmail.comwrote:

 Hi All,

 I need your help.
 I have written the client server program in which client is sending the
 packets to the server.
 I want to trace the send() that is used in the client program actually
 want to trace the system call  the packet traverses .
 How to trace ?


 Hi Robert,

 You can use the strace command line tool.

 There is an argument to trace only network related syscalls:

 -e trace=network
Trace all the network related system calls.

 Take a look on the strace manual page for more information.

 Best regards.

 --
 Augusto Mecking Caringi

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Simple Misc Driver - Problem with string copy to user

2014-05-27 Thread Lucas Tanure
Hi!

Goal, when the user do :
# head -1 /dev/miscdrv

The driver prints:  Hello World!

Steps:
# Make
# insmod misc.ko
# head -1 /dev/miscdrv

Why my driver doesn't work ?

What is worg with my read operation?

static ssize_t
misc_drv_read(struct file *filp, char __user * buf, size_t count, loff_t *
offp){
int nbytes;
char * string = hello World;
nbytes = copy_to_user(buf, string, 12);
 return nbytes;
}


--
Lucas Tanure
Brazil


Makefile
Description: Binary data
#include linux/module.h
#include linux/init.h
#include linux/fs.h
#include linux/device.h
#include linux/miscdevice.h
#include linux/uaccess.h	/* copy_(to,from)_user */

#define MYDEV_NAME miscdrv

static ssize_t
misc_drv_read(struct file *filp, char __user * buf, size_t count, loff_t * offp){
int nbytes;
	char * string = hello World;
	nbytes = copy_to_user(buf, string, 12);
	return nbytes;
}

static ssize_t
misc_drv_write(struct file *filp, const char __user * buf, size_t count, loff_t * offp)
{
	return 0;
}

static const struct file_operations misc_drv_fops = {
	.read = misc_drv_read,
	.write = misc_drv_write,
};

static struct miscdevice my_misc_device = {
	.minor = MISC_DYNAMIC_MINOR,
	.name = MYDEV_NAME,
	.fops = misc_drv_fops,
};

static int __init my_init(void){
	dev_info(my_misc_device.this_device, Registering Device\n);
	if (misc_register(my_misc_device)) {
		pr_err(Couldn't register device misc, %d.\n, my_misc_device.minor);
		return -EBUSY;
	}
	return 0;
}

static void __exit my_exit(void)
{
	dev_info(my_misc_device.this_device, Unregistering Device\n);
	misc_deregister(my_misc_device);
}

module_init(my_init);
module_exit(my_exit);

MODULE_AUTHOR(Lucas Tanure);
MODULE_DESCRIPTION(Test Misc Device);
MODULE_LICENSE(GPL v2);
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Simple Misc Driver - Problem with string copy to user

2014-05-27 Thread Bjørn Mork
Lucas Tanure tan...@linux.com writes:

 What is worg with my read operation?

 static ssize_t
 misc_drv_read(struct file *filp, char __user * buf, size_t count, loff_t *
 offp){
 int nbytes;
 char * string = hello World;
 nbytes = copy_to_user(buf, string, 12);
  return nbytes;
 }

copy_to_user returns the number of bytes which could *not* be copied.
So it will return 0 on success, making your read return 0.


Bjørn

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Simple Misc Driver - Problem with string copy to user

2014-05-27 Thread Lucas Tanure
So, My misc_drv_read returns 0, and it's ok. So why the command head didn't
get the string ?

--
Lucas Tanure
+55 (19) 988176559


On Tue, May 27, 2014 at 9:59 AM, Bjørn Mork bj...@mork.no wrote:

 Lucas Tanure tan...@linux.com writes:

  What is worg with my read operation?
 
  static ssize_t
  misc_drv_read(struct file *filp, char __user * buf, size_t count, loff_t
 *
  offp){
  int nbytes;
  char * string = hello World;
  nbytes = copy_to_user(buf, string, 12);
   return nbytes;
  }

 copy_to_user returns the number of bytes which could *not* be copied.
 So it will return 0 on success, making your read return 0.


 Bjørn

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Simple Misc Driver - Problem with string copy to user

2014-05-27 Thread Bjørn Mork
Lucas Tanure tan...@linux.com writes:

 So, My misc_drv_read returns 0, and it's ok. So why the command head didn't
 get the string ?

You told it that it got a string with length 0.  And that's what it printed.


Bjørn

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Simple Misc Driver - Problem with string copy to user

2014-05-27 Thread Lucas Tanure
Wow, many thanks.
So the read operation should return the total number of bytes, not a
true/false int.

I need to read more about this operations.

Thanks

--
Lucas Tanure
+55 (19) 988176559


On Tue, May 27, 2014 at 10:05 AM, Bjørn Mork bj...@mork.no wrote:

 Lucas Tanure tan...@linux.com writes:

  So, My misc_drv_read returns 0, and it's ok. So why the command head
 didn't
  get the string ?

 You told it that it got a string with length 0.  And that's what it
 printed.


 Bjørn

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Simple Misc Driver - Problem with string copy to user

2014-05-27 Thread Bernd Petrovitsch
Hi!

On Die, 2014-05-27 at 10:09 -0300, Lucas Tanure wrote:
 Wow, many thanks.
 So the read operation should return the total number of bytes, not a
 true/false int.

The syscall here (done by `head`) is read() ...

 I need to read more about this operations.

.. and the drivers .read function is called if the user-space calls
read() on the (opened) device.
This .read function returns
*)  0 with the number of successfully read bytes
*) == 0 on end-of-file.
*)  0 on errors. And these error codes are found on `man errno` and
   one just returns them as -E.

[ Fullquote deleted ]

Kind regards,
Bernd


___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Download Linus's latest git tree

2014-05-27 Thread Greg KH
On Tue, May 27, 2014 at 04:35:13AM -0400, valdis.kletni...@vt.edu wrote:
 On Tue, 27 May 2014 00:16:52 -0700, Anand Moon said:
  Please share your thoughts on this.
 
 I'd do it slightly differently, by keeping a master copy of Linus's
 tree, and a separate tree for the -stable additions (and other separate
 trees for linux-next or whatever else you feel like...)
 
 I keep my git trees under /usr/src - feel free to stick them elsewhere if
 that makes your workflow or disk management easier. Just remember to fix
 any pathnames.. :)

So are you doing this as root?  Because you should never do kernel
development as root, just put kernel source trees in your home directory
somewhere, like under ~/linux/

thanks,

greg k-h

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: How to trace the send() in client call

2014-05-27 Thread Augusto Mecking Caringi
On Tue, May 27, 2014 at 8:31 AM, Robert Clove cloverob...@gmail.com wrote:

 But there will be other packets also coming from the network like if some
 one is browsing the net on mozilla.
 I only want to trace the send() calls that i have used in my code,is that
 possible?


Robert,

You must specify the PID of your process (to attach strace to a running
process), or run your program through strace.

Yon can use grep to filter only the write syscall.

Regards.

--
Augusto Mecking Caringi
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Download Linus's latest git tree

2014-05-27 Thread Valdis . Kletnieks
On Tue, 27 May 2014 07:28:34 -0700, Greg KH said:
 So are you doing this as root?  Because you should never do kernel
 development as root, just put kernel source trees in your home directory
 somewhere, like under ~/linux/

No, I'm not doing the builds as root. /usr/src has been fixed to be
owned by source:source like God intended. (And yes, that works just
fine because any RPMs that yum wants to scribble under that are
scribbled as root so the ownership doesn't matter. :)



pgpU0fq6yMtAI.pgp
Description: PGP signature
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Download Linus's latest git tree

2014-05-27 Thread Victor Rodriguez
Have you try the git archive instead of git clone? , if you do not need the
history this git option rocks



On Tue, May 27, 2014 at 11:16 AM, valdis.kletni...@vt.edu wrote:

 On Tue, 27 May 2014 07:28:34 -0700, Greg KH said:
  So are you doing this as root?  Because you should never do kernel
  development as root, just put kernel source trees in your home directory
  somewhere, like under ~/linux/

 No, I'm not doing the builds as root. /usr/src has been fixed to be
 owned by source:source like God intended. (And yes, that works just
 fine because any RPMs that yum wants to scribble under that are
 scribbled as root so the ownership doesn't matter. :)


 ___
 Kernelnewbies mailing list
 Kernelnewbies@kernelnewbies.org
 http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Download Linus's latest git tree

2014-05-27 Thread Valdis . Kletnieks
On Tue, 27 May 2014 11:28:19 -0500, Victor Rodriguez said:

 Have you try the git archive instead of git clone? , if you do not need the
 history this git option rocks

That has the same problem as 'clone --depth 1' - you can't bisect using
the resulting tree.


pgplGNsmTr6Xg.pgp
Description: PGP signature
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Simple Misc Driver - Problem with string copy to user

2014-05-27 Thread Le Tan
I think it is good for you to read LDD3 or google some corresponding
materials at first.

2014-05-27 20:48 GMT+08:00 Lucas Tanure tan...@linux.com:
 Hi!

 Goal, when the user do :
 # head -1 /dev/miscdrv

 The driver prints:  Hello World!

 Steps:
 # Make
 # insmod misc.ko
 # head -1 /dev/miscdrv

 Why my driver doesn't work ?

 What is worg with my read operation?

 static ssize_t
 misc_drv_read(struct file *filp, char __user * buf, size_t count, loff_t *
 offp){
 int nbytes;
 char * string = hello World;
 nbytes = copy_to_user(buf, string, 12);
 return nbytes;
 }


 --
 Lucas Tanure
 Brazil

 ___
 Kernelnewbies mailing list
 Kernelnewbies@kernelnewbies.org
 http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies