The Linux Programming Interface
System V Message Queues 957 Server program Listing 46-8 is the server program for the application. Note the following points abo ...
958 Chapter 46 static void /* Executed in child process: serve a single client */ wserveRequest(const struct requestMsg *req) { ...
System V Message Queues 959 /* Read requests, handle each in a separate child process */ for (;;) { msgLen = msgrcv(serverId, &a ...
960 Chapter 46 Listing 46-9: Client for file server using System V message queues –––––––––––––––––––––––––––––––––––––––––––––– ...
System V Message Queues 961 /* Get first response, which may be failure notification */ msgLen = msgrcv(clientId, &resp, RES ...
962 Chapter 46 a priority-queue strategy so that higher-priority messages (i.e., those with lower message type values) are read ...
System V Message Queues 963 Various factors led us to conclude that other IPC mechanisms are usually pref- erable to System V me ...
964 Chapter 46 46-5. The client shown in Listing 46-9 (svmsg_file_client.c) doesn’t handle various possibilities for failure in ...
SYSTEM V SEMAPHORES This chapter describes System V semaphores. Unlike the IPC mechanisms described in previous chapters, System ...
966 Chapter 47 the use of a semaphore to synchronize the actions of two processes that alternately move the semaphore value betw ...
System V Semaphores 967 semaphores in a set is specified when the set is created using the semget() system call. While it is com ...
968 Chapter 47 Listing 47-1: Creating and operating on System V semaphores ––––––––––––––––––––––––––––––––––––––––––––––––––––– ...
System V Semaphores 969 47.2 Creating or Opening a Semaphore Set The semget() system call creates a new semaphore set or obtains ...
970 Chapter 47 The semid argument is the identifier of the semaphore set on which the operation is to be performed. For those op ...
System V Semaphores 971 Generic control operations The following operations are the same ones that can be applied to other types ...
972 Chapter 47 Changing the value of a semaphore with SETVAL or SETALL clears the undo entries for that semaphore in all process ...
System V Semaphores 973 The fields of the semid_ds structure are implicitly updated by various semaphore system calls, and certa ...
974 Chapter 47 if (argc != 2 || strcmp(argv[1], "--help") == 0) usageErr("%s semid\n", argv[0]); semid = getInt(argv[1], 0, "sem ...
System V Semaphores 975 if (argc < 3 || strcmp(argv[1], "--help") == 0) usageErr("%s semid val...\n", argv[0]); semid = getIn ...
976 Chapter 47 Listing 47-5: Incorrectly initializing a System V semaphore –––––––––––––––––––––––––––––––––––––––––––––––––from ...
«
46
47
48
49
50
51
52
53
54
55
»
Free download pdf