linux

Total stack sizes of threads in one process

I use pthreads_attr_getthreadsizes() to get default stack size of one thread, 8MB on my machine. But when I create 8 threads and allocate a very large stack size to them, say hundreds of MB, the program crash. So, I guess, shall ("Number of threads" * "stack size per thread") < a constant value (e.g. virtual memory size) ? ...

framebuffer not available

I am trying to run an application that uses framebuffer on 2.6.31-14-generic #48-Ubuntu. All need to do is to install a framebuffer device to get rid of the following error. /dev/fb/0: No such file or directory framebuffer not available. FATAL: no framebuffer available I googled through and found some resources indicating to do that...

bash string replacing a some char with another

folks, i have a string like AxxBCyyyDEFzzLMN I want to replace all x and y and z with _ so that the output is A_BC_DEF_LMN How to do that? I know a series of echo "$string" | tr 'x' '_' | tr 'y' '_' will work, but I want to do taht in one go, without using pipes EDIT: The following worked echo "$string" | tr '[xyz]' '_' ...

How to send a EML file as email using python script to list of emails one at a time?

I want to write a simple python script that send a EML file exported from Outlook though given smtp server as email to a given list of emails. I know how to send a simple email but sending a EML file as email is not something i could do and could not find it on Google. Can anyone help me with that. The EML file is actually in HTML forma...

How to retrieve value from etc/sysconfig in Python

Hi All, I have a config file FOO in /etc/sysconfig/. This Linux file is very similar to INI-File, but without a section declaration. In order to retrieve a value from this file, I used to write a shell script like: source /etc/sysconfig/FOO echo $MY_VALUE Now I want to do the same thing in python. I tried to use ConfigParser, but Co...

grep a rar in cygwin

Hi, I want to do grep texts files inside a rar without extracting the rar file to disk, I tried a couple of combinations with pipes however it didnt work i tried for example unrar e myrar.rar | grep mysearchedline however it actually opened it to disk, I don't want to open it to disk, I don't have enough space for it to be opened (...

Get link speed programmatically?

I am writing an application that reports attributes of network devices on the local machine. I need the mac address, mtu, link speed and a few others. I'm using udev for this. I've already figured out how to get the mac address and mtu, but not how to get the link speed. I can get it with ethtool from the terminal, but I need a way to ge...

Heap Consistency Checking on Embedded System

I get a crash like this: #0 0x2c58def0 in raise () from /lib/libpthread.so.0 #1 0x2d9b8958 in abort () from /lib/libc.so.0 #2 0x2d9b7e34 in __malloc_consolidate () from /lib/libc.so.0 #3 0x2d9b6dc8 in malloc () from /lib/libc.so.0 I guess it is a heap corruption issue. uclibc does not have mcheck/mprobe. Valgrind does not seem to ...

Displaying an image from the tmp directory

I have the following. A website that create temporarily images in the /tmp folder on the Linux server. The reason why I store it within this folder is since these images need to be cleared once in a while and it's so much easier just to clear the tmp directory using tmpwatch. Now my issue is to display the image within my browser? Code ...

How to remove strings from a compiled binary (.so)

How do I remove strings from / obfuscate a compiled binary? The goal is to avoid having people read the names of the functions/methods inside. It is a dynamic library (.so) compiled from C++ code for Android with the NDK tools (includes GCC) I compile with -O3 and already use arm-eabi-strip -g mylib.so to remove debugging symbols, but ...

How to create classes and interfaces in Linux without using an IDE

I am currently writting programs in linux like this: From the command line I do following steps: $ touch project.java $ nano project.java and I write the code. I have questions: how can I create new classes, interfaces and so on? Because in IDE like Betbeans I can right click on projects name with and choose "create new class" or "cr...

non blocking tcp connect with epoll

My linux application is performing non-blocking TCP connect syscall and then use epoll_wait to detect three way handshake completion. Sometimes epoll_wait returns with both POLLOUT & POLLERR revents set for the same socket descriptor. I would like to understand what's going on at TCP level. I'm not able to reproduce it on demand. My gue...

Incremental backup Linux command

What is the command to do a incremental backup? Any source or any links would be much appreciated. ...

Linux: is here a read or recv from socket with timeout?

Hello How can I try to read data from socket with timeout? I know, select, pselect, poll, has a timeout field, but using of them disables "tcp fast-path" in tcp reno stack. The only idea I have is to use recv(fd, ..., MSG_DONTWAIT) in a loop ...

CVS in cmd/gui works only the third time I run a command.

I'm using CVS in the command line. I'm in my repository folder. When I call a CVS command, I get... cvs [log aborted]: unrecognized auth response from localhost: -f [pserver aborted]: /opt/cvs/XXXXXX: no such repository ...2 times. The third time I run the command, it works with no problems. I tried to use a GUI client (CrossVC) and t...

cant open device

I have a little problem. I install this module into my kernel and its written under /proc When I try to open() it from user mode I get the following message: "Can't open device file: my_dev" static int module_permission(struct inode *inode, int op, struct nameidata *foo) { //if its write if ((op == 2)&&(writer == DOESNT_EXIST)){...

Pen Drive Control

I want to control television through pen drive. What should I do with pen drive means at hardware and software level? What type of kernel should I load and how I load the kernel and bootloader in pen driver? ...

configure script question: Where are user-given arguments stored?

If you look in config.log for any software package that uses a configure script, you will find that configure conveniently saves what the user has passed to configure. Example: ./configure PREFIX=$HOME/tmp --enable-foo --enable-bar My question is where can I find what the user passed in so I can save it as a string? I've already checke...

How do they read clusters/cylinders/sectors from the disk?

Hello, I needed to recover the partition table I deleted accidentally. I used an application named TestDisk. Its simply mind blowing. I reads each cylinder from the disk. I've seen similar such applications which work with MBR & partitioning. I'm curious. How do they read clusters/cylinders/sectors from the disk? Is there some ...

Use OpenBSD's malloc, realloc and free in my program

I would like to use OpenBSD's implementation of malloc, realloc and free on my Debian lenny desktop rather than glibc's. Are they simply drop in replacements: will they work on my Linux desktop ? Which are the file(s) that I need and which OpenBSD package contains them ? ...