~ubuntu-branches/ubuntu/dapper/fpc/dapper

« back to all changes in this revision

Viewing changes to docs/ipc.xml

  • Committer: Bazaar Package Importer
  • Author(s): Carlos Laviola
  • Date: 2005-05-30 11:59:10 UTC
  • mfrom: (1.2.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20050530115910-x5pbzm4qqta4i94h
Tags: 2.0.0-2
debian/fp-compiler.postinst.in: forgot to reapply the patch that
correctly creates the slave link to pc(1).  (Closes: #310907)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?xml version="1.0" encoding="ISO8859-1"?>
 
2
<fpdoc-descriptions>
 
3
<!--  
 
4
 
 
5
   $Id: ipc.xml,v 1.2 2004/09/13 19:27:49 michael Exp $ 
 
6
   This file is part of the FPC documentation. 
 
7
   Copyright (C) 1997, by Michael Van Canneyt 
 
8
 
 
9
   The FPC documentation is free text; you can redistribute it and/or 
 
10
   modify it under the terms of the GNU Library General Public License as 
 
11
   published by the Free Software Foundation; either version 2 of the 
 
12
   License, or (at your option) any later version. 
 
13
 
 
14
   The FPC Documentation is distributed in the hope that it will be useful, 
 
15
   but WITHOUT ANY WARRANTY; without even the implied warranty of 
 
16
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
 
17
   Library General Public License for more details. 
 
18
 
 
19
   You should have received a copy of the GNU Library General Public 
 
20
   License along with the FPC documentation; see the file COPYING.LIB.  If not, 
 
21
   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 
 
22
   Boston, MA 02111-1307, USA. 
 
23
 -->
 
24
<package name="rtl">
 
25
<module name="ipc">
 
26
<short>Unix Inter Process Communication functionality.</short>
 
27
<!-- \FPCexampledir{ipcex} -->
 
28
<descr>
 
29
<p>
 
30
This document describes the IPC unit for Free Pascal. It was written for
 
31
linux by Michael Van Canneyt. It gives all the functionality of system V 
 
32
Inter-Process Communication: shared memory, semaphores and messages.
 
33
It works only on the linux operating system.
 
34
</p>
 
35
<p>
 
36
Many constants here are provided for completeness only, and should under
 
37
normal circumstances not be used by the programmer.
 
38
</p>
 
39
</descr>
 
40
 
 
41
<element name="IPCerror">
 
42
<short>Last IPC error code</short>
 
43
<descr>
 
44
The <var>IPCerror</var> variable is used to report errors, by all calls.
 
45
</descr>
 
46
</element>
 
47
 
 
48
<element name="IPC_CREAT">
 
49
<short>Create if key is nonexistent</short>
 
50
</element>
 
51
 
 
52
<element name="IPC_EXCL">
 
53
<short>fail if key exists</short>
 
54
</element>
 
55
 
 
56
<element name="IPC_NOWAIT">
 
57
<short>return error on wait</short>
 
58
</element>
 
59
 
 
60
<element name="IPC_RMID">
 
61
<short>Remove resource</short>
 
62
</element>
 
63
<element name="IPC_SET">
 
64
<short>set ipc_perm options</short>
 
65
</element>
 
66
<element name="IPC_STAT">
 
67
<short>get ipc_perm options</short>
 
68
</element>
 
69
<element name="IPC_INFO">
 
70
<short>For ipcs call</short>
 
71
</element>
 
72
 
 
73
<element name="MSG_NOERROR">
 
74
<short>Internal Message control code. Do not use</short>
 
75
</element>
 
76
<element name="MSG_EXCEPT">
 
77
<short>Internal Message control code. Do not use</short>
 
78
</element>
 
79
<element name="MSGMNI">
 
80
<short>Internal Message control code. Do not use</short>
 
81
</element>
 
82
<element name="MSGMAX">
 
83
<short>Internal Message control code. Do not use</short>
 
84
</element>
 
85
<element name="MSGMNB">
 
86
<short>Internal Message control code. Do not use</short>
 
87
</element>
 
88
 
 
89
<element name="SEM_UNDO">
 
90
<short>Constant for use in <link id="semop"/></short>
 
91
</element>
 
92
<element name="GETPID">
 
93
<short>Constant for use in <link id="semop"/></short>
 
94
</element>
 
95
<element name="GETVAL">
 
96
<short>Constant for use in <link id="semop"/></short>
 
97
</element>
 
98
<element name="GETALL">
 
99
<short>Constant for use in <link id="semop"/></short>
 
100
</element>
 
101
<element name="GETNCNT">
 
102
<short>Constant for use in <link id="semop"/></short>
 
103
</element>
 
104
<element name="GETZCNT">
 
105
<short>Constant for use in <link id="semop"/></short>
 
106
</element>
 
107
<element name="SETVAL">
 
108
<short>Constant for use in <link id="semop"/></short>
 
109
</element>
 
110
<element name="SETALL">
 
111
<short>Constant for use in <link id="semop"/></short>
 
112
</element>
 
113
 
 
114
<element name="SEMMNI">
 
115
<short>Internal semaphore system constant. Do not use.</short>
 
116
</element>
 
117
<element name="SEMMSL">
 
118
<short>Internal semaphore system constant. Do not use.</short>
 
119
</element>
 
120
<element name="SEMMNS">
 
121
<short>Internal semaphore system constant. Do not use.</short>
 
122
</element>
 
123
<element name="SEMOPM">
 
124
<short>Internal semaphore system constant. Do not use.</short>
 
125
</element>
 
126
<element name="SEMVMX">
 
127
<short>Internal semaphore system constant. Do not use.</short>
 
128
</element>
 
129
 
 
130
<element name="SHM_R">
 
131
<short>This constant is used in the <link id="shmctl"/> call.</short>
 
132
</element>
 
133
<element name="SHM_W">
 
134
<short>This constant is used in the <link id="shmctl"/> call.</short>
 
135
</element>
 
136
<element name="SHM_RDONLY">
 
137
<short>This constant is used in the <link id="shmctl"/> call.</short>
 
138
</element>
 
139
<element name="SHM_RND">
 
140
<short>This constant is used in the <link id="shmctl"/> call.</short>
 
141
</element>
 
142
<element name="SHM_REMAP">
 
143
<short>This constant is used in the <link id="shmctl"/> call.</short>
 
144
</element>
 
145
<element name="SHM_LOCK">
 
146
<short>This constant is used in the <link id="shmctl"/> call.</short>
 
147
</element>
 
148
<element name="SHM_UNLOCK">
 
149
<short>This constant is used in the <link id="shmctl"/> call.</short>
 
150
</element>
 
151
 
 
152
<element name="BaseUnix">
 
153
<short>Some base types</short>
 
154
</element>
 
155
 
 
156
<element name="key_t">
 
157
<short>Alias for <link id="TKey"/> type</short>
 
158
</element>
 
159
 
 
160
<element name="TIPC_Perm.mode">
 
161
<short>Creation Mode</short>
 
162
</element>
 
163
 
 
164
<element name="TSHMinfo.shmmni">
 
165
<short>?</short>
 
166
</element>
 
167
 
 
168
<element name="msglen_t">
 
169
<short>Message length type</short>
 
170
</element>
 
171
 
 
172
<element name="msgqnum_t">
 
173
<short>Message queue number type</short>
 
174
</element>
 
175
 
 
176
<element name="PMSG">
 
177
<short>Pointer to <link id="TMSG"/> record</short>
 
178
</element>
 
179
 
 
180
<element name="PMSQid_ds">
 
181
<short>Pointer to <link id="TMSQid_ds"/></short>
 
182
</element>
 
183
 
 
184
<element name="PMSGbuf">
 
185
<short>Pointer to <link id="TMsgBuf"/> rcord</short>
 
186
</element>
 
187
 
 
188
<element name="SEM_GETPID">
 
189
<short>Semaphore operation: Get process ID of last operation.</short>
 
190
</element>
 
191
 
 
192
<element name="SEM_GETVAL">
 
193
<short>Semaphore operation: Get current value of semaphore</short>
 
194
</element>
 
195
 
 
196
<element name="SEM_GETALL">
 
197
<short>Semaphore operation: Get all semaphore values</short>
 
198
</element>
 
199
 
 
200
<element name="SEM_GETNCNT">
 
201
<short>Semaphore operation: Get number of processes waiting for resource.</short>
 
202
</element>
 
203
 
 
204
<element name="SEM_GETZCNT">
 
205
<short>Semaphore operation: Get number of processes waiting for semaphores to reach zero </short>
 
206
</element>
 
207
 
 
208
<element name="SEM_SETVAL">
 
209
<short>Semaphore operation: Set semaphore value</short>
 
210
</element>
 
211
 
 
212
<element name="SEM_SETALL">
 
213
<short>Semaphore operation: Set all semaphore values</short>
 
214
</element>
 
215
 
 
216
 
 
217
<element name="SEM_SEMMNI">
 
218
<short>Semaphore operation: ?</short>
 
219
</element>
 
220
 
 
221
 
 
222
<element name="SEM_SEMMSL">
 
223
<short>Semaphore operation: ?</short>
 
224
</element>
 
225
 
 
226
 
 
227
<element name="SEM_SEMMNS">
 
228
<short>Semaphore operation: ?</short>
 
229
</element>
 
230
 
 
231
<element name="SEM_SEMOPM">
 
232
<short>Semaphore operation: ?</short>
 
233
</element>
 
234
 
 
235
 
 
236
<element name="SEM_SEMVMX">
 
237
<short>Semaphore operation: ?</short>
 
238
</element>
 
239
 
 
240
 
 
241
<element name="TSEMid_ds.sem_nsems">
 
242
<short>Number of semaphores</short>
 
243
</element>
 
244
 
 
245
<element name="PULong">
 
246
<short>Pointer to cardinal type.</short>
 
247
</element>
 
248
<element name="PWord">
 
249
<short>Pointer to word type.</short>
 
250
</element>
 
251
 
 
252
<element name="TKey">
 
253
<short>Type returned by the <link id="ftok"/> key generating
 
254
function.</short>
 
255
</element>
 
256
 
 
257
<element name="TIPC_Perm">
 
258
<short>Record used in all IPC systems to specify the permissions.</short>
 
259
<descr>
 
260
<var>TIPC_Perm</var> is used in all IPC systems to specify the permissions.
 
261
It should never be used directly.
 
262
</descr>
 
263
</element>
 
264
<element name="TIPC_Perm.Key">
 
265
<short>key used to create resource</short>
 
266
</element>
 
267
<element name="TIPC_Perm.uid">
 
268
<short>Owner user ID</short>
 
269
</element>
 
270
<element name="TIPC_Perm.gid">
 
271
<short>Owner group id</short>
 
272
</element>
 
273
<element name="TIPC_Perm.cuid">
 
274
<short>Creator user ID</short>
 
275
</element>
 
276
<element name="TIPC_Perm.cgid">
 
277
<short>Creator group ID</short>
 
278
</element>
 
279
<element name="TIPC_Perm.seq">
 
280
<short>?</short>
 
281
</element>
 
282
 
 
283
<element name="PIPC_Perm">
 
284
<short>Pointer to <link id="TIPC_Perm"/> record.</short>
 
285
</element>
 
286
 
 
287
<element name="TSHMid_ds">
 
288
<short>Record used in the <link id="shmctl"/> call to set or retrieve settings for shared memory.</short>
 
289
</element>
 
290
<element name="PSHMid_DS">
 
291
<short>Pointer to <link id="TSHMid_ds"/> record.</short>
 
292
</element>
 
293
<element name="TSHMid_ds.shm_perm">
 
294
<short>Permissions</short>
 
295
</element>
 
296
<element name="TSHMid_ds.shm_segsz">
 
297
<short>Segment size</short>
 
298
</element>
 
299
<element name="TSHMid_ds.shm_atime">
 
300
<short>Last access time</short>
 
301
</element>
 
302
<element name="TSHMid_ds.shm_dtime">
 
303
<short>Last detach time</short>
 
304
</element>
 
305
<element name="TSHMid_ds.shm_ctime">
 
306
<short>Create time</short>
 
307
</element>
 
308
<element name="TSHMid_ds.shm_cpid">
 
309
<short>Creator PID</short>
 
310
</element>
 
311
<element name="TSHMid_ds.shm_lpid">
 
312
<short>Last operation PID</short>
 
313
</element>
 
314
<element name="TSHMid_ds.shm_nattch">
 
315
<short>Number of attachments</short>
 
316
</element>
 
317
<element name="TSHMid_ds.shm_npages">
 
318
<short>Number of pages</short>
 
319
</element>
 
320
<element name="TSHMid_ds.shm_pages">
 
321
<short>?</short>
 
322
</element>
 
323
<element name="TSHMid_ds.attaches">
 
324
<short>?</short>
 
325
</element>
 
326
 
 
327
<element name="TSHMinfo">
 
328
<short>Record used by the shared memory system, Do not use directly.</short>
 
329
</element>
 
330
<element name="TSHMinfo.shmmax" skip="1"/>
 
331
<element name="TSHMinfo.shmmin" skip="1"/>
 
332
<element name="TSHMinfo.smmni" skip="1"/>
 
333
<element name="TSHMinfo.shmseg" skip="1"/>
 
334
<element name="TSHMinfo.shmall" skip="1"/>
 
335
<element name="PSHMinfo" skip="1"/>
 
336
 
 
337
<element name="TMSG">
 
338
<short>Record used in the handling of message queues. Do not use directly.</short>
 
339
</element>
 
340
<element name="TMSG.msg_next" skip="1"/>
 
341
<element name="TMSG.msg_type" skip="1"/>
 
342
<element name="TMSG.msg_spot" skip="1"/>
 
343
<element name="TMSG.msg_stime" skip="1"/>
 
344
<element name="TMSG.msg_ts" skip="1"/>
 
345
 
 
346
<element name="TMSQid_ds">
 
347
<short>Record returned by the <link id="msgctl"/> call, contains all data about a message queue.</short>
 
348
<descr>
 
349
This record should never be used directly, it is an internal kernel record.
 
350
It's fields may change at any time.
 
351
</descr>
 
352
</element>
 
353
 
 
354
<element name="TMSQid_ds.msg_perm">
 
355
<short>Queue permissions</short>
 
356
</element>
 
357
<element name="TMSQid_ds.msg_first">
 
358
<short>Pointer to first message</short>
 
359
</element>
 
360
<element name="TMSQid_ds.msg_last">
 
361
<short>Pointer to last message</short>
 
362
</element>
 
363
<element name="TMSQid_ds.msg_stime">
 
364
<short>Last send time</short>
 
365
</element>
 
366
<element name="TMSQid_ds.msg_rtime">
 
367
<short>Last receive time</short>
 
368
</element>
 
369
<element name="TMSQid_ds.msg_ctime">
 
370
<short>Last control time</short>
 
371
</element>
 
372
<element name="TMSQid_ds.wwait">
 
373
<short></short>
 
374
</element>
 
375
<element name="TMSQid_ds.rwait">
 
376
<short></short>
 
377
</element>
 
378
<element name="TMSQid_ds.msg_cbytes">
 
379
<short></short>
 
380
</element>
 
381
<element name="TMSQid_ds.msg_qnum">
 
382
<short></short>
 
383
</element>
 
384
<element name="TMSQid_ds.msg_qbytes">
 
385
<short></short>
 
386
</element>
 
387
<element name="TMSQid_ds.msg_lspid">
 
388
<short></short>
 
389
</element>
 
390
<element name="TMSQid_ds.msg_lrpid">
 
391
<short></short>
 
392
</element>
 
393
 
 
394
<element name="TMSGbuf">
 
395
<short>Generic message data record</short>
 
396
<descr>
 
397
The <var>TMSGbuf</var> record is a record containing the data of a record. you
 
398
should never use this record directly, instead you should make your own
 
399
record that follows the structure of the <var>TMSGbuf</var> record, but that has
 
400
a size that is big enough to accomodate your messages. The <var>mtype</var> field
 
401
should always be present, and should always be filled.
 
402
</descr>
 
403
</element>
 
404
<element name="TMSGbuf.mtype">
 
405
<short>Message type</short>
 
406
</element>
 
407
<element name="TMSGbuf.mtext">
 
408
<short>Message data</short>
 
409
</element>
 
410
 
 
411
<element name="TMSGinfo" skip="1">
 
412
<short>Internal message system record. Do not use directly.</short>
 
413
</element>
 
414
<element name="TMSGinfo.msgpool" skip="1"/>
 
415
<element name="TMSGinfo.msgmap" skip="1"/>
 
416
<element name="TMSGinfo.msgmax" skip="1"/>
 
417
<element name="TMSGinfo.msgmax" skip="1"/>
 
418
<element name="TMSGinfo.msgmnb" skip="1"/>
 
419
<element name="TMSGinfo.msgmni" skip="1"/>
 
420
<element name="TMSGinfo.msgssz" skip="1"/>
 
421
<element name="TMSGinfo.msgtql" skip="1"/>
 
422
<element name="TMSGinfo.msgseg" skip="1"/>
 
423
 
 
424
<element name="PMSGinfo" skip="1">
 
425
<short>Pointer to <link id="TMSGinfo"/> record</short>
 
426
</element>
 
427
 
 
428
<element name="TSEMid_ds">
 
429
<short>Structure returned by the <link id="semctl"/> call, contains all data of a semahore</short>
 
430
</element>
 
431
 
 
432
<element name="PSEMid_ds">
 
433
<short>Pointer to <link id="TSEMid_ds"/> record.</short>
 
434
</element>
 
435
 
 
436
<element name="TSEMid_ds.sem_perm">
 
437
<short>IPC permissions</short>
 
438
</element>
 
439
 
 
440
<element name="TSEMid_ds.sem_otime">
 
441
<short>Last operation time</short>
 
442
</element>
 
443
 
 
444
<element name="TSEMid_ds.sem_ctime">
 
445
<short>Create time</short>
 
446
</element>
 
447
 
 
448
<element name="TSEMid_ds.sem_base">
 
449
<short>Internal data. Do not use</short>
 
450
</element>
 
451
 
 
452
<element name="TSEMid_ds.sem_pending">
 
453
<short>Internal data. Do not use</short>
 
454
</element>
 
455
<element name="TSEMid_ds.sem_pending_last">
 
456
<short>Internal data. Do not use</short>
 
457
</element>
 
458
<element name="TSEMid_ds.undo">
 
459
<short>Internal data. Do not use</short>
 
460
</element>
 
461
<element name="TSEMid_ds.nsems">
 
462
<short>Internal data. Do not use</short>
 
463
</element>
 
464
 
 
465
<element name="TSEMbuf">
 
466
<short>Record used in <link id="semop"/> call.</short>
 
467
<descr>
 
468
The <var>TSEMbuf</var> record is used in the <link id="semop"/> call, and is
 
469
used to specify which operations you want to do.
 
470
</descr>
 
471
</element>
 
472
 
 
473
<element name="PSEMbuf">
 
474
<short>Pointer to <link id="TSembuf"/> record.</short>
 
475
</element>
 
476
<element name="TSEMbuf.sem_num">
 
477
<short>Number of the semaphore to perform operation on.</short>
 
478
</element>
 
479
<element name="TSEMbuf.sem_op">
 
480
<short>Operation to perform on semaphore</short>
 
481
</element>
 
482
<element name="TSEMbuf.sem_flg">
 
483
<short>Flags for operation.</short>
 
484
</element>
 
485
 
 
486
<element name="TSEMinfo" skip="1">
 
487
<short>Internal semaphore system record. Do not use.</short>
 
488
</element>
 
489
<element name="TSEMinfo.semmap" skip="1"/>
 
490
<element name="TSEMinfo.semmni" skip="1"/>
 
491
<element name="TSEMinfo.semmns" skip="1"/>
 
492
<element name="TSEMinfo.semmnu" skip="1"/>
 
493
<element name="TSEMinfo.semmsl" skip="1"/>
 
494
<element name="TSEMinfo.semopm" skip="1"/>
 
495
<element name="TSEMinfo.semume" skip="1"/>
 
496
<element name="TSEMinfo.semusz" skip="1"/>
 
497
<element name="TSEMinfo.semvmx" skip="1"/>
 
498
<element name="TSEMinfo.semaem" skip="1"/>
 
499
 
 
500
<element name="PSEMinfo">
 
501
<short>Pointer to <link id="TSEMinfo"/> record.</short>
 
502
</element>
 
503
 
 
504
<element name="TSEMun">
 
505
<short>Record used in <link id="semctl"/> call.</short>
 
506
</element>
 
507
<element name="PSEMun">
 
508
<short>Pointer to <link id="TSEMun"/> record</short>
 
509
</element>
 
510
 
 
511
<element name="ftok">
 
512
<short>Create token from filename</short>
 
513
<descr>
 
514
<p>
 
515
<var>ftok</var> returns a key that can be used in a <link id="semget"/>
 
516
<link id="shmget"/>
 
517
or <link id="msgget"/> call to access a new or existing IPC resource.
 
518
</p>
 
519
<p>
 
520
<var>Path</var> is the name of a file in the file system, <var>ID</var> is a
 
521
character of your choice. The ftok call does the same as it's C couterpart,
 
522
so a pascal program and a C program will access the same resource if
 
523
they use the same <var>Path</var> and <var>ID</var>
 
524
</p>
 
525
<p>
 
526
For an example, see <link id="msgctl"/>, <link id="semctl"/> or <link id="shmctl"/>.
 
527
</p>
 
528
</descr>
 
529
<errors>
 
530
<var>ftok</var> returns -1 if the file in <var>Path</var> doesn't exist.
 
531
</errors>
 
532
<seealso>
 
533
<link id="semget"/>
 
534
<link id="shmget"/>
 
535
<link id="msgget"/>
 
536
</seealso>
 
537
</element>
 
538
 
 
539
 
 
540
<element name="msgget">
 
541
<short>Return message queue ID, possibly creating the queue</short>
 
542
<descr>
 
543
<p>
 
544
<var>msgget</var> returns the ID of the message queue described by <var>key</var>.
 
545
Depending on the flags in <var>msgflg</var>, a new queue is created.
 
546
</p>
 
547
<p>
 
548
<var>msgflg</var> can have one or more of the following values (combined by ORs):
 
549
</p>
 
550
<dl>
 
551
<dt>IPC_CREAT</dt><dd> The queue is created if it doesn't already exist.</dd>
 
552
<dt>IPC_EXCL</dt><dd> If used in combination with <var>IPC_CREAT</var>, causes the
 
553
call to fail if the queue already exists. It cannot be used by itself.
 
554
</dd>
 
555
</dl>
 
556
<p>
 
557
Optionally, the flags can be <var>OR</var>ed with a permission mode, which is the
 
558
same mode that can be used in the file system.
 
559
</p>
 
560
<p>
 
561
For an example, see <link id="msgctl"/>.
 
562
</p>
 
563
</descr>
 
564
<errors>
 
565
On error, -1 is returned, and <var>IPCError</var> is set.
 
566
</errors>
 
567
<seealso>
 
568
<link id="ftok"/>
 
569
<link id="msgsnd"/>
 
570
<link id="msgrcv"/>
 
571
<link id="msgctl"/>
 
572
</seealso>
 
573
</element>
 
574
 
 
575
 
 
576
<element name="msgsnd">
 
577
<short>Send a message to the messague queue</short>
 
578
<descr>
 
579
<p>
 
580
<var>msgsend</var> sends a message to a message queue with ID <var>msqid</var>.
 
581
<var>msgp</var> is a pointer to a message buffer, that should be based on the
 
582
<var>TMsgBuf</var> type. <var>msgsiz</var> is the size of the message (NOT of the
 
583
message buffer record !)
 
584
</p>
 
585
<p>
 
586
The <var>msgflg</var> can have a combination of the following values (ORed
 
587
together):
 
588
</p>
 
589
<dl>
 
590
<dt>0</dt><dd>No special meaning. The message will be written to the queue.
 
591
If the queue is full, then the process is blocked.</dd>
 
592
<dt>IPC_NOWAIT</dt><dd> If the queue is full, then no message is written,
 
593
and the call returns immediatly.
 
594
</dd>
 
595
</dl>
 
596
<p>
 
597
The function returns <var>True</var> if the message was sent successfully, 
 
598
<var>False</var> otherwise.
 
599
</p>
 
600
<p>
 
601
For an example, see <link id="msgctl"/>.
 
602
</p>
 
603
</descr>
 
604
<errors>
 
605
In case of error, the call returns <var>False</var>, and <var>IPCerror</var> is set.
 
606
</errors>
 
607
<seealso>
 
608
<link id="msgget"/>
 
609
<link id="msgrcv"/>
 
610
<link id="msgctl"/>
 
611
</seealso>
 
612
</element>
 
613
 
 
614
 
 
615
<element name="msgrcv">
 
616
<short>Retrieve a message from the queue</short>
 
617
<descr>
 
618
<p>
 
619
<var>msgrcv</var> retrieves a message of type <var>msgtyp</var> from the message 
 
620
queue with ID <var>msqid</var>. <var>msgtyp</var> corresponds to the <var>mtype</var> 
 
621
field of the <var>TMSGbuf</var> record. The message is stored in the <var>MSGbuf</var>
 
622
structure pointed to by <var>msgp</var>.
 
623
</p>
 
624
<p>
 
625
The <var>msgflg</var> parameter can be used to control the behaviour of the
 
626
<var>msgrcv</var> call. It consists of an ORed combination of the following
 
627
flags:
 
628
</p>
 
629
<dl>
 
630
<dt>0</dt><dd> No special meaning.</dd>
 
631
<dt>IPC_NOWAIT</dt><dd>if no messages are available, then the call returns
 
632
immediatly, with the <var>ENOMSG</var> error.</dd>
 
633
<dt>MSG_NOERROR</dt><dd> If the message size is wrong (too large), 
 
634
no error is generated, instead the message is truncated. 
 
635
Normally, in such cases, the call returns an error (E2BIG)
 
636
</dd>
 
637
</dl>
 
638
<p>
 
639
The function returns <var>True</var> if the message was received correctly,
 
640
<var>False</var> otherwise.
 
641
</p>
 
642
<p>
 
643
For an example, see <link id="msgctl"/>.
 
644
</p>
 
645
</descr>
 
646
<errors>
 
647
In case of error, <var>False</var> is returned, and <var>IPCerror</var> is set.
 
648
</errors>
 
649
<seealso>
 
650
<link id="msgget"/>
 
651
<link id="msgsnd"/>
 
652
<link id="msgctl"/>
 
653
</seealso>
 
654
</element>
 
655
 
 
656
 
 
657
<element name="msgctl">
 
658
<short>Perform various operations on a message queue</short>
 
659
<descr>
 
660
<p>
 
661
<var>msgctl</var> performs various operations on the message queue with id
 
662
<var>ID</var>. Which operation is performed, depends on the <var>cmd</var> 
 
663
parameter, which can have one of the following values:
 
664
</p>
 
665
<dl>
 
666
<dt>IPC_STAT</dt><dd> In this case, the <var>msgctl</var> call fills the
 
667
<var>TMSQid_ds</var> structure with information about the message queue.
 
668
</dd>
 
669
<dt>IPC_SET</dt><dd> in this case, the <var>msgctl</var> call sets the permissions
 
670
of the queue as specified in the <var>ipc_perm</var> record inside <var>buf</var>.
 
671
</dd><dt>IPC_RMID</dt><dd> If this is specified, the message queue will be removed 
 
672
from the system.
 
673
</dd>
 
674
</dl>
 
675
<p>
 
676
<var>buf</var> contains the data that are needed by the call. It can be 
 
677
<var>Nil</var> in case the message queue should be removed.
 
678
</p>
 
679
<p>
 
680
The function returns <var>True</var> if successfull, <var>False</var> otherwise.
 
681
</p>
 
682
</descr>
 
683
<errors>
 
684
On error, <var>False</var> is returned, and <var>IPCerror</var> is set accordingly.
 
685
</errors>
 
686
<seealso>
 
687
<link id="msgget"/>
 
688
<link id="msgsnd"/>
 
689
<link id="msgrcv"/>
 
690
</seealso>
 
691
<example file="ipcex/msgtool"/>
 
692
</element>
 
693
 
 
694
 
 
695
<element name="semget">
 
696
<short>Return the ID of a semaphore set, possibly creating the set</short>
 
697
<descr>
 
698
<p>
 
699
<var>msgget</var> returns the ID of the semaphore set described by <var>key</var>.
 
700
Depending on the flags in <var>semflg</var>, a new queue is created.
 
701
</p>
 
702
<p>
 
703
<var>semflg</var> can have one or more of the following values (combined by ORs):
 
704
</p>
 
705
<dl>
 
706
<dt>IPC_CREAT</dt><dd> The queue is created if it doesn't already exist.</dd>
 
707
<dt>IPC_EXCL</dt><dd> If used in combination with <var>IPC_CREAT</var>, causes the
 
708
call to fail if the set already exists. It cannot be used by itself.</dd>
 
709
</dl>
 
710
<p>
 
711
Optionally, the flags can be <var>OR</var>ed with a permission mode, which is the
 
712
same mode that can be used in the file system.
 
713
</p>
 
714
<p>
 
715
if a new set of semaphores is created, then there will be <var>nsems</var>
 
716
semaphores in it.
 
717
</p>
 
718
</descr>
 
719
<errors>
 
720
On error, -1 is returned, and <var>IPCError</var> is set.
 
721
</errors>
 
722
<seealso>
 
723
<link id="ftok"/>
 
724
<link id="semop"/>
 
725
<link id="semctl"/>
 
726
</seealso>
 
727
</element>
 
728
 
 
729
<element name="semop">
 
730
<short>Perform semaphore operation.</short>
 
731
<descr>
 
732
<p>
 
733
<var>semop</var> performs a set of operations on a message queue.
 
734
<var>sops</var> points to an array of type <var>TSEMbuf</var>. The array should
 
735
contain <var>nsops</var> elements.
 
736
</p>
 
737
<p>
 
738
The fields of the <link id="TSEMbuf"/> structure 
 
739
</p>
 
740
<code>
 
741
  TSEMbuf = record
 
742
    sem_num : word;
 
743
    sem_op  : integer;
 
744
    sem_flg : integer;
 
745
</code>
 
746
<p>
 
747
should be filled as follows:
 
748
</p>
 
749
<dl>
 
750
<dt>sem_num</dt><dd> The number of the semaphore in the set on which the
 
751
operation must be performed.</dd>
 
752
<dt>sem_op</dt><dd>
 
753
The operation to be performed. The operation depends on the
 
754
sign of <var>sem_op</var>:
 
755
A positive  number is simply added to the current value of the
 
756
semaphore. If 0 (zero) is specified, then the process is suspended until the 
 
757
specified semaphore reaches zero. If a negative number is specified, it is substracted from the
 
758
current value of the semaphore. If the value would become negative
 
759
then the process is suspended until the value becomes big enough, unless
 
760
<var>IPC_NOWAIT</var> is specified in the <var>sem_flg</var>.
 
761
</dd>
 
762
<dt>sem_flg</dt>
 
763
<dd> Optional flags: if <var>IPC_NOWAIT</var> is specified, then the
 
764
calling process will never be suspended.
 
765
</dd>
 
766
</dl>
 
767
<p>
 
768
The function returns <var>True</var> if the operations were successful,
 
769
<var>False</var> otherwise.
 
770
</p>
 
771
</descr>
 
772
<errors>
 
773
In case of error, <var>False</var> is returned, and <var>IPCerror</var> is set.
 
774
</errors>
 
775
<seealso>
 
776
<link id="semget"/>
 
777
<link id="semctl"/>
 
778
</seealso>
 
779
</element>
 
780
 
 
781
<element name="semctl">
 
782
<short>Perform various control operations on a semaphore set</short>
 
783
<descr>
 
784
<p>
 
785
<var>semctl</var> performs various operations on the semaphore <var>semnum</var> w
 
786
ith semaphore set id <var>ID</var>. 
 
787
</p>
 
788
<p>
 
789
The <var>arg</var> parameter supplies the data needed for each call. This is
 
790
a variant record that should be filled differently, according to the
 
791
command:
 
792
</p>
 
793
<code>
 
794
Type
 
795
  TSEMun = record
 
796
   case longint of
 
797
      0 : ( val : longint );
 
798
      1 : ( buf : PSEMid_ds );
 
799
      2 : ( arr : PWord );
 
800
      3 : ( padbuf : PSeminfo );
 
801
      4 : ( padpad : pointer );
 
802
   end;
 
803
</code>
 
804
<p>
 
805
Which operation is performed, depends on the <var>cmd</var> 
 
806
parameter, which can have one of the following values:
 
807
</p>
 
808
<dl>
 
809
<dt>IPC_STAT</dt>
 
810
<dd> In this case, the arg record should have it's <var>buf</var>
 
811
field set to the address of a <var>TSEMid_ds</var> record. 
 
812
The <var>semctl</var> call fills this <var>TSEMid_ds</var> structure with information 
 
813
about the semaphore set. 
 
814
</dd>
 
815
<dt>IPC_SET</dt>
 
816
<dd> In this case, the <var>arg</var> record should have it's <var>buf</var>
 
817
field set to the address of a <var>TSEMid_ds</var> record.
 
818
The <var>semctl</var> call sets the permissions of the queue as specified in 
 
819
the <var>ipc_perm</var> record.
 
820
</dd>
 
821
<dt>IPC_RMID</dt>
 
822
<dd> If this is specified, the semaphore set is removed from 
 
823
from the system.
 
824
</dd>
 
825
<dt>GETALL</dt>
 
826
<dd> In this case, the <var>arr</var> field of <var>arg</var> should point
 
827
to a memory area where the values of the semaphores will be stored.
 
828
The size of this memory area is \var{SizeOf(Word)* Number of semaphores
 
829
in the set}.
 
830
This call will then fill the memory array with all the values of the
 
831
semaphores.
 
832
</dd>
 
833
<dt>GETNCNT</dt>
 
834
<dd> This will fill the <var>val</var> field of the <var>arg</var> union
 
835
with the number of processes waiting for resources.
 
836
</dd>
 
837
<dt>GETPID</dt>
 
838
<dd> <var>semctl</var> returns the process ID of the process that
 
839
performed the last <link id="semop"/> call.
 
840
</dd>
 
841
<dt>GETVAL</dt>
 
842
<dd> <var>semctl</var> returns the value of the semaphore with number
 
843
<var>semnum</var>.
 
844
</dd>
 
845
<dt>GETZCNT</dt>
 
846
<dd> <var>semctl</var> returns the number of processes waiting for 
 
847
semaphores that reach value zero.
 
848
</dd>
 
849
<dt>SETALL</dt>
 
850
<dd> In this case, the <var>arr</var> field of <var>arg</var> should point
 
851
to a memory area where the values of the semaphores will be retrieved from.
 
852
The size of this memory area is \var{SizeOf(Word)* Number of semaphores
 
853
in the set}.
 
854
This call will then set the values of the semaphores from the memory array.
 
855
</dd>
 
856
<dt>SETVAL</dt>
 
857
<dd> This will set the value of semaphore <var>semnum</var> to the value
 
858
in the <var>val</var> field of the <var>arg</var> parameter.
 
859
</dd>
 
860
</dl>
 
861
<p>
 
862
The function returns -1 on error.
 
863
</p>
 
864
</descr>
 
865
<errors>
 
866
The function returns -1 on error, and <var>IPCerror</var> is set accordingly.
 
867
</errors>
 
868
<seealso>
 
869
<link id="semget"/>
 
870
<link id="semop"/>
 
871
</seealso>
 
872
<example file="ipcex/semtool"/>
 
873
</element>
 
874
 
 
875
 
 
876
<element name="shmget">
 
877
<short>Return the ID of a shared memory block, possibly creating it</short>
 
878
<descr>
 
879
<p>
 
880
<var>shmget</var> returns the ID of a shared memory block, described by <var>key</var>.
 
881
Depending on the flags in <var>flag</var>, a new memory block is created.
 
882
</p>
 
883
<p>
 
884
<var>flag</var> can have one or more of the following values (combined by ORs):
 
885
</p>
 
886
<dl>
 
887
<dt>IPC_CREAT</dt>
 
888
<dd> The queue is created if it doesn't already exist.
 
889
</dd>
 
890
<dt>IPC_EXCL</dt>
 
891
<dd> If used in combination with <var>IPC_CREAT</var>, causes the
 
892
call to fail if the queue already exists. It cannot be used by itself.
 
893
</dd>
 
894
</dl>
 
895
<p>
 
896
Optionally, the flags can be <var>OR</var>ed with a permission mode, which is the
 
897
same mode that can be used in the file system.
 
898
</p>
 
899
<p>
 
900
if a new memory block is created, then it will have size <var>Size</var>
 
901
bytes in it.
 
902
</p>
 
903
</descr>
 
904
<errors>
 
905
On error, -1 is returned, and <var>IPCError</var> is set.
 
906
</errors>
 
907
<seealso>
 
908
</seealso>
 
909
</element>
 
910
 
 
911
<element name="shmat">
 
912
<short>Attach a shared memory block.</short>
 
913
<descr>
 
914
<p>
 
915
<var>shmat</var> attaches a shared memory block with identified <var>shmid</var> 
 
916
to the current process. The function returns a pointer to the shared memory
 
917
block.
 
918
</p>
 
919
<p>
 
920
If <var>shmaddr</var> is <var>Nil</var>, then the system chooses a free unmapped
 
921
memory region, as high up in memory space as possible.
 
922
</p>
 
923
<p>
 
924
If <var>shmaddr</var> is non-nil, and <var>SHM_RND</var> is in <var>shmflg</var>, then 
 
925
the returned address is <var>shmaddr</var>, rounded down to <var>SHMLBA</var>.
 
926
If <var>SHM_RND</var> is not specified, then <var>shmaddr</var> must be a
 
927
page-aligned address.
 
928
</p>
 
929
<p>
 
930
The parameter <var>shmflg</var> can be used to control the behaviour of the
 
931
<var>shmat</var> call. It consists of a ORed combination of the following
 
932
constants:
 
933
</p>
 
934
<dl>
 
935
<dt>SHM_RND</dt> <dd> The suggested address in <var>shmaddr</var> is rounded down to
 
936
<var>SHMLBA</var>.
 
937
</dd>
 
938
<dt>SHM_RDONLY</dt> <dd> the shared memory is attached for read access only.
 
939
Otherwise the memory is attached for read-write. The process then needs
 
940
read-write permissions to access the shared memory.
 
941
</dd>
 
942
</dl>
 
943
<p>
 
944
For an example, see <link id="shmctl"/>.
 
945
</p>
 
946
</descr>
 
947
<errors>
 
948
If an error occurs, -1 is returned, and <var>IPCerror</var> is set.
 
949
</errors>
 
950
<seealso>
 
951
<link id="shmget"/>
 
952
<link id="shmdt"/>
 
953
<link id="shmctl"/>
 
954
</seealso>
 
955
</element>
 
956
 
 
957
 
 
958
<element name="shmdt">
 
959
<short>Detach shared memory block.</short>
 
960
<descr>
 
961
<p>
 
962
<var>shmdt</var> detaches the shared memory at address <var>shmaddr</var>. This shared
 
963
memory block is unavailable to the current process, until it is attached
 
964
again by a call to <link id="shmat"/>.
 
965
</p>
 
966
<p>
 
967
The function returns <var>True</var> if the memory block was detached
 
968
successfully, <var>False</var> otherwise.
 
969
</p>
 
970
</descr>
 
971
<errors>
 
972
On error, False is returned, and IPCerror is set.
 
973
</errors>
 
974
<seealso>
 
975
<link id="shmget"/>
 
976
<link id="shmat"/>
 
977
<link id="shmctl"/>
 
978
</seealso>
 
979
</element>
 
980
 
 
981
<element name="shmctl">
 
982
<short>Perform control operations on a shared memory block.</short>
 
983
<descr>
 
984
<p>
 
985
<var>shmctl</var> performs various operations on the shared memory block
 
986
identified by identifier <var>shmid</var>.
 
987
</p>
 
988
<p>
 
989
The <var>buf</var> parameter points to a <var>TSHMid_ds</var> record. The 
 
990
<var>cmd</var> parameter is used to pass which operation is to be performed.
 
991
It can have one of the following values :
 
992
</p>
 
993
<dl>
 
994
<dt>IPC_STAT</dt><dd> <var>shmctl</var> fills the <var>TSHMid_ds</var> record that 
 
995
<var>buf</var> points to with the available information about the shared memory
 
996
block.</dd>
 
997
<dt>IPC_SET</dt><dd> applies the values in the <var>ipc_perm</var> record that
 
998
<var>buf</var> points to, to the shared memory block.</dd>
 
999
<dt>IPC_RMID</dt><dd> the shared memory block is destroyed (after all processes
 
1000
to which the block is attached, have detached from it).</dd>
 
1001
</dl>
 
1002
<p>
 
1003
If successful, the function returns <var>True</var>, <var>False</var> otherwise.
 
1004
</p>
 
1005
</descr>
 
1006
<errors>
 
1007
If an error occurs, the function returns <var>False</var>, and <var>IPCerror</var>
 
1008
is set.
 
1009
</errors>
 
1010
<seealso>
 
1011
<link id="shmget"/>
 
1012
<link id="shmat"/>
 
1013
<link id="shmdt"/>
 
1014
</seealso>
 
1015
<example file="ipcex/shmtool"/>
 
1016
</element>
 
1017
 
 
1018
</module>
 
1019
</package>
 
1020
</fpdoc-descriptions>