linux-kernel

Segmentation in Linux : Segmentation & Paging are redundant?

Hello, I'm reading "Understanding Linux Kernel". This is the snippet that explains how Linux uses Segmentation which I didn't understand. Segmentation has been included in 80 x 86 microprocessors to encourage programmers to split their applications into logically related entities, such as subroutines or global and local da...

linux inotify - determine users for the triggered events

I am trying to figure out how to determine the user which triggered a specific event when monitoring some files with inotify. Is that even possible? Does the inotify_event structure has something like this? ...

linux usb driver: probing already plugged devices

hello, im writing a Usb driver and i have an issue. when i insmod the driver with the device already plugged in before, the probe function is not called. it is only called after i disconnect the device and plug it again. i wanna make it work when i start my pc with the device plugged in. could someone please help me? best regards, jacob....

Processor affinity settings for Linux kernel modules?

In Windows, I can set the processor affinity of driver code using KeSetSystemAffinityThread, and check which processor my code is running on using KeGetCurrentProcessorNumber. I'm trying to do something similar in a Linux kernel module, but the only affinity calls I can see are for userland processes. Is there any way to do this, so tha...

core at which function is running

hi, consider a kernel tasklet scheduled and executing the tasklet function. Is there a way to know which core the tasklet is running ? I mean is there a function / variable to know at which core the tasklet is running at. Architecture is arm. Thanks! ...

Need help in understanding the mapping of user-space send, sendto, sendmsg to kernel-space sendmsg

Hello, I am trying to implement my own transport layer protocol in Linux for an experiment. I am going to use socket interface and add my protocol using sock_register. For the proto_ops i can see that the parameters for the sendmsg and recvmsg are (struct kiocb *iocb, struct socket *sock, struct msghdr *msg, size_t len, int flags). But t...

Are the kernel headers required for anything other than compiling glibc and kernel modules?

Hope the question is clear :) ...

Is it possible to check whether a static binary is compatible with a kernel?

Basically, we want to run static programs compiled on one platform on another. If it's not possible, what are the most significant changes in the kernel API between version 2.6.9 and 2.6.18? ...

Linux driver phys_mem_access_prot undefined

I have a loadable module that is throwing a warning about phys_mem_access_prot when built under Ubuntu 9.10 (Linux 2.6.31-22-server). [664] make -C /lib/modules/`uname -r`/build M=`pwd` make: Entering directory `/usr/src/linux-headers-2.6.31-22-server' LD /home/chuck/dev/svd/built-in.o CC [M] /home/chuck/dev/svd/svd.o LD [M...

Write failed, errno 0

I have a client server situation in which I receive data using read(socket, char_buf, BUF_SIZE) and then try to write it into a log file using write(filefd, char_buf, strlen(char_buf)) Strangely enough this fails (write returns -1), and yet the errno is set to 0, and I can print the message, AND the log file descriptor works (I w...

Use of double pointer in linux kernel Hash list implementation

Hi, I am trying to understand Linux Kernel implementation of linked list and hash table. A link to the implementation is here. I understood the linked list implementation. But i am little confused of why double pointers is being used in hlist (**pprev). Link for hlist is here. I understand that hlist is used in implementation of hash t...

Can the dirtiness of pages of a mmap be found from userspace?

Can dirtiness of pages of a (non-shared) mmap be accessed from userspace under linux 2.6.30+? Platform-specific hacks and kludges welcome. Ideally, I'm looking for an array of bits, one per page (4kB?) of the mmap'ed region, which are set if that page has been written to since the region was mmap'ed. (I am aware, that the process doin...

what is the likely cause of CMOS_WRITE failing to work?

I've been puzzled by a RTC problem for several days: i couldn't write to the RTC register. Following is the code snippet and the value I read from the reg(last line) is always different from what i just wrote to the reg. Anyone can help me understand this ? val = CMOS_READ(RTC_FREQ_SELECT); printk(KERN_INFO "reading val=%d from...

a few questions on the queue mechanism in netfilter

hello. please forgive me if the question were asked before. after some research on netfilter there are few loose ends that i cant comprehend. where is the memory of the queue is and how is it being handled? when you are using the queue is it being copied to the userspace or that you map the memory and how it influences the system perfo...

How to create a new Linux kernel scheduler

Looking through the scheduler source code (2.6.34, kernel/sched.c), I can see how the "pluggable" schedulers are used, and I believe I understand the interface to be implemented. What I don't understand yet is how to get my code built into the kernel. At the very least, pointers to other sites would be appreciated. Right now, I'm grep...

ext3 code understanding

struct inode_operations ext3_dir_inode_operations = { .create = ext3_create, .lookup = ext3_lookup, } This struct is assign to inode structure and further to file system operation structure. My question is what is this flag .create? Do we do the assignment in the structure itself? Or is it some other ver...

Ethernet switch device driver

Hi We're designing a network device based around SoC, which contains MIPS core and 5-ports switch core, connected to the CPU via internal MII port. Device driver provided by a chip vendor represents 5-port switch as a single inteface from the OS perspective; the driver also supports VLAN and currently it splits 5 ports in two VLAN grou...

skb_reserve comment clarification

As per the source, http://lxr.linux.no/#linux+v2.6.31/include/linux/skbuff.h#L1204 1197 * skb_reserve - adjust headroom 1198 * @skb: buffer to alter 1199 * @len: bytes to move 1200 * 1201 * Increase the headroom of an empty &sk_buff by reducing the tail 1202 * room. This is only allowed for an empty buffer. 1203...

How to see changelogs for a particular module in kernel

Hello, I want to know how to see the changelogs or commit messages for a module in the kernel. Actually i modified virtio_net in kernel2.6.26. Now the virtio_net in 2.6.34 seems to be lot different from the one in 2.6.26. There should be some git commit messages or changelogs for the different versions of virtio_net. I want to know the...

How can I access network device counters such as tx/rcv packets/bytes from kernel code?

I'm writing a driver and I want to get network counters of some device within it. What data structure holds that information and how can I access it? ...