Unix programming FAQ

Source: Internet
Author: User
Unix programming FAQ v0.10

I accidentally found a Unix programming FAQ. Fortunately, it has been translated into a Chinese version! Although old, it is still useful.
Provided by linuxforum.net. Thank you for your contribution.

The following is the chapter directory. The original Article is still on linuxforum.net, so it should not be a leeching!

 

Table of contents
About
Original English version
Original Chinese Version
This Chinese HTML document
1. Process Control
1.1. Create a new process: fork Function
1.1.1. What is the fork function?
1.1.2. What is the difference between the fork function and the vfork function?
1.1.3. Why use the _ exit function instead of the exit function in a fork subprocess branch?
1.2. Environment Variables
1.2.1. How do I obtain/set environment variables from a program?
1.2.2. How do I read the entire environment variable table?
1.3. How can I sleep for less than one second?
1.4. How can I get a version of the alarm function that is more subdivided into time units?
1.5. How do parent and child processes communicate?
1.6. How can I remove zombie processes?
1.6.1. What is a zombie process?
1.6.2. How can I avoid them?
1.7. How can I run my program as a daemon?
1.8. How can I review system processes like PS programs?
1.9. Given a process number, how do I know it is a running program?
1.10. What is the return value of the system function, pclose function, and waitpid function?
1.11. How can I find out the memory usage of a process?
1.12. Why is the process size not reduced?
1.13. How can I change the name of my program (that is, the name seen by "Ps )?
1.14. How can I find the executable file of the process?
1.14.1. Where can I put the configuration file?
1.15. Why didn't my process receive a sighup signal when the parent process died?
1.16. How do I kill all the derivative processes of a process?
2. General file operations (including pipelines and sockets)
2.1. How to manage multiple connections?
2.1.1. How do I use the select () function?
2.1.2. How do I use poll ()?
2.1.3. Can I use sysv IPC and select ()/poll () at the same time ()?
2.2. How can I know that the connection with the other party is terminated?
2.3. What is the best way to read a directory?
2.4. How can I know that a file is opened by another process?
2.5. How do I lock a file?
2.6. How can I find that a file has been updated by another process?
2.7. How does Du work?
2.8. How do I get the length of a file?
2.9. How can I extend the '~ in the file name like in shell '~ '?
2.10. What can a famous pipe (FIFO) do?
2.10.1. What is a famous Pipeline?
2.10.2. How do I create a famous Pipeline?
2.10.3. How do I use a famous pipe?
2.10.4. Can I use a famous pipe on NFS?
2.10.5. Can multiple processes write data to a famous pipeline at the same time?
2.10.6. Application of famous Pipelines
3. Terminal input/output
3.1. How can I keep my program from input?
3.2. How do I read a single character from a terminal?
3.3. How can I check if a key is down?
3.4. How can I move the cursor in the screen?
3.5. What is pttys?
3.6. How to control a serial port and modem?
3.6.1. Serial Devices and types
3.6.2. Set the termios flag
4. System Information
4.1. How do I know the storage capacity of my system?
4.2. How can I check a user's password?
4.2.1. How can I get a user's password?
4.2.2. How can I get the password in the shadow password file through the user number?
4.2.3. How can I check a user's password?
5. Programming Acrobatics
5.1. How do I use wildcard characters to compare strings?
5.1.1. How can I compare strings using the wildcard mode of file names?
5.1.2. How do I use regular expressions to compare strings?
5.2. What is the best way to send emails in a program?
5.2.1. Simple Method:/bin/mail
5.2.2. Directly start the mail Transmission Proxy:/usr/bin/sendmail
6. Use of tools
6.1. How can I debug the subprocesses produced by the fork function?
6.2. How to create a new library file through other library files?
6.3. How to create a dynamic Connection Library (shared library)/DLLs?
6.4. Can I change the target of a dynamic Connection Library?
6.5. Can I generate a stack image in a running program?
7. Sample program
Capture sigchld Signal
Read progress table-SunOS 4
Read the table-sysv
Read progress table-Aix 4.2
Use the popen function and ps command to read the table
Daemon tool Functions
Modem Control example Program
Transaction Control example Program

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.