Skip to content

How do I find the size of mounted USB flash drive in C?

I have a flash drive device (/dev/sda1) mounted to /mnt on an embedded linux system (kernel 2.6.23). Using C how do I work out the size of the drive? Answer On Linux, if you’re not worried about portability (C doesn’t know about drives, so any such specific code will be unportable), use statfs():

WX_CONFIG_OPTIONS: command not found

I’m trying to build Aegisub on linux mint, I’m getting the following error during ./autoget.sh Is there a specific package that I need to install or what exactly is the problem here? Answer There used to be an Arch Linux packaging page which stated that aegisub only supported version 2.9 of wxGTK …

How to display the process currently holding a semaphore?

In userspace Linux, I have a process blocking on a semaphore, as found by strace. Once the error condition occurs, the blocking is repeatable, so there must be another process that holds the semaphore and did not release it. Is there a way to know which other process is currently holding the semaphore? ipcs l…

How can I get name of the user executing my Perl script?

I have a script that needs to know what username it is run from. When I run it from shell, I can easily use $ENV{“USER”}, which is provided by bash. But apparently – then the same script is run from cron, also via bash – $ENV{“USER”} is not defined. Of course, I can: But it…

How to remove all .svn directories from my application directories

One of the missions of an export tool I have in my application, is to clean all .svn directories from my application directory tree. I am looking for a recursive command in the Linux shell that will traverse the entire tree and delete the .svn files. I am not using export, as this script will be used for some…