- Advanced Linux Programming
- Book Description
- Table of Contents
- Download Free PDF / Read Online
- Saved searches
- Use saved searches to filter your results more quickly
- License
- MentorEmbedded/advancedlinuxprogramming
- Name already in use
- Sign In Required
- Launching GitHub Desktop
- Launching GitHub Desktop
- Launching Xcode
- Launching Visual Studio Code
- Latest commit
- Git stats
- Files
- README.md
- About
- Advanced programing in linux
- Advanced programing in linux
- View the limit of the maximum number of open files (ulimit -a)
- View the maximum number of files allowed in the current system cat /proc/sys/fs/file-max
- File descriptor
- Error header file errno value
Advanced Linux Programming
This book will help you to: Develop GNU/Linux software that works the way users expect it to, Write more sophisticated programs with features such as multiprocessing, multi-threading, interprocess communication, and interaction with hardware devices, Improve your programs by making them run faster, more reliably, and more securely, Understand the preculiarities of a GNU/Linux system, including its limitations, special capabilities, and conventions.
Book Description
This book is not intended to be a comprehensive guide or reference to all aspects of GNU/Linux programming. Instead, we’ll take a tutorial approach, introducing the most important concepts and techniques, and giving examples of how to use them.
Because this is a book about advanced topics, we’ll assume that you are already familiar with the C programming language and that you know how to use the standard C library functions in your programs.The C language is the most widely used language for developing GNU/Linux software; most of the commands and libraries that we discuss in this book, and most of the Linux kernel itself, are written in C.
The information in this book is equally applicable to C++ programs because that language is roughly a superset of C. Even if you program in another language, you’ll find this information useful because C language APIs and conventions are the lingua franca of GNU/Linux.
Table of Contents
- Advanced Unix Programming with Linux
- Writing Good GNU/Linux Software
- Processes
- Threads
- Interprocess Communication
- Mastering Linux
- The /proc File System
- Linux System Calls
- Inline Assembly Code
- Security
- A Sample GNU/Linux Application
Download Free PDF / Read Online
Author(s): CodeSourcery, Mark L. Mitchell, Alex Samuel and Jeffrey Oldham
Format(s): PDF
File size: 3.69 MB
Number of pages: 368
Link: Download.
Saved searches
Use saved searches to filter your results more quickly
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.
Website for the Advanced Linux Programming book.
License
MentorEmbedded/advancedlinuxprogramming
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Sign In Required
Please sign in to use Codespaces.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching Xcode
If nothing happens, download Xcode and try again.
Launching Visual Studio Code
Your codespace will open once ready.
There was a problem preparing your codespace, please try again.
Latest commit
Git stats
Files
Failed to load latest commit information.
README.md
Advanced Linux Programming
Most of the content resides in the gh-pages branch. The master branch contains a README file and a LICENSE file.
About Advanced Linux Programming
Advanced Linux Programming by Mark Mitchell, Jeffrey Oldham, and Alex Samuel, of CodeSourcery LLC published by New Riders Publishing ISBN 0-7357-1043-0 First Edition, June 2001
Advanced Linux Programming is intended for the programmer already familiar with the C programming language. Authors Alex Samuel, Jeffrey Oldham, and Mark Mitchell of CodeSourcery, LLC take a tutorial approach and teach the most important concepts and power features of the GNU/Linux system in application programs.
If you’re a developer already experienced with programming for the GNU/Linux system, are experienced with another UNIX-like system and are interested in developing GNU/Linux software, or want to make the transition for a non-UNIX environment and are already familiar with the general principles of writing good software, this book is for you. In addition, you will find that this book is equally applicable to C and C++ programming. Even those progamming in other languages will find this book useful since the C language APIs and conventions are the lingua franca of GNU/Linux.
About
Website for the Advanced Linux Programming book.
Advanced programing in linux
Introduction to a Unix / Linux system
unix / C Unix is an operating system Proficient in application operating system Unix / Linux C is a computer language Basic command LS CD CP MKDIR RM TAR file permissions pipeline data redirect "Bird Brother Private Food> C language data structure Linux / C like Unix 15 -day lecture 3 -day project
What is the operating system? Taking the car operating system as an example: Steering system steering wheel Human manpower steering is unsafe and low-efficiency and waste . ---> Direct Mechanical steering safe and efficient . ----> indirect Refueling system throttle Navigation System . Multiple subsystem coordination work achieves a purpose The hardware of the car was indirectly controlled through the operating system of the car indirectly Computer operating system: CPU hard disk memory network card usb . Process Management CPU indirect management Memory Memory Management File system management Network communication management Equipment file management ---> LINUX under everything file Computer operating system management computer's hardware resources and software resources of the computer and software resources The difference between procedures and processes? The program is the collection of instructions, which are stained on the disk. Static The process of the process is the instance of the program execution, which is in memory and dynamic The program runs once to generate a process. Run multiple processes multiple times Interface: The user of the interface implementation interface C language function implementation interface
Advanced programing in linux
Advanced programming in Linux environment
#include #include #include int open(const char *pathname, int flags); int open(const char *pathname, int flags, mode_t mode); int creat(const char *pathname, mode_t mode);
#include ssize_t write(int fd, const void *buf, size_t count);
ssize_t read(int fd, void *buf, size_t count);
Ssize_t signed type, (typedef definition)
View the limit of the maximum number of open files (ulimit -a)
core file size (blocks, -c) 0 data seg size (kbytes, -d) unlimited scheduling priority (-e) 0 file size (blocks, -f) unlimited pending signals (-i) 7976 max locked memory (kbytes, -l) 64 max memory size (kbytes, -m) unlimited open files (-n) 65536 pipe size(512 bytes, -p) 8 POSIX message queues (bytes, -q) 819200 real-time priority (-r) 0 stack size (kbytes, -s) 8192 cpu time (seconds, -t) unlimited max user processes (-u) 7976 virtual memory (kbytes, -v) unlimited file locks (-x) unlimited
View the maximum number of files allowed in the current system cat /proc/sys/fs/file-max
File descriptor
STDIN_FILENO 0 STDOUT_FILENO 1
Error header file errno value
/usr/include/asm-generic/errno-base.h /usr/include/asm-generic/errno.h #define EPERM 1 /* Operation not permitted */ #define ENOENT 2 /* No such file or directory */ #define ESRCH 3 /* No such process */ #define EINTR 4 /* Interrupted system call */ #define EIO 5 /* I/O error */ #define ENXIO 6 /* No such device or address */ #define E2BIG 7 /* Argument list too long */ #define ENOEXEC 8 /* Exec format error */ #define EBADF 9 /* Bad file number */ #define ECHILD 10 /* No child processes */ #define EAGAIN 11 /* Try again */ #define ENOMEM 12 /* Out of memory */ #define EACCES 13 /* Permission denied */ #define EFAULT 14 /* Bad address */ #define ENOTBLK 15 /* Block device required */ #define EBUSY 16 /* Device or resource busy */ #define EEXIST 17 /* File exists */ #define EXDEV 18 /* Cross-device link */ #define ENODEV 19 /* No such device */ #define ENOTDIR 20 /* Not a directory */ #define EISDIR 21 /* Is a directory */ #define EINVAL 22 /* Invalid argument */ #define ENFILE 23 /* File table overflow */ #define EMFILE 24 /* Too many open files */ #define ENOTTY 25 /* Not a typewriter */ #define ETXTBSY 26 /* Text file busy */ #define EFBIG 27 /* File too large */ #define ENOSPC 28 /* No space left on device */ #define ESPIPE 29 /* Illegal seek */ #define EROFS 30 /* Read-only file system */ #define EMLINK 31 /* Too many links */ #define EPIPE 32 /* Broken pipe */ #define EDOM 33 /* Math argument out of domain of func */ #define ERANGE 34 /* Math result not representable */
When the error is reported, the error code is written to errno, strerror(errno) can get the wrong explanation, and perror() can also get the wrong explanation.
#include char *strerror(int errnum); #include void perror(const char *s);
lseek - reposition read/write file offset #include #include off_t lseek(int fd, off_t offset, int whence);