linux

AT&T vs Intel Syntax and Limitations?

To me, Intel syntax is much easier to read. If I go traipsing through assembly forest concentrating only on Intel syntax, will I miss anything? Is there any reason I would want to switch to AT&T (outside of being able to read others' AT&T assembly)? My first clue is that gdb uses AT&T by default. If this matters, my focus is only on any...

Migrating tiny C# console app to something running on Ubuntu Server 9.04

I'm a linux noob wanting to migrate this piece of C# code: using System; using System.IO; using System.IO.Ports; public class LoadCell { private static string configFile = Directory.GetCurrentDirectory() + "\\LoadCell.config"; private static string errorLog = Directory.GetCurrentDirectory() + "\\LoadCell.log"; private stati...

In Perl module Proc::ProccessTable, why does pctcpu sometimes return 'inf', 'nan', or a value greater than 100?

The Perl module Proc::ProcessTable occasionally observes that the pctcpu attribute as 'inf', 'nan', or a value greater then 100. Why does it do this? And are there any guidelines on how to deal with this kind of information? We have observed this on various platforms including Linux 2.4 running on 8 logical processors. I would guess ...

Maillog file in linux

I accidently delelte /var/log/maillog, after I recreate it, but postfix wouldn't write any mail log into it anymore, I restart postfix, no help, anyone know why? ...

Change Gnome terminal theme programmatically

I'd like to create a setup on my local machine (Ubuntu GNOME) whereby the terminal window has a different background color depending on whether I'm logged in to my local machine or ssh'd into a remote machine. Is there a way to do this? ...

What does "ulimit -l" mean?

According to the manpage, "-l" in ulimit means "The maximum size that may be locked into memory". What does this sentence mean, exactly? How may it affect running programs? ...

is there a limit for the number of sk_buffs in the kernel

Hi, I need to steal some SKBs in my NetFilter hook, and retain them for some time. Is there a limit in the kernel about how many SKBs can I use at a time? What are the consequences of having some 100,000 or even more SKBs held in my kernel module? I could avoid copying my packets two time if I can have many-many SKBs. Regards, Denes ...

Read characters from a text file using bash

Does anyone know how I can read the first two characters from a file, using a bash script. The file in question is actually an I/O driver, it has no new line characters in it, and is in effect infinitely long. ...

Stack unwinding on HP-UX and Linux

I need to get the stack information of my C application in certain points. I've read the documentation and searched the Net but still cannot figure out how I can do it. Can you point to a simple process explanation? Or, even better, to an example of stack unwinding. I need it for HP-UX (Itanium) and Linux. Thanks ...

Problem with Python interpreter in Eclipse

When trying to set the interpreter for python in Eclipse by choosing the executable, clicking OK displays "An error has occured." Does the interpreter name matter? ...

Why does my Perl script fail on "~/" but works with "$ENV{HOME}"?

I have been using this script of mine FOREVER and I have always been using "~/" to expand my home directory. I get into work today and it stopped working: #if ( $output eq "" ) { $output = "~/tmp/find_$strings[0].rslt" } # BROKEN if ( $output eq "" ) { $output = "$ENV{HOME}/tmp/find_$strings[0].rslt" } #WORKS ... open OUT_FILE,...

Sleep while holding a boost::interprocess::scoped_lock causes it to be never released

Hi, I'm doing IPC on Linux using boost::interprocess::shared_memory_object as per the reference (anonymous mutex example). There's a server process, which creates the shared_memory_object and writes to it, while holding an interprocess_mutex wrapped in a scoped_lock; and a client process which prints whatever the other one has written ...

Iterating over lists in Makefiles?

I find I'm writing a lot of Makefiles that could be cleaned up with the use of n-tuple lists. But I can't find any way to do this properly (and cleanly). So far I've only been able to come up with using $(shell ...) and tr, sed, or otherwise non-Makefile standards. For example, I'd like to do this: XYZs = \ dog.c pull_tail bark \...

Handling User-Break (UART Break) on a /dev/tty device in Linux

Here is some code sample, but the issue is that the signal handler is not called when a 'break' is sent over the serial line with 'putty'. #include <sys/ioctl.h> #include <termios.h> #include <stdio.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <sys/signal.h> #include <errno.h> #include <sys/types.h> #inclu...

ulimit -t under ubuntu

I am running Ubuntu Linux (2.6.28-11-generic #42-Ubuntu SMP Fri Apr 17 01:57:59 UTC 2009 i686 GNU/Linux) and it seems that the command "ulimit -t" does not work properly. I ran: ulimit -t 1; myprogram where 'myprogram' is an endless loop. I expected the program to be interrupted after 1 second, but it did not stop. I tried the same thi...

How to programatically cause a core dump in C/C++

I would like to force a core dump at a specific location in my C++ application. I know I can do it by doing something like: int * crash = NULL; *crash = 1; But I would like to know if there is a cleaner way? I am using Linux by the way. ...

which cross compiler ??

hello... please tel me what is the difference between MinGW cross compiler and GCC Cross compiler. which is used in which Operating System?? i'm very much in confusion... I need to create ".exe" in Linux Operating system using QT, hence tel me which is the cross compiler to be used. Please do reply. ...

How can I use aliased commands with xargs?

I have the following alias in my .aliases: alias gi grep -i and I want to look for foo case-insensitively in all the files that have the string bar in their name: find -name \*bar\* | xargs gi foo This is what I get: xargs: gi: No such file or directory Is there any way to use aliases in xargs, or do I have to use the full versi...

How do I reliably track child/grandchild processes on a POSIX system?

I have an interesting (at least to me) problem: I can't manage to find a way to reliably and portably get information on grandchildren processes in certain cases. I have an application, AllTray, that I am trying to get to work in certain strange cases where its subprocess spawns a child and then dies. AllTray's job is essentially to d...

What's a binary file and how do I create one?

I would like to create a binary file representing an integer. I think the file should be 4 bytes. I use linux. How to do that? Another question: How do I assign the content of that file to an integer in C? ...