linux

How to read vfat attributes of files in Linux using C

I have a FAT filesystem mounted in Linux with the vfat driver. I want to know how I would be able to read the vfat attributes of a file such as "hidden" and "read-only". Based on what I've read so far, if I use the stat() glibc command on a file, I would only be getting the file attributes listed here: http://www.gnu.org/s/libc/manua...

linux shell date question

shell>/bin/date -d "091029 20:18:02" +%s 1256827682 Similarly I created shell script: #My.sh myDate=`date +'%y%m%d_%H%M%S'` myDate1=`echo $myDate | sed 's/_/ /g'` myDate2=`echo $myDate1 | sed 's/\([0-9][0-9][0-9][0-9][0-9][0-9]\) \([0-9][0-9]\)\([0-9][0-9]\)\([0-9][0-9]\)/\/bin\/date -d "\1 \2:\3:\4" +%s/'` print $myDate2 `$myDate2` ...

automatic renaming and numbering of nics using udev

I'm writing on an udev-rule to automatically rename and number NICs with specific MAC addresses. The resulting rule should do nearly the same 75-persistent-net-generator.rules does (match first 3 bytes of the MAC address of card, name it 'mycard*' depending on how much cards of this vendor are installed, write the renaming-rule into 70-...

Sockets On Same Machine For Windows and Linux

How efficient is it to use sockets when doing IPC as compared to named pipes and other methods on Windows and Linux? Right now, I have 4 separate apps on 4 separate boxes that need to communicate. Two are .NET 3.5 applications running on Windows Server 2003 R2. Two are Linux (Suse Linux 10). They're not generally CPU bound. The amou...

Get list of certificate issuers in Firefox on Linux

I need the ability to automatically check if the current user has a certificate installed from a specific issuer in the Firefox certificate store on Linux. Ideally I'd like to be able to this from outside of Firefox however doing it from a plugin is also an option. The best I've come up with so far involves chaining certutil and grep bu...

Is mq_send atomic?

Hi, can anybody tell me what happens if multithread program receives SIGSTOP signal during execution of mq_send? ...

Does running an SMP kernel on a single-cpu machine hurt performance?

On my Ubuntu machine, default kernel image which is running is built for smp (CONFIG_SMP=y). But this machine has only 1 cpu. On uni-processor kernel, unlike smp kernel, spin_lock/unlock are null functions. So how does spin_lock() and spin_unlock behave in this setup? Is there any performance impact due to such smp specific code? ...

C++ Boost: is it included by default in most Linux distros?

Is the C++ Boost library usually included by default on most Linux distros? ...

What caused the mysterious duplicate entry in my stack?

I'm investigating a deadlock bug. I took a core with gcore, and found that one of my functions seems to have called itself - even though it does not make a recursive function call. Here's a fragment of the stack from gdb: Thread 18 (Thread 4035926944 (LWP 23449)): #0 0xffffe410 in __kernel_vsyscall () #1 0x005133de in __lll_mutex_loc...

Is it possible using Linux's clone() system call to run multiple applications in the same address space?

If you don't pass the CLONE_VM flag to clone(), then the new process shares memory with the original. Can this be used to make two distinct applications (two main()'s) run in the same process? Ideally this would be as simple as calling clone() with CLONE_VM and then calling exec(), but I realize it's probably more involved. At the very l...

Do any POSIX functions or glibc extensions implement a breadth-first file tree walk?

I am writing a daemon that utilizes inotify to monitor file access and it is critical that I don't miss anything on a recursive search. I found this interesting idea and have begun to implement it. ftw() and ftw64() do not use a breadth-first algorithm, its more "pre-order". nftw() gives me the option of depth-first, but I'm worried abo...

How to get more vfat attributes of files in Linux using C?

This is a follow-up to my other question here: http://stackoverflow.com/questions/1644416/how-to-read-vfat-attributes-of-files-in-linux-using-c -- I saw this struct in linux/msdos_fs.h: struct msdos_dir_entry { __u8 name[8],ext[3]; /* name and extension */ __u8 attr; /* attribute bits */ __u8 lcase; /* Case for ...

Segmentation fault when catching exceptions in a libpthread linked app ( linux, C++ )

Hi I have this piece of code here: These are functions used to create and stop a pthread: void WatchdogController::conscious_process_handler_start() { if ( debug ) cout << "WatchdogController: starting conscious process thread" << endl; cn_pr_thread_active = true; if ( pthread_create( &cn_pr_thread, NULL, conscious_proc...

Problem with chardev.c example from The Linux Kernel Module Programmers Guide

I compiled and ran the chardev.c example from the lkmpg and when writing to the device received an unexpected error: anon@anon:~/lkmpg$ sudo echo "hi" > /dev/chardev bash: /dev/chardev: Permission denied The module write function looks like this: /* * Called when a process writes to dev file: echo "hi" > /dev/chardev */ static s...

Recently, i am on a project which needs raw read / write sector of drives

Before, I post a question here asking for advice on how to read and write data from and into drive, not via file label like "aaa.txt", but just sectors.. I was advised to try read and write.... but new problems'v raised... the hairy parameters int _read( int handle, void *buffer, unsigned int count ); when i use the function and wanto ...

Choice of Linux

Which version of Linux would be my best choice if I want to use it as a development platform for both JEE and MONO? ...

Loading/unloading ELF sections on demand?

For a rather obscure use case I'd like to have a (large) statically linked Linux executable made up of a small piece of control code and large pieces of static (read-only) data. Is it possible, to save memory, to get the loader to load only the sections for the control code, and then manually load the sections of RO data as they are nee...

Is there a subversion appliance / toolset for the enterprise

I am looking for an enterprise subversion setup, that will fit the following requirements: I need at least 2 instances of the repository server for high availability reasons Management of multiple repositories The 2 repository servers need to be synchronized. Easy administration and configuration User & authorization management with L...

How do you know if syslog-ng stops your listening daemon?

I wrote a PHP program that hooks into syslog-ng (via syslog-ng.conf) and it's basically this: while (!feof(STDIN)) { $input = fgets(STDIN); process($input); } cleanup(); where process() and cleanup() are defined by me. The problem I am facing is that cleanup(2) is never called and I need it to be executed before the program e...

Changing std::endl to put out CR+LF instead of LF

I'm writing a program on a Linux platform that is generating text files that will be viewed on, inevitably, a Windows platform. Right now, passing std::endl into a ostream generates the CR character only for newlines. Naturally, these text files look wrong in MS Notepad. 1) Is there a way to change std::endl such that it uses CR+LF f...