linux-kernel

[linux kernel] get _complete_ process name from pid

hi, I am in a kernel module and I want to have the whole process name from a given pid. exactly: I want the line which is hold in /proc/PID/cmdline. The problem is that task_struct->comm[] is only 15 bytes long and doesn't handle if a program changes his argv[] manually or via setproctitle(3)... any ideas? :) ...

Where do you store user context in Linux character drivers?

It's been a while since I worked on a Linux kernel module, and I seem to remember that there was a place to stash context in your open() open implementation that would be available in your other file_operations... For example, if I want to maintain some state associated with everyone that opens my device node, if either the inode structu...

Setting up Netbeans/Eclipse for Linux Kernel Development

Hi: I'm doing some Linux kernel development, and I'm trying to use Netbeans. Despite declared support for Make-based C projects, I cannot create a fully functional Netbeans project. This is despite compiling having Netbeans analyze a kernel binary that was compiled with full debugging information. Problems include: files are wrongl...

CONFIG_ASYNC_XOR not visible through menuconfig/gconfig

Hello everyone, I am using linux kernel version 2.6.26.8 and I need to use async_XXX (async_xor, async_memcpy etc) API. So I need to build the ASYNC_XXX modules with my kernel. But I can't see the config options related to ASYNC_XOR or ASYNC_MEMCPY etc through menuconfig or gconfig under Security Options. In gconfig if I select show al...

error compiling the linux kernel

Hi, I was trying to compile the linux kernel, but getting some errors. While running the top Makefile i am getting the following errors :- CHK include/linux/version.h CHK include/linux/utsrelease.h SYMLINK include/asm -> include/asm-x86 HOSTCC scripts/selinux/mdp/mdp scripts/selinux/mdp/mdp.c:32:19: error: flask.h: No su...

How to convince my co-worker the linux kernel code is re-entrant ?

Yeah I know ... Some people are sometimes hard to convince of what sounds natural to the rest of us, an I need your help right now SO community (or I'll go postal soon ..) One of my co-worker is convinced the linux kernel code is not re-entrant as he reads it somewhere last time he get insterested in it, likely 7 years ago. Probably its...

Reading files from USB memory stick in C

Can you show me some C code to detect a pendrive and retrieve the data present in it. I'm working on Linux. ...

Kernel compilation error

Hi, I was trying to compile the Linux kernel. I am getting the following error:- "No rule to make target arch/x86/kernel/entry_32.o', needed by arch/x86/kernel/built-in.o'." Before this I configured the kernel(didn't do anything extra except the default options). configured the kernel using "make gconfig". The config was generated. I...

Is there any difference between socketpair and pair of unnamed pipes?

I would like to know not only user-side differences, but differences / common parts in Linux kernel implementation as well. ...

Remotely debug Linux Kernel from Windows?

Hi all, I was wondering if anyone knew of a way to remotely debug the Linux kernel running under VMWare (and if so, if there's a way to do it in Windows since linux kind of scares me...). Both are x86. I know VMWare has support for this (I saw a post about remote debugging via gdb), but if there was a way to do it from Windows (i.e. Ecl...

sys_call_table in linux kernel 2.6.18

I am trying to set the sys exit call to a variable by extern void *sys_call_table[]; real_sys_exit = sys_call_table[__NR_exit] however, when I try to make, the console gives me the error error: ‘__NR_exit’ undeclared (first use in this function) Any tips would be appreciated :) Thank you ...

Unexplained Linux System V IPC shared memory segment marked for destruction

I have a Linux System V IPC shared memory segment that is populated by one process and read by many others. All the processes use interface to the shared memory segment in the form of a class which takes care of looking up, attaching, and detaching to the segment as part of its constructor/destructor methods. The problem here is that...

pgpgin and pgpgout - Linux Counters in /proc/vmstat

Hi, I am writing an application which collects overall system I/O statistics. I was wondering whether the two counters for page-ins and page-outs, pgpgin pgpgout in /proc/vmstat include pages written to, and read from all disk-based block devices attached to the system. Please let me know, if you can! ...

what are ladder governors and menu governors ?

What role do they play in the Operating system ? ...

Linux Distro built on the .NET Framework

I am a computer science engineering student and I've been programming on the .NET Framework for 2-3 years but I haven't used Linux. I thought, for my final year project, a Linux distro would be good. I was thinking of a few ways to implement it, when this crazy idea occurred to me: Can we implement the .NET Framework first on the Li...

Is bool a native C type?

I've noticed that the Linux kernel code uses bool, but I thought that bool was a C++ type. Is bool a standard C extension (e.g., ISO C90) or a GCC extension? ...

How to implement thread library ?

Is writing a code for implementing the thread library a part of kernel code ? Is the function implementation of pthread_create() et al a part of kernel ? ...

Allocating memory for user space from kernel thread

My question is about passing data from kernel to a user space program. I want to implement a system call "get_data(size, char *buff, char **meta_buf)". In this call, buff is allocated by user space program and its length is passed in the size argument. However, meta_buf is a variable length buffer that is allocated (in the user space pro...

Why sizeof(spinlock_t) is greater than zero on uni-processor ?

The following line printed output as 4 whereas I was expecting 0. printk(KERN_INFO "size of spinlock_t %d\n", sizeof(spinlock_t)); I tried this on a system with single cpu. No debugging flags are enabled while building kernel like CONFIG_DEBUG_SPINLOCK or CONFIG_DEBUG_LOCK_ALLOC. According to kernel header files, it should be zero ...

Are programs like sys_open( ) ,sys_read( ) et al examples of system level programs ?

Are the programs written on schedulers ,thread library , process management, memory management, et al called systems programs ? How are they different from the programs that implement functions like open() , printf() , scanf() , read() .. they have a prefix sys_open, sys_close, sys_read etc , right ? Is there any difference of hierarchy...