/MSGRCV, Message Send/Receive practice **///1. Message sent int main () {int msgid = Msgget (0x1234,0666| Ipc_creat); if (MsgId = =-1) err_exit (" msgget error"); struct msgbuf mybuffer; for (int i 2. Message reception: The data is constantly taken from the head of the team int main (int argc, char *argv[]) { int msgid = msgget (0x1234, 0); if (MsgId = =-1) err_exit ("Msgget error"); struct MSGBUF buf; ssize_t NRCV; while (
another terminal, modify the user permission of Dir directory in turn)5) Create a new file in Dir directory Tom.txt, the owner is Tom, the group is the Group1,/test directory permissions of 7776) New user rose, switch to Rose User, verify the Rose User's rwx permissions to Tom.txt (open another terminal, modify tom.txt others permissions to match the verification process)7) Add rose to the group1 group and, under the Rose user, verify the rwx permiss
Linux inter-process communication (IPC) Programming Practice (iii) Details System V Message Queue (1)Message Queue introduction Message Queue provides a method for sending a piece of data (local) from one process to another. Each data block is considered to be of a type, the data blocks received by the recipient process can have different types of values. Message queues have the same limitations as pipeline
struct body of the Structled_classdev type we want to register myled.name=pdata->name;// The name of the LED device on the current match myled.brightness=255;myled.brightness_set=whyx210_led1_set;// This myled Brightness_set method binding can not actually be fixed whyx210_led1_set this method, because we // The driver and equipment matching is not fixed is led1, it is possible that the LED2 device is also matched with this driver, the total can not led2 //How to use the method of led1//To
underlined) followed by a set of parentheses line;# Cat/etc/rc.d/init.d/functions | Egrep "\5 , use echo to output a path, and then egrep find its path base name, and further use Egrep to remove its directory name (note that the directory name, not the directory path);6 , look for all files that do not belong to root, bin, or Hadoop in the/usr directory;# find/usr-not \ (-user root-o-user bin-o-user hadoop \)-ls7 , one day the system was invaded, hackers in your system to leave the Trojan file:
a/etc/crontab, so we configure this file can also use the Cron service to do something. The crontab configuration is for a user, while the edit/etc/crontab is a task for the system. The file format for this file is:Shell=/bin/bashPath=/sbin:/bin:/usr/sbin:/usr/binMailto=root//If an error occurs, or if there is data output, the data is sent to this account as an emailhome=///user-run path, here is the root directory# Run-parts* * * * * root run-parts/etc/cron.hourly//hourly executionScripts with
LinuxAccess Network neighbors
1. Mount Method
# Mount-T smbfs // 192.168.0.1/Linux/mnt
Or # mount. CIFS/192.168.0.1/Linux/mnt
2. # smbclient // 192.168.0.1/Linux-u RedHat % 123
Access Control
Public = Yes allow all users to access
= No anonymous access is not allowed
1. Set a valid user for the shared directory
[RedHat]
Path =/var/RedHat
Comment = R
main () {int inumber = 0; pid_t pid = Vfork (); if (PID = =-1) {perror ("fork"); return-1; } else if (PID > 0) {cout Example 2: case where the parent process/child process modifies global data int main () { int inumber = ten; cout //Example 3: Executes the Hello program under the current directory with vfork int main () {int inumber = 0; pid_t pid = Vfork (); if (PID = =-1) {perror ("fork"); return-1; } else if (PID > 0) {cout
Linux practice engineer study Note 5: Use the disk quota or modify the/etc/fstab file to enable the quota for each file system-add the option usrquota
The default system kernel supports quota.
Mount-o usrquota, maid/dev/sdb1/mnt/d1 or
Mount-o remount, usrquota, kgquota/
You can also modify the/etc/fstab file to enable the quota of each file system-add the options usrquota
Example:
Set LABEL =/home ext3 defa
TSD.specific data; with the key-value Implementation, a thread creates a key, another thread creates it, But not pointing to the same fast memory, they point to their own data,This is thread-specific data.In the code above, even Sleeep (2), thread 1 's data is not affected by thread 2 's data, because it is thread-private. When the thread exits, it is destroyed 2 times because two threads were created. where Tid is the thread's id,str is passed to the Thread_routine parameter, you can see tha
Linux multithreading practice (6) Use Posix condition variables to solve producer and consumer problems
In the previous article, we have already discussed how to use semaphores to solve the producer and consumer problems. Under what circumstances should we introduce conditional variables?
Assume that there is a shared resource sum, and the associated mutex is lock_s. assume that the sum operation of each th
of the subscription. A nice day! Go Shopping with me topic message.Mtqq_mosquittoMtqq_mosquittoIn addition to the Android side can send messages, of course, can also receive. Open another terminal and publish a message with the shopping topicmosquitto_pub -t shopping -m "Sorry,I have no time."You can see the Logcat in Android and show that you have received the corresponding message.Mtqq_mosquittoMtqq_mosquittoandroid Project DownloadHttps://github.com/djstava/MqttClientAndroidReference documen
the same semantics. ).Open rules for Named pipes1) Read Open FIFOO_nonblock Disable (blocked): block until a corresponding process has opened the FIFO for writeO_nonblock Enable(non-blocking): Return to success immediatelyExample 1: Blocking, read-only open int main () { int fd = open ("FIFO", o_rdonly); if (fd = =-1) err_exit ("FIFO open Error"); cout Example 2: Read-only, non-blocking open int main () { int fd = open ("FIFO", o_rdonly| O_nonblock); if (fd = =-1) e
-1The difference between wait and waitpid: 1. Before a child process terminates, wait causes its callers to block, and Waitpid has a selection that allows the caller to not block. 2.waitpid does not wait for the first terminated child process: It has several selections that control the specific process it waits for. the 3.wait function is equivalent to a special case of the Waitpid function.Waitpid ( -1, status, 0);Zombie Process (if not wait ...) When a child process finishes running, the assoc
All for reference only, welcome anyone to discuss[Page] 151 [position] my_rwl.c [Type] Code error[Description] From the book to see __LINE__, is an underscore, but in fact, the built-in macro is the front and back of each of the two sliding lines, namely _ _line_ _[Page] 195 [position] studyuid.c [Type] Code error[Description] The header file for Strerror () is string.h and needs to be added before code can run[Page] 251 [position] ctrlpocess.c [Type] Code error[description] Read function declar
(Result,"%.3s%.3s%3d%.2d:%.2d:%.2d%d\n", Wday_name[timeptr-Tm_wday], mon_name[timeptr-Tm_mon], timeptr->tm_mday, timeptr->Tm_hour, Timeptr->tm_min, timeptr->Tm_sec,1900+ timeptr->tm_year); return result;}The doubt is lifted, and you can see that CTime returns a static local char array.System call Lseek Change Open file location:Handling Errors in system callsDetermine the type of error errno.Display error message Perror:The ls-a option lists hidden files:How to write LS:Stat gets file attribute
) The initial group of ADMINCW is Caiwu3) Adminjs Initial Group is Jishu 4) Tom is an additional user of the Shengchan group5) Harry is an additional user of the CAIW group6) Leo is an additional user of the Jishu group7) Create a new administrative user, the user does not belong to the above mentioned three departments650) this.width=650; "Src=" https://s4.51cto.com/wyfs02/M00/08/1F/wKiom1nblRiRWtq5AADorr1M3Fg844.png-wh_500x0-wm_ 3-wmp_4-s_2873800465.png "title=" screenshot from 2017-10-09 20-3
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.