≡ Menu

C Programming

Understanding and using interrupt management under Linux

This article describes the most important concepts related to the Linux kernel's interrupt handling mechanisms.

A clear understanding of the Linux kernel's interrupt handling mechanism is essential if you are to write solid, reusable device interrupt handlers. It is also mandatory if you are to successfully port Linux to custom hardware.

Bill Gatliff provides a walkthrough of the portions of the Linux kernel that manage interrupts and describes how Linux interacts with interrupt controllers and how to adapt code for custom hardware.

Interrupt handling is a fundamental part of the Linux kernel. Most of the kernel's functionality, in particular the parts of interest to embedded developers, in some way involve interrupt handling.

=> Interrupt Management Under Linux - Using the Interrupt Controller API

Unix Programming faqs, howto resources on Web and books

=> FAQ collection from comp.unix.programmer (mirror 2)

=> The Art Of Unix Programming book by ESR

=> More links and resources - Davin's collection of unix programming links


=> Advanced UNIX Programming by Warren W Gay. Sams White Book - Provides the fundamentals of UNIX programming and easy to follow book for all new programmers/students.

=> Advanced Programming in the UNIX(R) Environment (2nd Edition) - The best book if you wanna be a UNIX guru. I am currently reading this book for my computer science UNIX programming class.

Download advanced Linux programming book PDF version

If you are a developer for the GNU/Linux system, this book will help you to write and/or develop GNU/Linux software that works the way users expect it to.

Advanced Linux Programming is published under the Open Publication License, Version 1, no options exercised. (Due to an oversight in final production, the copyright notice on the book is incorrect.) The full text may be downloaded from this site. Code samples in the book are covered by the GNU General Public License and are also available.


Chapter 01 - Advanced Unix Programming with Linux
Chapter 02 - Writing Good GNU/Linux Software
Chapter 03 - Processes
Chapter 04 - Threads
Chapter 05 - Interprocess Communication
Chapter 06 - Mastering Linux
Chapter 07 - The /proc File System
Chapter 08 - Linux System Calls
Chapter 09 - Inline Assembly Code
Chapter 10 - Security
Chapter 11 - A Sample GNU/Linux Application

Download link

=> Advanced Linux programming book, by Mark Mitchell, Jeffrey Oldham, Alex Samuel (via Digg)

HowTo Compile a 32-bit Application Using gcc On the 64-bit Linux Version

I had to compile a 32-bit application using GNU gcc on the 64-bit version of Linux.
[click to continue…]

How to debug make: tips for debugging makefiles

The purpose of the make utility is to determine automatically which pieces of a large program need to be recompiled, and issue the commands to recompile them.

To prepare to use make, you must write a file called the makefile that describes the relationships among files in your program, and the states the commands for updating each file.

Sometime makefiles become so large, you need to debug them.

This article helps you to get make to work for you, not against you i.e. debugging make and its makefiles.

From the article:
Make and utilities like it are fundamental tools for streamlining the application build process. Learn the structure of the makefile, how to avoid common mistakes in its creation, and how to solve or work around portability issues and other problems as they crop up.

Most UNIX and Linux programs are built by running make. The make utility reads a file (generally named either "makefile" or "Makefile," but hereafter merely referred to as "a makefile") that contains instructions and performs various actions to build a program. In many build processes, the makefile is itself generated entirely by other software; for instance, the autoconf/automake programs are used to develop build routines. Other programs may ask you to directly edit a makefile, and of course, new development may require you to write one.

Read more at IBM developerworks [ibm.com]

How a Web server actually works ~ with C source code

Do you wonder how to write a program that accepts incoming messages with a network socket? Have you ever just wanted your own Web server to experiment and learn with?

Have you ever wondered how a Web server actually works? Experiment with nweb -- a simple Web server with only 200 lines of C source code. In this article, Nigel Griffiths provides a copy of this Web server and includes the source code as well. You can see exactly what it can and can't do.

Well, look no further -- nweb is what you need. This is a simple Web server that has only 200 lines of C source code. It runs as a regular user and can't run any server-side scripts or programs, so it can't open up any special privileges or security holes.

This article covers:

  • What the nweb server program offers
  • Summary of C functions features in the program
  • Pseudo code to aid understanding of the flow of the code
  • Network socket system calls used and other system calls
  • How the client side operates
  • C source code

nweb only transmits the following types of files to the browser :

  • Static Web pages with extensions .html or .htm
  • Graphical images such as .gif, .png, .jgp, or .jpeg
  • Compressed binary files and archives such as .zip, .gz, and .tar
  • If your favorite static file type is not in this list, you can simply add it in the source code and recompile to allow it.

Read more at IBM developerworks...

Tutorial: How to write cross-platform GUIs using wxWidgets

wxWidgets logo

Windows and X widgets (wxWidgets) is an open source, cross-platform widget toolkit; that is, a library of basic elements for building a graphical user interface (GUI)

wxWidgets lets developers create applications for Win32, Mac OS X, GTK+, X11, Motif, WinCE, and more using one codebase. It can be used from languages such as C++, Python, Perl, and C#/.NET. Unlike other cross-platform toolkits, wxWidgets applications look and feel native. This is because wxWidgets uses the platform's own native controls rather than emulating them. It's also extensive, free, open-source, and mature.

With this tutorial you will learn how to use the wxWidgets toolkit to create elegant and highly useful GUIs in your programming language of choice.

But why use wxWidgets? Because you want to be able to write a GUI quickly and easily that runs across platforms. You also want to be able to use the programming language of your choice, and you want your GUI looks cool or same on all platform.

Personally, I prefer to use QT toolkit. But I will give a shot to wxWidgets :D