The Linux Programming Interface
Chapter 46: System V Message Queues This chapter describes System V message queues. Message queues allow processes to exchange d ...
938 Chapter 46 Consequently, there are various existing applications that employ message queues, and this fact forms one of the ...
System V Message Queues 939 static void / Print usage info, then exit / usageError(const char progName, const char msg) { if (ms ...
940 Chapter 46 case 'x': flags |= IPC_EXCL; break; default: usageError(argv[0], "Bad option\n"); } } if (numKeyFlags != 1) usage ...
System V Message Queues 941 To send a message with msgsnd(), we must set the mtype field of the message structure to a value gre ...
942 Chapter 46 static void /* Print (optional) message, then usage description */ usageError(const char *progName, const char *m ...
System V Message Queues 943 46.2.2 Receiving Messages The msgrcv() system call reads (and removes) a message from a message queu ...
944 Chapter 46 with the error ENOMSG. (The error EAGAIN would be more consistent, as occurs on a nonblocking msgsnd() or a nonbl ...
System V Message Queues 945 The following shell session demonstrates the use of the programs in Listing 46-1, Listing 46-2, and ...
946 Chapter 46 #ifdef MSG_EXCEPT fprintf(stderr, " -x Use MSG_EXCEPT flag\n"); #endif exit(EXIT_FAILURE); } int main(int argc, c ...
System V Message Queues 947 46.3 Message Queue Control Operations The msgctl() system call performs control operations on the me ...
948 Chapter 46 if (argc > 1 && strcmp(argv[1], "--help") == 0) usageErr("%s [msqid...]\n", argv[0]); for (j = 1; j &l ...
System V Message Queues 949 msg_ctime This field is set to the current time when the message queue is created and whenever an IP ...
950 Chapter 46 if (argc != 3 || strcmp(argv[1], "--help") == 0) usageErr("%s msqid max-bytes\n", argv[0]); /* Retrieve copy of a ...
System V Message Queues 951 Although Linux doesn’t impose either of the above limits, it does limit the number of messages on an ...
952 Chapter 46 and shmctl()) operations. (The ipcs program employs these operations.) These oper- ations are as follows: z MSG_I ...
System V Message Queues 953 Listing 46-6: Displaying all System V message queues on the system ––––––––––––––––––––––––––––––––– ...
954 Chapter 46 Which approach we choose depends on the requirements of our application. We next consider some of the factors tha ...
System V Message Queues 955 problems listed above when using a single message queue. Note the following points regarding this ap ...
956 Chapter 46 (SERVER_KEY), and defines the formats of the messages to be passed between the cli- ent and the server. The reque ...
«
45
46
47
48
49
50
51
52
53
54
»
Free download pdf