linux-kernel

Any experience with SANOS operating system kernel?

I was browsing for an open source kernel when I ran across SANOS which feels like something worth keeping alive as open source. To bring it up to modern standards, the following enhancements need to occur: Support for Multiple CPUs/Cores Add IPv6 (currently only supports IPv4) Ability to run 8192 concurrent threads Ability to support ...

Determining the amount of time processes spend Blocking/Executing

OK so for a programming assignment that I have (Yes, we are all allowed to turn to any source we find suitable for help) I have to find out how much time processes spend blocking/sleeping/running. My first attempt was creating a bash script... that looked something like this: for i in `ls /proc/ | egrep [0-9]+` do cat /proc/$i...

open() returns with "No such device" error, but there is such a device (linux)

I'm trying to use a somewhat old DAQ, and had to jump through a few hoops to get an old (circa 2004) device driver for it to compile (DTI-DT340 Linux-DAQ-PCI). I've gotten to the point where it compiles, I can load the the kernel module, it finds the card, and I can create the character devices using mknod. But I can't seem to open the...

How do I create a "netlink" between kernel and userspace?

Now I want to create a netlink which is used to communicate between the user and kernel space. My Linux kernel version is 2.6.28. the following is my wrong code: nf_sock=netlink_kernel_create(NL_PROTO,0,nl_user_skb,THIS_MODULE); The error message is briefly as: error: too few arguments to function 'netlink_kernel_creat' In the file...

Profiling u-Boot/Kernel boot sequence

I am profiling the booting process of power PC board, what is the simplest way to profile the booting sequence ? My first idea is to modify the u-boot/kernel code add printf/printk (using realtime device as reference) and print them on the console. However just printing them on the console may affect the time. Any thoughts? Regards, ...

how can I get the saddress from the struct "skbuff"

Hi, I have a program that it need get the source address from the struct "skbuff", In the previous kernel version, I can get the "saddr" using the following line: static __u32 get_src_ip(const struct sk_buff *skb){ return ntohl(skb->nh.iph->saddr); } The following is error message: error: 'const struct sk_buff' has no member name...

Compile linux kernel (2.6) module including non kernel headers

Is it possible to compile a linux kernel(2.6) module that includes functionality defined by non-kernel includes? For example: kernelmodule.h #include <linux/init.h> #include <linux/module.h> #include <linux/kernel.h> // printk() // ... #include <openssl/sha.h> // ... Makefile obj-m := kernelmodule.o all: $(MAKE) -C /lib/mo...

Linux socket programming debug?

Hi, I have a function just like this: static int rcv_kern(int sock, void *buf, int len, struct sockaddr *addr, socklen_t *addrlen) { struct timeval timeout = {1, 0}; fd_set set; int status; FD_SET(sock, &set); if ((status = select(sock + 1, &set, NULL, NULL, &timeout)) == 0) { FD_ZERO(&set); fprintf(s...

iptable rule to drop packet with a specific substring in payload

Hi, i am trying to write rules to drop any packet, irrespective if it is outgoing, incoming or being forwareded, which has a specific sub string in the tcp or udp payload, how am i suppose to do that? ...

Dropping packets with matching string uisng iptables drops all the subsequent packets with no match

hi, I am trying to write a worm filtering utility on application layer. i have setup following rule to drop tcp packet with specific substring. iptables -A INPUT -p tcp -m string --string "test" -j DROP --algo kmp however,once a packet with matching string is found all the subsequent packets, even with non matching strings are dropped...

iptables and libpcap

hi, i have rule set up to drop udp/tcp packets with matching strings. however, my program which captures packet using libpcap, is still able to see this packet. Why is this/, what should be the iptable rules to drop packets before it is seen by libpcap? Is there anyway,perhaps other than iptables rules, to drop this packet before it i...

Is it possible to shutdown linux kernel and resume in Real Mode?

Let's say I'd like to start a small linux distro before my ordinary operating system start. BIOS load MBR and execute MBR. MBR locates the active partition which is my linux partition. Linux start and I perform what I need to do. Linux shut down and I switch to Real Mode again. The original partition boot sector is loaded and my ordina...

Who can give me the latest netlink programming samples?

Hi, I'm writing a Linux driver using netlink to communicate between user space and kernel space. But I can't find some useful materials, because the netlink has changed from Linux kernel >=2.6.24. Who can give me some suggestions about how to create a netlink socket. Thanks in advance! ...

Specifying uncacheable memory regions

Hi For some simple performance tests I would like to specify some regions of an application program as uncacheable. For example, the application contains a function that maps to the memory address space 0x08002000 to 0x0800A000 in the executable. When this program is run, code within this address space should not be cached in anyway. In...

Knowing the files to be compiled when building a linux kernel.

hi... i would like to know if it's possible to know once a kernel is configured which files are going to be compiled and in what order ? I want to know that because i'm interested in the variations of the building process according to the architecture and i don't want to have as many toolchains as architecture... thanks ...

Keeping changes against a moving target (such as Linux) using git.

I have a set of changes which work perfectly against a certain linux version, say 2.6.25.4. I have a git tree, and created a tracking branch vanilla-2.6.25.4 from the tag v2.6.25.4. I created a branch from this called my-changes-2.6.25.4, and did all my work. Now, I would like to rebase my work on top of an arbitrary newer version of ...

Oops: kernel access of bad area, sig: 11 - 'swapper' - killing interrupt handler

Hi all In an embedded linux environment (customized 2.4.25 on PowerPC) I get the following kernel panic after some hours: Oops: kernel access of bad area, sig: 11 NIP: C9471C7C XER: 20000000 LR: C0018C74 SP: C0198E20 REGS: c0198d70 TRAP: 0800 Not tainted MSR: 00009030 EE: 1 PR: 0 FP: 0 ME: 1 IR/DR: 11 DEAR: C9876FFF, ESR: 00000000 ...

What's the use of do while(0) when we define a macro?

I'm reading the linux kernel and I found many macros like this: #define INIT_LIST_HEAD(ptr) do { \ (ptr)->next = (ptr); (ptr)->prev = (ptr); \ } while (0) Why do they use this rather than define it simply in a {}? ...

What's the best linux kernel locking mechanism for a specific scenario

Hi, I need to solve a locking problem for this scenario: A multi CPU system. All of the CPU's use a common (software) resource. Read only access to the resource is very common. (Processing of incoming network packets) Write access is a lot less frequent. (Pretty much configuration changes only). Currently I use the read_lock_bh, wri...

What is the ideal & fastest way to communicate between kernel and user space?

I know that information exchange can happen via following interfaces between kernel and user space programs system calls ioctls /proc & /sys netlink I want to find out If I have missed any other interface? Which one of them is the fastest way to exchange large amounts of data? (and if there is any document/mail/explanation supporti...