linux

Efficient Linux sockets (DMA/zero-copy)

Hello, I'm building a very high performance Linux server (based on epoll, non-blocking sockets, and async disk IO [based on io_submit/io_getevents/eventfd]). Some of my benchmarks show that the way I handle sockets isn't efficient enough for my requirements. In particular, I'm concerned with getting data from the userspace buffer to the...

I'd like to move on to µC programming, but I have absolutely no idea where to start from.

Hello, I've been thinking quite some time about 'moving on' to MCU programming, but the problem is I've never worked with any microcontrollers or similar. As I've been told, AVR and PIC are the most common microcontrollers among hobbyists, and apparently most people suggest AVR for newcomers like me, due to its 'C-friendly architecture'...

How to make this sed script faster?

I have inherited this sed script snippet that attempts to remove certain empty spaces: s/[\s\t]*|/|/g s/|[\s\t]*/|/g s/[\s] *$//g s/^|/null|/g that operates on a file that is around 1Gb large. This script runs for 2 hours on our unix server. Any ideas how to speed it up? Notes that the \s stands for a space and \t stands for a tab, ...

Fastest socket method for a lot of data between a lot of files

I'm building a socket application that need to shuffle a lot of small/medium sized files, something like 5-100kb sized files to a lot of different clients (sort of like a web server, but still not quite). Should I just go with the standard poll/epoll (linux) or async sockets in winsock (win32), or are there any methods with even more pe...

How can I understand that the user pressed which keyword?

I am coding a terminal like Linux terminal with C under Linux OS and I need to quit program when the user presses ctrl+D keywords. But I don't know how to understand that the user pressed these keywords. Thanks for your helping. I'm getting inputs with fgets() ...

file lock leases via NFS v4 in C

does anybody know how to use the fancy file locking features of NFS v4? (described in e.g. About the NFS protocol (scroll down)). supposedly NFS v4 supports file lock leasing with a 45 second lifetime. I would like to believe that the linux kernel (I'm using gentoo 2.6.30) happily takes care of these details, and I can use fcntl() and it...

How to query X11 display resolution?

It seems like an simple problem, but I can't find the answer: How do you query (via X11) what monitors exist and their resolutions? ...

Lightweight debugging on embedded Linux

I'm developing an application that runs on a small Linux-based SBC (~32MB RAM). Sadly, my app recently became too large to run under GDB anymore. Does anyone know of any good, lightweight debugging methods that I can use in embedded Linux? Even being able to view a thread's stack trace would be extremely helpful. I should mention tha...

Weird Subversion permissions issue

I'm trying to set up SVN on a CentOS 5 system so that several people can use a repository. I've created the repository at /var/svnrepository. I added a subversion user and group, made that the owner of the repository recursively. I set permissions to 775 recursively. I ensured that all the system users are in the subversion group. T...

how to find the owner of a file or directory in python

I need a function or method in Python to find the owner of a file or directory? the function should be link find_owner("/home/somedir/somefile") owner3 ...

How to draw the graph in framebuffer using c language..?

Hi friends, i am new to this linux framebuffer so do anybody guide me to draw the line-graph in framebuffer. And i have the code to draw graph in turbo c but now in linux. So please help me out. Thank You, Rahul ...

Is there Any Windows Terminal Service like for Linux ?

We have some codebar scanners based on Windows CE that run remote applications located on some servers via Windows Terminal Service. Given that we are migrating our server applications to UNIX based operating systems, I was wondering is there any reliable RDP based solution that can be considered ? Thanks, ...

How to know when a schedule() call is returning because of a signal?

In a device driver for some PCI hardware, I have an ioctl call that waits for an incoming interrupt on the PCI bus. Using wait_queue_head_t, I put the task to sleep by calling schedule(). Then, the irq_handler function wakes up this task when the interrupt is raised on the PCI bus. Everything seems to work correctly. My question is how...

Looking for advice on how to develop applets for Gnome / Ubuntu

I am a linux (mostly ubuntu) user with a reasonable understanding of how the system works (although I am certainly not a linux guru!). In the past I have developed small cross-platform desktop applications in python/GTK and I delivered them to clients as self-contained filetrees, so that the only dependencies were Python itself and GTK. ...

sem_timedwait not supported properly on RedHat Enterprise Linux 5.3 onwards?

Hi, We're seeing odd behaviour on RedHat Enterprise Linux systems with pthreads sem_timedwait. It's only occurring with versions 5.3 onwards. When we create the semaphore on a background thread with sem_init, no error is returned. When we do sem_timedwait, we get an immediate return with errno = 38 (ENOSYS) indicating it's not suppor...

How does free calculate used memory?

How does free calculate used memory and why does it differ from what /proc reports? # cat /proc/*/status | grep VmSize | awk '{sum += $2} END {print sum}' 281260 But free says: # free total used free shared buffers cached Mem: 524288 326488 197800 0 0 0 W...

Linking an application to libbz2.so.1 rather than libbz2.so.1.0

Here's the current situation I'm in: I want to distribute a binary app on Linux that would run on several distros (not all of them, just the main ones matter at the moment, let's focus on Ubuntu and Fedora for the sake of this discussion). The app in question links to libbz2 for some of its work. A simple "Hello World" will illustrate t...

How do I program for Linux's new `fanotify` file system monitoring feature?

fanotify, built on top of fsnotify, is supposed to replace inotify which replaced dnotify. Are there some good programming examples or existing utilities that use fanotify to watch for changes in a filesystem? How much detail does fanotify provide? ...

Perl (or something else) - ^M problem

I'm trying to add " at beginning and ", at end of each non-empty line of text file in Perl. perl -pi -e 's/^(.+)$/\"$1\",/g' something.txt It adds " at beginning of each non-empty line, but i have problem with ",. Example input: bla bla bla blah That's output i'm getting: "bla ", "bla bla ", "blah ", And that's output i actuall...

SVN status..how to use that function

In linux, how do I check if someone has not yet committed something? I remember I made changes on a server once..but forgot to commit. Now, I don't know which server I used to make those changes. ...