I want to write a new virtual webcam driver, which for example will take an AVI or live stream for example for screen and stream it as webcam source.
I'll not have webcam really, I want to add a virtual webcam which streams desktop screen.
I should write a webcam in kernel mode to do so ? If so, could you guide me to a sample webcam d...
How to write kernel code in C ? Where can we look forward to learn more of writing kernel code ? I want to know writing programs in C that can be used to modify my kernel. How do i do that ? What resources can i look upto ?
...
Is there any book/resource that one can refer to, to be able to write programs at kernel/system level.. I'm looking for a programming book that could serve as a guide to write kernel codes / system level programming etc..
I have Tannenbaum's Design and Implementation. It addresses theoretical aspects well .But a book that teaches program...
Hello,
I've implemented some kind of character device and I need help with copy_ from_user function.
I've a structure:
struct my_struct{
int a;
int *b;
};
I initialize it in user space and pass pointer to my_struct to my char device using 'write' function. In Kernel's Space character device 'write' function I cast it from a *char...
How is cpu scheduling done in sanos?
...
Hi,
I modified the block mapping in an inode and want to flush the page cache associated with the inode so that the new inode with new mapping will be loaded from disk. I tried below functions but it works some time and fails some other time.
invalidate_mapping_pages() - for flushing non-dirty pages
truncate_inode_pages() - for flushin...
Hello,
I'd like pass a pointer from a user space memory into a function in my kernel module. I don't want to use copy_from_user. I've read that I should use get_user_pages function.
For example one page.
struct page **pages;
pages = kmalloc(1 * sizeof(*pages), GFP_KERNEL);
down_read(¤t->mm->mmap_sem);
get_user_pages(current,cur...
Hello,
I've implemented a character device and I'd like to ask If this is correct:
In a Userspace I've a struct with 2 pointers.
I write this struct into my device.
In my write function in char device I copy_from_user this structure into kmalloced space.
After this I'm in KS and got 2 pointers to US so I want to copy_from_user each. A...
hello
I am trying to count the total number of clock ticks for each process (only when its actually running).
I inserted the following code in schedule() (sched.h):
...
switch_tasks:
prefetch(next);
clear_tsk_need_resched(prev);
if (likely(prev != next)) {
rq->nr_switches++;
rq->curr = next;
...
I am working through Linux Device Drivers, Third Edition and while the book is released under Creative Commons Attribution-Share Alike license, I can't seem to locate the source code for the examples used in the book.
Some Amazon reviews mention that they do exist, but fail to provide a reference. In the book snippets you can see that ...
Hi all,
I have compiled my own Kernel module and now I would like to be able to load it
into the GNU Debugger GDB. I did this once, a year ago or so to have a look
at the memory layout. It worked fine then, but of course I was too silly to
write down the single steps I took to accomplish this... Can anyone enlighten
me or point me to a...
I'm doing some kernel modification and am trying to get printk to output information back to the console. I pass any kernel log level with it and do not properly get any response back on the console for even the highest log levels.
I checked and the current log configuration for printk is 4 4 1 7.
It prints properly each time to logs. ...
So I'm trying to write a kernel module that uses the linux/timer.h file. I got it to work inside just the module, and now I am trying to get it to work from a user program.
Here is my kernel module:
//Necessary Includes For Device Drivers.
#include <linux/init.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/fs.h>...
So the TimerExpire function in my setup_timer() causes a huge panic (will post below), while the regular function call to TimerExpire() will actually print out my input.
void TimerExpire(char* data)
{
printk("Timer Data: %s\n", data);
}
setup_timer(&my_timer, TimerExpire, (char *)args);
printk("Made timer: %s\n", (char *)args);
Tim...
Here where I work I am attending a series of lectures about database query optimizers. While the speaker was introducing databases, he made a very insightful comment about a kernel having basically to administer tables of processes, pointers to open files, inodes, etc, and it's therefore basically a POSIX-compliant database engine. Clear...
I made a kernel module and used the code below to try to make a /dev/mytimer entry.
#define DEVICE_NAME "mytimer"
#define MAJOR_NUM 61
static struct class *fc;
fc = class_create(THIS_MODULE, DEVICE_NAME);
device_create(fc, NULL, MAJOR_NUM, "%s", DEVICE_NAME);
I don't see my module in /dev as /dev/mytimer...
But when I lsmod, I see i...
When my TimerExpire function is finally called when the timer ticks out, it prints out gibberish. Anyone know why? But my printk function in IOCTL_MAKE_TIMER prints out correctly, so I think it's because I'm passing in the data wrong.
setup_timer() works by setting up the timer in the first argument, telling it to call the function spec...
Anyone know what function or file in linux holds the algorithm that finds a random port to use for the bind() system call? I'm hunting all over and cannot find the method that contains this algorithm in the Linux source.
Thanks!
...
Is there any way to add a system call dynamic, such as through a module? I have found places where I can override an existing system call with a module by just changing the sys_call_table[] array to get my overridden function instead of the native when my module is installed, but can you do this with a new system call and a module?
...
I know how to mount the hostfs directories when needed for my UML Linux instance.
I need to get gcc and all it's dependencies from my host Linux instance by mounting the files in my UML instance.
I think the paths are not working properly because it comes up with an error about cc1 and execvp when I mount all files and try to run gcc. ...