Hi, I have to develop a patch for the linux kernel (2.6) for an university course I'm attending. I have to develop this patch with a friend of mine and we need to edit the same files on our computers (2-3 PCs). So, we want to use something like a collaborative editor and/or a version control system. The problem is that we never used some...
Where in the linux kernel does the closing of a socket's file descriptor occur? I know for a file, the file's file descriptor is closed in fs/open.cs function sys_close(). However, for a socket file descriptor, is this the same location or somewhere else?
Also, do sockets utilize the file.c alloc_fd to allocate the file descriptor or do...
In linux kernel programming, is there a way to check if a particular file descriptor is in use for a given process or if it's available?
...
Hello,
Many Zw* functions that work with files (such as ZwCreateFile) need to be called at PASSIVE_LEVEL with APCs enabled: http://msdn.microsoft.com/en-us/library/ff566424%28VS.85%29.aspx. This is because, internally, I/O operations are asynchronously and the completion of an operation is delivered through an APC (correct me if I'm wro...
How to write a kernel module that creates a directory in /proc named mymod and a file in it name is mymodfile. This file should accept a number ranged from 1 to 3 when written into it and return the following messages when read based on the number already written into it:
• 1: Current system time (in microseconds precision)
• 2: System ...
i have 4 processes:
p1 - bursts 5, priority: 3
p2 - bursts 8, priority: 2
p3 - bursts 12, priority: 2
p4 - bursts 6, priority: 1
Assuming that all processes arrive at the scheduler at the same time what is the average response time and average turnaround time?
For FCFS is it ok to have them in the order p1, p2, p3, p4 in the executi...
Hi everyone,
I'm trying to compile a simple Kernel program that read and write from a proc file.
I'm trying to set permission to that file by overriding the permission fp in inode_operations struct (.permission)
static int module_permission(struct inode *inode, int op, struct nameidata *foo)
{
. . .
}
static struct inode_opera...
I will use the Linux NTFS driver as an example.
The Linux kernel NTFS driver only has very limited write support in the kernel, and after 5 years it is still considered experimental.
The same development team creates the ntfsmount userspace driver, which has almost perfect write support.
Likewise, the NTFS-3G project which is written ...
Hi Kernel Gurus,
I'm currently writing a simple "multicaster" module.
Only one process can open a proc filesystem file for writing, and the rest can open it for reading.
To do so i use the inode_operation .permission callback, I check the operation and when i detect someone open a file for writing I set a flag ON.
i need a way to det...
Hi,
I'm writing a kernel module that reads from a /proc file.
When someone writes into the /proc file the reader will read it, but if it reads again while there is no "new" write, it should be blocked.
In order to remember if we already read, i need to keep a map of the latest buffer that process read.
To avoid that, I was told that th...
Hi Kernel Gurus,
I need to write a kernel module that simulate a "multicaster" Using the /proc file system.
Basically it need to support the following scenarios:
1) allow one write access to the /proc file and many read accesses to the /proc file.
2) The module should have a buffer of the contents last successful write.
Each write sh...
I want to know what is the standard way for writing a -simple- kernel to be compiled on NASM?
To get it clearer:
I was able to define the code block with all the following ways:
[segment code]
[segment .code]
segment code
segment .code
[section code]
[section .code]
section code
section .code
I need to know what is the standard way ...
Hello,
in many cases callbacks registered by a mini-filter (pre/post operations) are called at PASSIVE_LEVEL. In case the pre-callback decides that it needs to do some work after the completion of some operation, it will ask the filter-manager to call the post-callback for that operation.
The documentation states that if the pre-callba...
Hello,
I'm dealing with a problem in a kernel module that get data from userspace using a /proc entry.
I set open/write/release entries for my own defined /proc entry, and manage well to use it to get data from userspace.
I handle errors in open/write functions well, and they are visible to user as open/fopen or write/fwrite/fprintf err...
I'm working on a kernel module and I'm trying to uniquely identify each one of the users trying to open() the module (can be either processes or threads).
What is the best way to identify them? Is there an ID I can get from a system call?
I wish to get all users in a list that specifies whether they're trying to open the module for rea...
As I understood after reading the chapter related to The Linux Device Model in the Linux Device Drivers 3rd Edition, when a new device is configured, the kernel (2.6) follows more or less this sequence:
The Device is registered in the driver core (device_register(), what includes device initialization)
A kobject is registered in the de...
I'm trying to learn about device drivers on Linux Kernel, for that I've created three modules with:
A bus type
A device driver
A fake device that does nothing now, only is registered
Everything works fine, I can load the bus, the driver and the module that creates the device. Everything appears on sysfs, including the link between th...
In user mode IOCTL calls can be made via DeviceIoControl function.
What can I use in kernel mode to issue IOCTL calls? I must use this inside a filesystem minifilter driver.
BACKGROUND
I am writing a filesystem minifilter driver, and I must issue IOCTL calls to storage devices to find out their serial number and capabilities (removable ...
Do they use Windows to write Windows? I don't know, but if they did and suddenly there was no more Windows, what would they use to re-write Windows?
...
Hello,
This image gives a good picture about Virtual Adress space. But it only says half of the story. It only gives complete picture of User Adress space ie.. lower 50% (or 75% in some cases).
What about the rest 50% (or 25%) which is occupied by the kernel. I know kernel also has so many different things like kernel modules , devic...