Beginning Linux Programming, 4th Edition
Buy Rights Online Buy Rights

Rights Contact Login For More Details

More About This Title Beginning Linux Programming, 4th Edition

English

Beginning Linux Programming, Fourth Edition continues its unique approach to teaching UNIX programming in a simple and structured way on the Linux platform. Through the use of detailed and realistic examples, students learn by doing, and are able to move from being a Linux beginner to creating custom applications in Linux. The book introduces fundamental concepts beginning with the basics of writing Unix programs in C, and including material on basic system calls, file I/O, interprocess communication (for getting programs to work together), and shell programming. Parallel to this, the book introduces the toolkits and libraries for working with user interfaces, from simpler terminal mode applications to X and GTK+ for graphical user interfaces. Advanced topics are covered in detail such as processes, pipes, semaphores, socket programming, using MySQL, writing applications for the GNOME or the KDE desktop, writing device drivers, POSIX Threads, and kernel programming for the latest Linux Kernel.

English

Neil Matthew has been interested in and has programmed computers since 1974. A mathematics graduate from the University of Nottingham, Neil is just plain keen on programming languages and likes to explore new ways of solving computing problems. He’s written systems to program in BCPL, FP (Functional Programming), Lisp, Prolog, and a structured BASIC. He even wrote a 6502 microprocessor emulator to run BBC microcomputer programs on UNIX systems. In terms of UNIX experience, Neil has used almost every flavor since the late 1970s, including BSD UNIX, AT&T System V, Sun Solaris, IBM AIX, many others, and of course Linux. He can claim to have been using Linux since August 1993 when he acquired a floppy disk distribution of Soft Landing (SLS) from Canada, with kernel version 0.99.11. He’s used Linux-based computers for hacking C, C++, Icon, Prolog, Tcl, and Java at home and at work.
All of Neil’s "home" projects are developed using Linux. He says Linux is much easier because it supports quite a lot of features from other systems, so that both BSD- and System V-targeted programs will generally compile with little or no change.
Neil is currently working as an Enterprise Architect specializing in IT strategy at Celesio AG. He has a background in technical consultancy, software development techniques, and quality assurance. Neil has also programmed in C and C++ for real-time embedded systems.

Rick Stones started programming at school (more years ago than he cares to remember) on a 6502-powered BBC micro, which, with the help of a few spare parts, continued to function for the next 15 years. He graduated from Nottingham University with a degree in Electronic Engineering, but decided software was more fun.
Over the years he has worked for a variety of companies, from the very small with just a dozen employees, to the very large, including the IT services giant EDS. Along the way he has worked on a range of projects, from real-time communications to accounting systems, to very large help desk systems. He is currently working as an IT architect, acting as a technical authority on various major projects for a large pan-European company.
A bit of a programming linguist, he has programmed in various assemblers, a rather neat proprietary telecommunications language called SL-1, some FORTRAN, Pascal, Perl, SQL, and smidgeons of Python and C++, as well as C. (Under duress he even admits that he was once reasonably proficient in Visual Basic, but tries not to advertise this aberration.)

English

Acknowledgements x

Foreword xxiii

Introduction xxv

Chapter 1: Getting Started 1

An Introduction to UNIX, Linux, and GNU 1

Programming Linux 4

Getting Help 14

Summary 16

Chapter 2: Shell Programming 17

Why Program with a Shell? 18

A Bit of Philosophy 18

What Is a Shell? 19

Pipes and Redirection 21

The Shell as a Programming Language 23

Going Graphical — The dialog Utility 75

Putting It All Together 81

Summary 91

Chapter 3: Working with Files 93

Linux File Structure 94

System Calls and Device Drivers 96

Library Functions 97

Low-Level File Access 98

The Standard I/O Library 109

Formatted Input and Output 113

File and Directory Maintenance 120

Scanning Directories 122

Errors 127

The /proc File System 128

Advanced Topics: fcntl and mmap 132

Summary 135

Chapter 4: The Linux Environment 137

Program Arguments 137

Environment Variables 144

Time and Date 148

Temporary Files 156

User Information 158

Host Information 161

Logging 163

Resources and Limits 167

Summary 173

Chapter 5: Terminals 175

Reading from and Writing to the Terminal 175

Talking to the Terminal 180

The Terminal Driver and the General Terminal Interface 182

The termios Structure 184

Terminal Output 196

Detecting Keystrokes 205

Summary 209

Chapter 6: Managing Text-Based Screens with curses 211

Compiling with curses 212

Curses Terminology and Concepts 213

The Screen 216

The Keyboard 221

Windows 224

Subwindows 230

The Keypad 232

Using Color 235

Pads 238

The CD Collection Application 240

Summary 254

Chapter 7: Data Management 255

Managing Memory 255

File Locking 264

Databases 281

The CD Application 289

Summary 309

Chapter 8: MySQL 311

Installation 312

MySQL Administration 320

Accessing MySQL Data from C 335

The CD Database Application 358

Summary 375

Chapter 9: Development Tools 377

Problems of Multiple Source Files 377

The make Command and Makefiles 378

Source Code Control 392

Writing a Manual Page 406

Distributing Software 409

RPM Packages 413

Other Package Formats 424

Development Environments 424

Summary 427

Chapter 10: Debugging 429

Types of Errors 429

General Debugging Techniques 430

Debugging with gdb 437

More Debugging Tools 445

Assertions 452

Memory Debugging 453

Summary 459

Chapter 11: Processes and Signals 461

What Is a Process? 461

Process Structure 462

Starting New Processes 468

Signals 481

Summary 493

Chapter 12: POSIX Threads 495

What Is a Thread? 495

Advantages and Drawbacks of Threads 496

A First Threads Program 497

Simultaneous Execution 501

Synchronization 503

Thread Attributes 512

Canceling a Thread 517

Threads in Abundance 520

Summary 524

Chapter 13: Inter-Process Communication: Pipes 525

What Is a Pipe? 525

Process Pipes 526

Sending Output to popen 528

The Pipe Call 531

Parent and Child Processes 535

Named Pipes: FIFOs 540

The CD Database Application 553

Summary 575

Chapter 14: Semaphores, Shared Memory, and Message Queues 577

Semaphores 577

Shared Memory 586

Message Queues 594

The CD Database Application 599

IPC Status Commands 604

Summary 605

Chapter 15: Sockets 607

What Is a Socket? 608

Socket Connections 608

Network Information 624

Multiple Clients 632

Datagrams 642

Summary 644

Chapter 16: Programming GNOME Using GTK+ 645

Introducing X 645

Introducing GTK+ 648

Events, Signals, and Callbacks 655

Packing Box Widgets 658

GTK+ Widgets 661

GNOME Widgets 676

GNOME Menus 677

Dialogs 682

CD Database Application 687

Summary 699

Chapter 17: Programming KDE Using Qt 701

Introducing KDE and Qt 701

Installing Qt 702

Signals and Slots 705

Qt Widgets 712

Dialogs 727

Menus and Toolbars with KDE 733

CD Database Application Using KDE/Qt 738

Summary 746

Chapter 18: Standards for Linux 747

The C Programming Language 748

Interfaces and the Linux Standards Base 751

The Filesystem Hierarchy Standard 755

Further Reading about Standards 758

Summary 759

Index 761

Rights Sold

loading