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