1. Unix Shell functions A shell is a program that manages processes and runs programs. All the common shells have 3 main functions: (1) running the program; (2) Managing inputs and outputs (3) Programmable The shell is also a programming language with variable and process control. 2. UNIX Process Model A program is a sequence of machine instructions stored in a
Each device file supports system invoke IOCTL:
Goal: Control a device
Header files: #include
Function prototype: int result = IOCTL (int fd, int operation [, Arg ...]);
Parameters
FD: File descriptor associated with file
Operation: Type of operation
ARG: Optional parameter
Result:-1 is wrong; 0 is correct;
In fact, the source or destination of any data is treated by
as follows:
# Include Running result:
Output was : -Linux book-desktop 2.6.31-14-generic #48-Ubuntu SMP Fri Oct 16 14:04:26 UTC 2009 i686 GNU/LinuxThe example program of type W is as follows:
#include The program result is as follows:
0000000 O n c e u p o n a t i m e0000020 t h e r e w a s . . . \n0000037The above pipe function can also be used to implement client-server progr
UNIX network programming is indeed a rare book. Its advantage lies not only in its thorough theory, but also in its clear programming examples. To put it bluntly, when I first started viewing the three sets of Unix programming, I
"UNIX Network Programming Volume 1" Source code can be downloaded from www.unpbook.com. The directory after decompression is unpv13e.1. CompilingTo enter the unpv13e directory, compile as follows:1./Configure2 3 cd Lib4 Make //may encounter problems: redefinition of ' struct in_pktinfo '5 6Cd.. /Libfree7 Make 8 9Cd.. /LibrouteTen Make //This step can be error, can be ignored, only indicates that your
("Rlimit_core", Rlimit_core);
Process Control
Introduction
We now turn to the process control provided by the UNIX System. This is includes the creation of new processes, program execution, and process termination. We also look at the various IDs this are the property of the Process-real, effective, and saved; User and group Ids-and how they ' re affected by the process control primitives. Interpreter f
UNIX advanced environment programming (5) Files And Directories, unixdirectories
1 File Times
Each file maintains three time fields, each representing a different time field. See the following table:
Field description:
St_mtim (the modification time) records the last time the file content was modified.
St_ctim (the changed-status time) records the last time the I-node of the file was modified, such as m
socket, even after you gracefully close the socket.For example, let's say you write a program that the server waits on a socket. It is no problem for the server to open the socket and listen on it. In any case, there are always some reasons (whether it's normal or abnormal end-of-process)Make your program require a restart. However, after restarting you will not be able to bind it to the original port. The error code returned from the bind () system
backup, such as terminals or network devices. When reading and writing a device, you usually do not want to buffer data. For example, writing data to a file representing a network device means you want the data to be sent out through a network device, instead of writing data to the buffer zone, the application will be notified immediately when the network device receives the data, therefore, the unbuffered I/O function is usually directly called for network
, exec, and exit on IPC objects
1. Considering unknown synchronization variables (mutex lock, condition variable, read/write lock, POSIX memory-based semaphore), calling fork from a process with multiple threads will become messy.
2. System v ipc is not enabled or disabled in three forms. To access these three forms of IPC objects, you only need to know their identifiers, so any process that knows the identifiers can access them.
6. the IPC exampl
)
Sql_fetch_first_user
Set the Sqldatasources () function to find the first user DSN
Sql_fetch_first_system
Set the Sqldatasources () function to find the first system DSN
Sql_fetch_next
The next data source is found, and the data source type is based on the previous definition
Here, we have finished the ODBC programming under the
The following describes how to program the network with simple but typical client and server programs. This section describes the client, a client used to connect to and read the time sent by the server.
This involves writing code, so we need
Build a UNIX Network Programming Environment
The UNIX system is not installe
Look, we saw the first program in this book.1#include"apue.h"2#include 3 4 int5MainintargcChar*argv[])6 {7DIR *DP;8 structDirent *Dirp;9 Ten if(ARGC! =2) OneErr_quit ("Usage:ls Directory_name"); A - if(DP = Opendir (argv[1])) ==NULL) -Err_sys ("can ' t open%s", argv[1]); the while((DIRP = Readdir (DP))! =NULL) -printf"%s\n", dirp->d_name); - - Closedir (DP); +Exit0); -}This program is almost the same as the LS command, which has no
Unix shell programming (5)
The filter TR is used to convert characters from standard input. Format:Tr from-chars to-charsFrom-chars and to-chars are one or more characters. For example:[Root @ localhost programs] # Cat introThe UNIX operating system was pioneered by KenThompson and Dennis Ritchie at Bell LaboratoriesI
The book "Advanced Programming in UNIX environments" comes with many small and exquisite programs. When I read this book, rewrite the code in the book according to your own understanding (most of them are on the copybook) to deepen your understanding (it's too difficult to r
The book "Advanced Programming in UNIX environments" comes with many small and exquisite programs. When I read this book, rewrite the code in the book according to your own understanding (most of them are on the copybook) to deepen your understanding (it's too difficult to r
The book "Advanced Programming in UNIX environments" comes with many small and exquisite programs. When I read this book, rewrite the code in the book according to your own understanding (most of them are on the copybook) to deepen your understanding (it's too difficult to r
2016.8.14 21:40-22:101.3 Friction between UNIX and LINUX1.3 Unix The friction between his LinuxBecause They is similar, this book covers both UNIX and Linux systems. Unfortunately, mentioning UNIX and Linux together in the same sentence can sometimes is like stepping into a
Recently, I finally bought the UNIX bible "Advanced Programming for UNIX environments.
After reading the book today, I want to take out the source code in the book and compile it on my own to see what the results are. I found that the compilation was not smooth.
First, let'
The book "Advanced Programming in UNIX environments" comes with many small and exquisiteProgramWhen I read this bookCodeI have rewritten it according to my own understanding (most of it is on the copybook) and deepened my understanding (it is too difficult to read a book, haha ). This example is successfully tested on
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.