Re: regarding synchronization code

2010-09-25 Thread Michael Blizek
Hi! On 18:56 Fri 24 Sep , Sri Ram Vemulpali wrote: Hi all, I am encountering alot macros in the code. I did not understand what those macro means. Can anyone explain them and the use of them putting them like that. unlikely likely() and unlikely() are wrappers around gcc

Re: character device driver reading only last character of buffer

2010-09-25 Thread Bond
On Fri, Sep 24, 2010 at 10:51 PM, Mulyadi Santosa mulyadi.sant...@gmail.com wrote: When a senior member like Greg Freemyer respond like that, it must be Rather than giving me lecture here show me how this error can be fixed and let him prove if he deserves respect I do not have any problem in

Re: copy_to_user() and copy_from_user(): confusing code

2010-09-25 Thread Bond
On Fri, Sep 24, 2010 at 5:41 PM, sri bskmo...@gmail.com wrote: what part is not able to understand? Here is a program I wrote but it is dropping characters though I gave 14 bytes to kmalloc and buffer but still the program is unable to read and write as I expect it to do. I did an strace on

Re: character device driver reading only last character of buffer

2010-09-25 Thread Bond
On Sat, Sep 25, 2010 at 8:36 PM, ptchinster ptchins...@archlinux.us wrote: Yup. Thank you for placing where i got it, i didn't save info when i saved this source. It didn't even compiled on my machine.

Re: character device driver reading only last character of buffer

2010-09-25 Thread Bond
running an strace on the program gave me mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f2a2f03b000 write(1, abcde, 5)= 1 write(1, bcde, 4) = 1 write(1, cde, 3) = 1 write(1, de, 2) = 1

Re: character device driver reading only last character of buffer

2010-09-25 Thread Bond
Since you people think me to be a newbie or moron or some thing like copy pasting the code so I am explaining each and every line of it what it is doing but still lectures are lectures and funda's don't work show me real thing or else do not reply. #include linux/init.h #include linux/module.h

Re: printk and \n

2010-09-25 Thread mohit verma
hello guys, are there any gains ( in terms of security or anything else) to flush the buffer in kernel printk() as soon as \n is encountred ? i am asking because this does not happen in the user space as all of us know.

Re: printk and \n

2010-09-25 Thread Manish Katiyar
On Sat, Sep 25, 2010 at 9:15 AM, mohit verma mohit89m...@gmail.com wrote: hello guys, are there any gains ( in terms of security or anything else)  to flush the buffer in kernel printk() as soon as \n is  encountred ?  i am asking because this does not happen in the user space as all of us

Re: regarding synchronization code

2010-09-25 Thread Sri Ram Vemulpali
I am just saying I know inline keyword. But what is always_inline. Thanks for replies and explanations. I got it now. Regards, Sri. On Sat, Sep 25, 2010 at 4:48 AM, Michael Blizek mic...@michaelblizek.twilightparadox.com wrote: Hi! On 18:56 Fri 24 Sep     , Sri Ram Vemulpali wrote: Hi all,

Re: copy_to_user() and copy_from_user(): confusing code

2010-09-25 Thread Chetan Nanda
On Sat, Sep 25, 2010 at 7:34 PM, Bond jamesbond.2...@gmail.com wrote: On Fri, Sep 24, 2010 at 5:41 PM, sri bskmo...@gmail.com wrote: what part is not able to understand? Here is a program I wrote but it is dropping characters though I gave 14 bytes to kmalloc and buffer but still the

Re: Understanding Page Faults - find_get_page question

2010-09-25 Thread Mulyadi Santosa
Hi... On Sat, Sep 25, 2010 at 06:51, moussa ba mus...@gmail.com wrote: The problem I am running into is that I see many instances where calls to find_get_page return NULL meaning the page could not be found in the page cache, however, they do not register as major page faults in the kernel

Re: printk and \n

2010-09-25 Thread mohit verma
can u please write a code to prove urself( in user space)? coz till now what i have code ,i have never seen this.( or may be not noticed this)

Re: printk and \n

2010-09-25 Thread Philip Downer
mohit verma wrote: can u please write a code to prove urself( in user space)? coz till now what i have code ,i have never seen this.( or may be not noticed this) See this really simple bit of code below, it probably doesn't do what you expect. #include stdio.h int main(void) {

Re: printk and \n

2010-09-25 Thread Philip Downer
javad karabi wrote: I am very curious about this. Where exactly does the hello text go, before it is 'flushed' ? I am thinking that it gets put in some other buffer, then 'flushing' the buffer does something to the effect of memcpy the buffer to the framebuffer? stdout is buffered, the '\n'

Re: printk and \n

2010-09-25 Thread Dave Hylands
Hi guys, On Sat, Sep 25, 2010 at 5:08 PM, Philip Downer wrote: javad karabi wrote: I am very curious about this. Where exactly does the hello text go, before it is 'flushed' ? I am thinking that it gets put in some other buffer, then 'flushing' the buffer does something to the effect of

Re: character device driver reading only last character of buffer

2010-09-25 Thread Bond
On Sun, Sep 26, 2010 at 3:43 AM, Venkatram Tummala venkatram...@gmail.comwrote: Hey buddy, i took the module code in your first post modified it to make it work . I am attaching the code. It works on the latest kernel 2.6.35. If you are using any other kernel, you may have to change the

Re: copy_to_user() and copy_from_user(): confusing code

2010-09-25 Thread Bond
On Sat, Sep 25, 2010 at 11:06 PM, Chetan Nanda chetanna...@gmail.comwrote: as per my understanding (may be wrong), issue is not with the copy_to/from_user. May be with the return values from bond_read/write function. Drivers read/write should return the number of bytes read or written.

Re: copy_to_user() and copy_from_user(): confusing code

2010-09-25 Thread Dave Hylands
Hi, Replying to the list this time. On Sat, Sep 25, 2010 at 10:22 PM, Bond jamesbond.2...@gmail.com wrote: write(1, abcde, 5)= 1 User mode tried to write 5 characters. The driver only accepted one (which is evidenced by the return code which is the number of characters

Re: character device driver reading only last character of buffer

2010-09-25 Thread Bond
On Sun, Sep 26, 2010 at 3:43 AM, Venkatram Tummala venkatram...@gmail.comwrote: This will print the the last character of the string you wrote. If you would have read the thread from my first post printing the last character is not my objective I am trying to print the complete string. As

Re: character device driver reading only last character of buffer

2010-09-25 Thread Bond
Your code /* Registering device */ result = register_chrdev(0, bond, bond_fops); registers the device with major number 0.Is that possible ? On Sun, Sep 26, 2010 at 10:16 AM, Bond jamesbond.2...@gmail.com wrote: On Sun, Sep 26, 2010 at 3:43 AM, Venkatram Tummala