Unix shell programming (2)
Character matchingThe asterisk (*) matches more than 0 characters, and the question mark (?) Match 1 character.For example:Ls [A-Z] * [0-9]Displays the list of objects whose names start with lowercase letters and end with digits.
Output redirectionCommand output is generally submitted to the standard output device and can be switched to the file. This is called output redirection
This blog is primarily for Eclipse-C, C + + open an existing project, and for use with the FileZilla and secure CRT.Open an existing project for the Eclipse for C, C + +1. In the menu bar file drop-down box, select "Import", it can be implemented to open an existing project. As shown in.Finally, click "Apply" and "Finish".Eclipse for C, C + +, and FileZilla are used in conjunction with the secure CRT.Compile on the secure CRT and make the compilation as shown in.This completes the entire accompa
. Start the terminal40. Enter the pathwatermark/2/text/ahr0cdovl2jsb2cuy3nkbi5uzxqvaxrjyxn0y3bw/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/ Dissolve/70/gravity/southeast "/>41. Compile and run42. Write a C + + code 1,CC43. Print statements, C + +44. Print out the results45. Drive HelloWorld#include #include Module_license ("Dual BSD/GPL");//Follow the Linux protocolstatic int hello_init (void){PRINTK (Kern_alert "Hello, world\n");//Print driver informationreturn 0;}static void Hello_exit (void
Each process has a unique process ID that is represented by a nonnegative integer. However, the process ID is reusable. A process with id 0 is usually a dispatch process, also called a call process, which is part of the kernel. Process 1 is typically the INIT process, which is called by the kernel at the end of the bootstrap process (/sbin/init).Note ^ (* ̄ (oo)  ̄) ^:C program's storage space layout :1) Body Segment 2) initialization data segment 3) non-initialized data segment 4) stack 5) heap A
)); Exit (-1); } alrm_is_pending ("before alarm"); Alarm (2); Sleep (4); Alrm_is_pending ("After alarm"); Exit (0);}sigpendingdemo.cCompile the program SIGPENDINGDEMO.C, generate and execute the file Sigpendingdemo. From the results below, we see that the call to the alarm function generates a signal SIGALRM, which is the signal set in the set parameter of the Sigpending function.gcc -o sigpendingdemo sigpendingdemo.clienhua34:demo$. /Sigpendingdemobefore ALARM:SIGALRM isn't pendingafter alarm:s
represents a thread that unlocks the mutex of another thread when unlocked to indicate when a thread unlocks a mutex that has been unlocked.the type of mutex can be managed through the Pthread_mutexattr_gettype function and the Pthread_mutexattr_settype function. 3. Read-Write Lock propertiesThe only property supported by the read-write lock is the process share property, which is the same as the mutex process share property and can be manipulated by the appropriate get and set functions.4. Bar
Recently in the revision of APUE ("UNIX Environment Advanced Programming"), previously in Linux, and now intend to get down in their own machine, so Google, the compilation of things done, modify some of the tutorials some errors, such as download links and so on.
1, download source files, I am here is the second edition, looks like the third edition of the English version out ...
Copy Code code as
Unix/linux Shell Programming Combat: Using embedded documents here documents
First, here documents (embedded documents)Here, documents. As a way of redirecting, instructs the shell to start reading the output at the current location of the source file until it encounters a text row that contains only one word. All lines of text that are read in this procedure are used as standard input for a command.Here-d
header Files : #include Function Description:FILE * Popen (const char * command, const char * type); int pclose (file * stream);Description: (Refer to Advanced Programming for UNIX environments)the Popen () function creates a child process by creating a pipe, calling fork, and executes a shell to run the command to open a process. This process must be closed by the Pclose () function instead of the fclose
UNIX advanced environment programming (6) standard I/O function library and I/O function library
The standard I/O function library hides the buffer size and allocation details so that we don't have to worry about whether the pre-allocated memory size is correct.
Although this makes this function library easy to use, if we are not familiar with the function principle, we may also encounter many problems.
1.
UNIX advanced environment programming (11) Process Control-Process snapshot, User Identifier, Process scheduling, unixprocess
1. Process Accounting)
When a process is terminated, the kernel saves some data for the process, including a small portion of the binary data, CPU time, startup time, user Id, and group Id of the command. This process is called process accounting.
The acct function enables or disable
UNIX advanced environment programming (12) Process Relationships-terminal logon Process, Process group, Session, unixrelationships
In the previous chapter, we learned that processes are associated with each other:
Each process has a parent process;
When a child process exits, the parent process can perceive and obtain the exit status of the child process.
In this chapter, we will understand:
More deta
already exists:
If the size of the new value is smaller or equivalent than the value already exists, overwrite the old value directly;
If the new value is larger than the value already exists, then we must make a new memory space for the new value malloc, copy the new value into that memory, and replace the pointer to the old value with a pointer to the new value.
If we add an environment variable:
First we need to call malloc to allocate space for the string n
is not a lot of people tell you, learn Python development should honestly find books to see, and then with the Doom knocking code? The computer has, the software also has, the heart also received back? All you have to do is just owe books? Didn't find the right book? Can look at these.1.Basic Python Tutorial (2nd edition revision)650) this.width=650; "Src=" http://5b0988e595225.cdn.sohucs.com/images/20170830/ E30272cbb0f74e2394741f8b987c4cb8.png "alt=
Apue.h#ifndef apue_sunyj#define apue_sunyjvoid err_quit (const char *fmt, ...); void Err_sys (const char *fmt, ...); #endifError.cpp#include Primary purpose, in centos6.3 64-bit machines, use Eclipse to learn Apue third edition, And this study does not use the book apue.h, and some libraries under the LIB, or, is the last time the study, encountered the library is directly used, this time I put forward, an adaptation, careful of a function of learning
user can use the IOCTL function in the user program to control the device's I/O channel.
Second, the necessity of IOCTL
If you do not need to ioctl, you can also achieve the device I/O channel control, but it is quite screwed. For example, when we implement write in a driver, we can check to see if there are any specially agreed data flows, and if so, follow the control commands (usually in socket programming). But if you do this, it will lead to a
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.