/usr/share/gap/pkg/io/doc/chap3.txt is in gap-io 4.5.1+ds-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 |
[1X3 [33X[0;0YFunctions directly available from the C library[133X[101X
[33X[0;0YThe following functions from the C library are made available as [5XGAP[105X
functions:[133X
[33X[0;0Y[10Xaccept[110X, [10Xbind[110X, [10Xchdir[110X, [10Xchmod[110X, [10Xchown[110X, [10Xclose[110X, [10Xclosedir[110X, [10Xconnect[110X, [10Xcreat[110X, [10Xdup[110X,
[10Xdup2[110X, [10Xexecv[110X, [10Xexecve[110X, [10Xexecvp[110X, [10Xexit[110X, [10Xfchmod[110X, [10Xfchown[110X, [10Xfcntl[110X, [10Xfork[110X, [10Xfstat[110X,
[10Xgethostbyname[110X, [10Xgethostname[110X, [10Xgetpid[110X, [10Xgetppid[110X, [10Xgetsockname[110X, [10Xgetsockopt[110X,
[10Xgettimeofday[110X, [10Xgmtime[110X, [10Xkill[110X, [10Xlchown[110X, [10Xlink[110X, [10Xlisten[110X, [10Xlocaltime[110X, [10Xlseek[110X, [10Xlstat[110X,
[10Xmkdir[110X, [10Xmkfifo[110X, [10Xmknod[110X, [10Xmkstemp[110X, [10Xmkdtemp[110X, [10Xopen[110X, [10Xopendir[110X, [10Xpipe[110X, [10Xread[110X, [10Xreaddir[110X,
[10Xreadlink[110X, [10Xrecv[110X, [10Xrecvfrom[110X, [10Xrename[110X, [10Xrewinddir[110X, [10Xrmdir[110X, [10Xseekdir[110X, [10Xselect[110X, [10Xsend[110X,
[10Xsendto[110X, [10Xsetsockopt[110X, [10Xsocket[110X, [10Xstat[110X, [10Xsymlink[110X, [10Xtelldir[110X, [10Xunlink[110X, [10Xwrite[110X.[133X
[33X[0;0YUse the [10Xman[110X command in your shell to get information about these functions.[133X
[33X[0;0YFor each of these functions there is a corresponding [5XGAP[105X global function
with the prefix [10XIO_[110X before its name. Apart from minor differences (see
below) they take exactly the same arguments as their C counterparts. Strings
must be specified as [5XGAP[105X strings and integers as [5XGAP[105X immediate integers.
Return values are in general the same as for the C counterparts. However, an
error condition is indicated by the value [10Xfail[110X instead of -1, and if the
result can only be success or failure, [10Xtrue[110X indicates success.[133X
[33X[0;0YAll errors are reported via the [2XLastSystemError[102X ([14XReference: LastSystemError[114X)
function.[133X
[33X[0;0YIn the C library a lot of integers are defined as macros in header files.
All the necessary values for the above functions are bound to their name in
the global [10XIO[110X record.[133X
[33X[0;0Y[13XWarning:[113X Existence of many of these functions and constants is platform
dependent. The compilation process checks existence and this leads to the
situation that on the [5XGAP[105X levels the functions and constants are there or
not. If you want to develop platform independent [5XGAP[105X code using this
package, then you have to check for existence of the functions and constants
you need.[133X
[1X3.1 [33X[0;0YDifferences in arguments - an overview[133X[101X
[33X[0;0YThe [10Xopen[110X function has to be called with three arguments. The version with
two arguments is not available on the [5XGAP[105X level.[133X
[33X[0;0YThe [10Xread[110X function takes four arguments: [3Xfd[103X is an integer file descriptor, [3Xst[103X
is a [5XGAP[105X string, [3Xoffset[103X is an offset within this string (zero based), and
[3Xcount[103X is the maximal number of bytes to read. The data is read and stored
into the string [3Xst[103X, starting at position [22X[3Xoffset[103X+1[122X. The string [3Xst[103X is made
long enough, such that [3Xcount[103X bytes would fit into it, beginning at position
[22X[3Xoffset[103X+1[122X. The number of bytes read is returned or [10Xfail[110X in case of an error.[133X
[33X[0;0YThe [10Xwrite[110X function is similar, it also takes four arguments: [3Xfd[103X is an
integer file descriptor, [3Xst[103X is a [5XGAP[105X string, [3Xoffset[103X is an offset within this
string (zero based), and [3Xcount[103X is the number of bytes to write, starting
from position [22X[3Xoffset[103X+1[122X in the string [3Xst[103X. The number of bytes written is
returned, or a [10Xfail[110X in case of an error.[133X
[33X[0;0YThe [10Xopendir[110X function only returns [10Xtrue[110X or [10Xfail[110X.[133X
[33X[0;0YThe [10Xreaddir[110X function takes no argument. It reads the directory that was
specified in the last call to [10Xopendir[110X. It just returns a string, which is
the name of a file or subdirectory in the corresponding directory. It
returns [10Xfalse[110X after the last file name in the directory or [10Xfail[110X in case of
an error.[133X
[33X[0;0YThe [10Xclosedir[110X function takes no argument. It should be called after [10Xreaddir[110X
returned [10Xfalse[110X or [10Xfail[110X to avoid excessive use of file descriptors.[133X
[33X[0;0YThe functions [10Xstat[110X, [10Xfstat[110X, and [10Xlstat[110X only take one argument and return a [5XGAP[105X
record that has the same entries as a [10Xstruct stat[110X.[133X
[33X[0;0YThe function [10Xsocket[110X can optionally take a string as third argument. In that
case it automatically calls [10Xgetprotobyname[110X to look up the protocol name.[133X
[33X[0;0YThe functions [10Xbind[110X and [10Xconnect[110X take only one string argument as address
field, because the string already encodes the length.[133X
[33X[0;0YThere are two convenience functions [2XIO_make_sockaddr_in[102X ([14X3.3-1[114X) and
[2XIO_MakeIPAddressPort[102X ([14X4.3-6[114X) to create such addresses. The first takes two
arguments [3Xaddr[103X and [3Xport[103X, where [3Xaddr[103X is a string of length 4, containing the
4 bytes of the IP address and [3Xport[103X is a port number as [5XGAP[105X integer. The
function [2XIO_MakeIPAddressPort[102X ([14X4.3-6[114X) takes the same arguments, but the
first can be a string containing an IP address in dot notation like
[21X137.226.152.77[121X or a hostname to be looked up.[133X
[33X[0;0YThe [10Xsetsockopt[110X function has no argument [3Xoptlen[103X. The length of the string
[3Xoptval[103X is taken.[133X
[33X[0;0YThe [10Xselect[110X function works as the function [10XUNIXSelect[110X in the [5XGAP[105X library.[133X
[33X[0;0YAs of now, the file locking mechanisms of [10Xfcntl[110X using [10Xstruct flock[110X are not
yet implemented on the [5XGAP[105X level.[133X
[1X3.2 [33X[0;0YThe low-level functions in detail[133X[101X
[33X[0;0YNearly all of this functions return an integer result in the C library. On
the [5XGAP[105X level this is either returned as a non-negative integer in case of
success or as [9Xfail[109X in case of an error (where on the C level [22X-1[122X would be
returned). If the integer can only be [22X0[122X for [21Xno error[121X this is changed to [9Xtrue[109X
on the [5XGAP[105X level.[133X
[1X3.2-1 IO_accept[101X
[33X[1;0Y[29X[2XIO_accept[102X( [3Xfd[103X, [3Xaddr[103X ) [32X function[133X
[6XReturns:[106X [33X[0;10Yan integer or [9Xfail[109X[133X
[33X[0;0YAccepts an incoming network connection. For details see [21X[10Xman 2 accept[110X[121X. The
argument [3Xaddr[103X can be made with [2XIO_make_sockaddr_in[102X ([14X3.3-1[114X) and contains its
length such that no third argument is necessary.[133X
[1X3.2-2 IO_bind[101X
[33X[1;0Y[29X[2XIO_bind[102X( [3Xfd[103X, [3Xmy_addr[103X ) [32X function[133X
[6XReturns:[106X [33X[0;10Yan integer or [9Xfail[109X[133X
[33X[0;0YBinds a local address to a socket. For details see [21X[10Xman 2 bind[110X[121X. The argument
[3Xmy_addr[103X can be made with [2XIO_make_sockaddr_in[102X ([14X3.3-1[114X) and contains its length
such that no third argument is necessary.[133X
[1X3.2-3 IO_chdir[101X
[33X[1;0Y[29X[2XIO_chdir[102X( [3Xpath[103X ) [32X function[133X
[6XReturns:[106X [33X[0;10Y[9Xtrue[109X or [9Xfail[109X[133X
[33X[0;0YChanges the current working directory. For details see [21X[10Xman 2 chdir[110X[121X.[133X
[1X3.2-4 IO_chmod[101X
[33X[1;0Y[29X[2XIO_chmod[102X( [3Xpathname[103X, [3Xmode[103X ) [32X function[133X
[6XReturns:[106X [33X[0;10Y[9Xtrue[109X or [9Xfail[109X[133X
[33X[0;0YChanges the mode of a file. For details see [21X[10Xman 2 chmod[110X[121X.[133X
[1X3.2-5 IO_chown[101X
[33X[1;0Y[29X[2XIO_chown[102X( [3Xpath[103X, [3Xowner[103X, [3Xgroup[103X ) [32X function[133X
[6XReturns:[106X [33X[0;10Y[9Xtrue[109X or [9Xfail[109X[133X
[33X[0;0YSets owner and/or group of file. For details see [21X[10Xman 2 chown[110X[121X.[133X
[1X3.2-6 IO_close[101X
[33X[1;0Y[29X[2XIO_close[102X( [3Xfd[103X ) [32X function[133X
[6XReturns:[106X [33X[0;10Y[9Xtrue[109X or [9Xfail[109X[133X
[33X[0;0YCloses a file descriptor. For details see [21X[10Xman 2 close[110X[121X.[133X
[1X3.2-7 IO_closedir[101X
[33X[1;0Y[29X[2XIO_closedir[102X( ) [32X function[133X
[6XReturns:[106X [33X[0;10Y[9Xtrue[109X or [9Xfail[109X[133X
[33X[0;0YCloses a directory. For details see [21X[10Xman 3 closedir[110X[121X. Has no arguments,
because we only have one [10XDIR[110X struct in the C part.[133X
[1X3.2-8 IO_connect[101X
[33X[1;0Y[29X[2XIO_connect[102X( [3Xfd[103X, [3Xserv_addr[103X ) [32X function[133X
[6XReturns:[106X [33X[0;10Y[9Xtrue[109X or [9Xfail[109X[133X
[33X[0;0YConnects to a remote socket. For details see [21X[10Xman 2 connect[110X[121X. The argument
[3Xserv_addr[103X can be made with [2XIO_make_sockaddr_in[102X ([14X3.3-1[114X) and contains its
length such that no third argument is necessary.[133X
[1X3.2-9 IO_creat[101X
[33X[1;0Y[29X[2XIO_creat[102X( [3Xpathname[103X, [3Xmode[103X ) [32X function[133X
[6XReturns:[106X [33X[0;10Yan integer or [9Xfail[109X[133X
[33X[0;0YCreates a new file. For details see [21X[10Xman 2 creat[110X[121X.[133X
[1X3.2-10 IO_dup[101X
[33X[1;0Y[29X[2XIO_dup[102X( [3Xoldfd[103X ) [32X function[133X
[6XReturns:[106X [33X[0;10Yan integer or [9Xfail[109X[133X
[33X[0;0YDuplicates a file descriptor. For details see [21X[10Xman 2 dup[110X[121X.[133X
[1X3.2-11 IO_dup2[101X
[33X[1;0Y[29X[2XIO_dup2[102X( [3Xoldfd[103X, [3Xnewfd[103X ) [32X function[133X
[6XReturns:[106X [33X[0;10Y[9Xtrue[109X or [9Xfail[109X[133X
[33X[0;0YDuplicates a file descriptor to a new one. For details see [21X[10Xman 2 dup2[110X[121X.[133X
[1X3.2-12 IO_execv[101X
[33X[1;0Y[29X[2XIO_execv[102X( [3Xpath[103X, [3Xargv[103X ) [32X function[133X
[6XReturns:[106X [33X[0;10Y[9Xfail[109X or does not return[133X
[33X[0;0YReplaces the process with another process. For details see [21X[10Xman 3 execv[110X[121X. The
argument [3Xargv[103X is a list of strings. The called program does not have to be
the first argument in this list.[133X
[1X3.2-13 IO_execve[101X
[33X[1;0Y[29X[2XIO_execve[102X( [3Xpath[103X, [3Xargv[103X, [3Xenvp[103X ) [32X function[133X
[6XReturns:[106X [33X[0;10Y[9Xfail[109X or does not return[133X
[33X[0;0YReplaces the process with another process. For details see [21X[10Xman 3 execve[110X[121X. The
arguments [3Xargv[103X and [3Xenvp[103X are both lists of strings. The called program does
not have to be the first argument in [3Xargv[103X. The list [3Xenvp[103X can be made with
[2XIO_MakeEnvList[102X ([14X4.3-8[114X) from a record acquired from [2XIO_Environment[102X ([14X4.3-7[114X)
and modified later.[133X
[1X3.2-14 IO_execvp[101X
[33X[1;0Y[29X[2XIO_execvp[102X( [3Xpath[103X, [3Xargv[103X ) [32X function[133X
[6XReturns:[106X [33X[0;10Y[9Xfail[109X or does not return[133X
[33X[0;0YReplaces the process with another process. For details see [21X[10Xman 3 execvp[110X[121X. The
argument [3Xargv[103X is a list of strings. The called program does not have to be
the first argument in this list.[133X
[1X3.2-15 IO_exit[101X
[33X[1;0Y[29X[2XIO_exit[102X( [3Xstatus[103X ) [32X function[133X
[33X[0;0YStops process immediately with return code [3Xstatus[103X. For details see [21X[10Xman 2
exit[110X[121X. The argument [3Xstatus[103X must be an integer. Does not return.[133X
[1X3.2-16 IO_fchmod[101X
[33X[1;0Y[29X[2XIO_fchmod[102X( [3Xfd[103X, [3Xmode[103X ) [32X function[133X
[6XReturns:[106X [33X[0;10Y[9Xtrue[109X or [9Xfail[109X[133X
[33X[0;0YChanges mode of an opened file. For details see [21X[10Xman 2 fchmod[110X[121X.[133X
[1X3.2-17 IO_fchown[101X
[33X[1;0Y[29X[2XIO_fchown[102X( [3Xfd[103X, [3Xowner[103X, [3Xgroup[103X ) [32X function[133X
[6XReturns:[106X [33X[0;10Y[9Xtrue[109X or [9Xfail[109X[133X
[33X[0;0YChanges owner and/or group of an opened file. For details see [21X[10Xman 2 fchown[110X[121X.[133X
[1X3.2-18 IO_fcntl[101X
[33X[1;0Y[29X[2XIO_fcntl[102X( [3Xfd[103X, [3Xcmd[103X, [3Xarg[103X ) [32X function[133X
[6XReturns:[106X [33X[0;10Yan integer or [9Xfail[109X[133X
[33X[0;0YDoes various things to control the behaviour of a file descriptor. For
details see [21X[10Xman 2 fcntl[110X[121X.[133X
[1X3.2-19 IO_fork[101X
[33X[1;0Y[29X[2XIO_fork[102X( ) [32X function[133X
[6XReturns:[106X [33X[0;10Yan integer or [9Xfail[109X[133X
[33X[0;0YForks off a child process, which is an identical copy. For details see [21X[10Xman 2
fork[110X[121X. Note that [2XIO_fork[102X activates our SIGCHLD handler (see
[2XIO_InstallSIGCHLDHandler[102X ([14X3.3-3[114X)). Note that you must use the [2XIO_WaitPid[102X
([14X3.2-62[114X) function to wait or check for the termination of child processes,
or call [2XIO_IgnorePid[102X ([14X3.2-63[114X) to ignore the child.[133X
[1X3.2-20 IO_fstat[101X
[33X[1;0Y[29X[2XIO_fstat[102X( [3Xfd[103X ) [32X function[133X
[6XReturns:[106X [33X[0;10Ya record or [9Xfail[109X[133X
[33X[0;0YReturns the file meta data for an opened file. For details see [21X[10Xman 2 fstat[110X[121X.
A [5XGAP[105X record is returned with the same entries than a [10Xstruct stat[110X.[133X
[1X3.2-21 IO_gethostbyname[101X
[33X[1;0Y[29X[2XIO_gethostbyname[102X( [3Xname[103X ) [32X function[133X
[6XReturns:[106X [33X[0;10Ya record or [9Xfail[109X[133X
[33X[0;0YReturn host information by name. For details see [21X[10Xman 3 gethostbyname[110X[121X. A [5XGAP[105X
record is returned with all the relevant information about the host.[133X
[1X3.2-22 IO_gethostname[101X
[33X[1;0Y[29X[2XIO_gethostname[102X( ) [32X function[133X
[6XReturns:[106X [33X[0;10Ya string or [9Xfail[109X[133X
[33X[0;0YReturn host name. For details see [21X[10Xman 3 gethostname[110X[121X.[133X
[1X3.2-23 IO_getpid[101X
[33X[1;0Y[29X[2XIO_getpid[102X( ) [32X function[133X
[6XReturns:[106X [33X[0;10Yan integer[133X
[33X[0;0YReturns the process ID of the current process as an integer. For details see
[21X[10Xman 2 getpid[110X[121X.[133X
[1X3.2-24 IO_getppid[101X
[33X[1;0Y[29X[2XIO_getppid[102X( ) [32X function[133X
[6XReturns:[106X [33X[0;10Yan integer[133X
[33X[0;0YReturns the process ID of the parent of the current process as an integer.
For details see [21X[10Xman 2 getppid[110X[121X.[133X
[1X3.2-25 IO_getsockname[101X
[33X[1;0Y[29X[2XIO_getsockname[102X( [3Xfd[103X ) [32X function[133X
[6XReturns:[106X [33X[0;10Ya string or [9Xfail[109X[133X
[33X[0;0YGet a socket name. For details see [21X[10Xman 2 getsockname[110X[121X.[133X
[1X3.2-26 IO_getsockopt[101X
[33X[1;0Y[29X[2XIO_getsockopt[102X( [3Xfd[103X, [3Xlevel[103X, [3Xoptname[103X, [3Xoptval[103X ) [32X function[133X
[6XReturns:[106X [33X[0;10Y[9Xtrue[109X or [9Xfalse[109X[133X
[33X[0;0YGet a socket option. For details see [21X[10Xman 2 getsockopt[110X[121X. Note that the
argument [3Xoptval[103X carries its length around, such that no 5th argument is
necessary.[133X
[1X3.2-27 IO_gettimeofday[101X
[33X[1;0Y[29X[2XIO_gettimeofday[102X( ) [32X function[133X
[6XReturns:[106X [33X[0;10YA record with components [10Xtv_sec[110X and [10Xtv_usec[110X[133X
[33X[0;0YThis returns the time elapsed since 1.1.1970, 0:00 GMT. The component [10Xtv_sec[110X
contains the number of full seconds and the number [10Xtv_usec[110X the additional
microseconds.[133X
[1X3.2-28 IO_gmtime[101X
[33X[1;0Y[29X[2XIO_gmtime[102X( [3Xseconds[103X ) [32X function[133X
[6XReturns:[106X [33X[0;10YA record[133X
[33X[0;0YThe argument is the number of seconds that have elapsed since 1.1.1970, 0:00
GMT. The result is a record with the current Greenwich mean time broken down
into date and time as in the C-library function [10Xgmtime[110X.[133X
[1X3.2-29 IO_kill[101X
[33X[1;0Y[29X[2XIO_kill[102X( [3Xpid[103X, [3Xsig[103X ) [32X function[133X
[6XReturns:[106X [33X[0;10Y[9Xtrue[109X or [9Xfail[109X[133X
[33X[0;0YSends the signal [3Xsig[103X to the process with process ID [3Xpid[103X. For details see [21X[10Xman
2 kill[110X[121X. The signal numbers available can be found in the global [10XIO[110X record
with names like [10XSIGTERM[110X.[133X
[1X3.2-30 IO_lchown[101X
[33X[1;0Y[29X[2XIO_lchown[102X( [3Xpath[103X, [3Xowner[103X, [3Xgroup[103X ) [32X function[133X
[6XReturns:[106X [33X[0;10Y[9Xtrue[109X or [9Xfalse[109X[133X
[33X[0;0YChanges owner and/or group of a file not following links. For details see
[21X[10Xman 2 lchown[110X[121X.[133X
[1X3.2-31 IO_link[101X
[33X[1;0Y[29X[2XIO_link[102X( [3Xoldpath[103X, [3Xnewpath[103X ) [32X function[133X
[6XReturns:[106X [33X[0;10Y[9Xtrue[109X or [9Xfalse[109X[133X
[33X[0;0YCreate a hard link. For details see [21X[10Xman 2 link[110X[121X.[133X
[1X3.2-32 IO_listen[101X
[33X[1;0Y[29X[2XIO_listen[102X( [3Xfd[103X, [3Xbacklog[103X ) [32X function[133X
[6XReturns:[106X [33X[0;10Y[9Xtrue[109X or [9Xfalse[109X[133X
[33X[0;0YSwitch a socket to listening. For details see [21X[10Xman 2 listen[110X[121X.[133X
[1X3.2-33 IO_localtime[101X
[33X[1;0Y[29X[2XIO_localtime[102X( [3Xseconds[103X ) [32X function[133X
[6XReturns:[106X [33X[0;10YA record[133X
[33X[0;0YThe argument is the number of seconds that have elapsed since 1.1.1970, 0:00
GMT. The result is a record with the current local time broken down into
date and time as in the C-library function [10Xlocaltime[110X.[133X
[1X3.2-34 IO_lseek[101X
[33X[1;0Y[29X[2XIO_lseek[102X( [3Xfd[103X, [3Xoffset[103X, [3Xwhence[103X ) [32X function[133X
[6XReturns:[106X [33X[0;10Yan integer or [9Xfail[109X[133X
[33X[0;0YSeeks within an open file. For details see [21X[10Xman 2 lseek[110X[121X.[133X
[1X3.2-35 IO_lstat[101X
[33X[1;0Y[29X[2XIO_lstat[102X( [3Xname[103X ) [32X function[133X
[6XReturns:[106X [33X[0;10Ya record or [9Xfail[109X[133X
[33X[0;0YReturns the file meta data for a file not following links. For details see
[21X[10Xman 2 lstat[110X[121X. A [5XGAP[105X record is returned with the same entries than a [10Xstruct
stat[110X.[133X
[1X3.2-36 IO_mkdir[101X
[33X[1;0Y[29X[2XIO_mkdir[102X( [3Xpathname[103X, [3Xmode[103X ) [32X function[133X
[6XReturns:[106X [33X[0;10Y[9Xtrue[109X or [9Xfalse[109X[133X
[33X[0;0YCreates a directory. For details see [21X[10Xman 2 mkdir[110X[121X.[133X
[1X3.2-37 IO_mkfifo[101X
[33X[1;0Y[29X[2XIO_mkfifo[102X( [3Xpathname[103X, [3Xmode[103X ) [32X function[133X
[6XReturns:[106X [33X[0;10Y[9Xtrue[109X or [9Xfalse[109X[133X
[33X[0;0YCreates a FIFO special file (a named pipe). For details see [21X[10Xman 3 mkfifo[110X[121X.[133X
[1X3.2-38 IO_mknod[101X
[33X[1;0Y[29X[2XIO_mknod[102X( [3Xpathname[103X, [3Xmode[103X, [3Xdev[103X ) [32X function[133X
[6XReturns:[106X [33X[0;10Y[9Xtrue[109X or [9Xfalse[109X[133X
[33X[0;0YCreate a special or ordinary file. For details see [21X[10Xman 2 mknod[110X[121X.[133X
[1X3.2-39 IO_mkstemp[101X
[33X[1;0Y[29X[2XIO_mkstemp[102X( [3Xtemplate[103X ) [32X function[133X
[6XReturns:[106X [33X[0;10Yan integer or [9Xfail[109X[133X
[33X[0;0YCreate a special or ordinary file. For details see [21X[10Xman 3 mkstemp[110X[121X.[133X
[1X3.2-40 IO_mkdtemp[101X
[33X[1;0Y[29X[2XIO_mkdtemp[102X( [3Xtemplate[103X ) [32X function[133X
[6XReturns:[106X [33X[0;10Ya string or [9Xfail[109X[133X
[33X[0;0YCreate a temporary directory. For details see [21X[10Xman 3 mkdtemp[110X[121X.[133X
[1X3.2-41 IO_open[101X
[33X[1;0Y[29X[2XIO_open[102X( [3Xpathname[103X, [3Xflags[103X, [3Xmode[103X ) [32X function[133X
[6XReturns:[106X [33X[0;10Yan integer or [9Xfail[109X[133X
[33X[0;0YOpen and possibly create a file or device. For details see [21X[10Xman 2 open[110X[121X. Only
the variant with 3 arguments can be used.[133X
[1X3.2-42 IO_opendir[101X
[33X[1;0Y[29X[2XIO_opendir[102X( [3Xname[103X ) [32X function[133X
[6XReturns:[106X [33X[0;10Y[9Xtrue[109X or [9Xfalse[109X[133X
[33X[0;0YOpens a directory. For details see [21X[10Xman 3 opendir[110X[121X. Note that only [9Xtrue[109X is
returned if everything is OK, since only one [10XDIR[110X struct is stored on the C
level and thus only one directory can be open at any time.[133X
[1X3.2-43 IO_pipe[101X
[33X[1;0Y[29X[2XIO_pipe[102X( ) [32X function[133X
[6XReturns:[106X [33X[0;10Ya record or [9Xfail[109X[133X
[33X[0;0YCreate a pair of file descriptors with a pipe between them. For details see
[21X[10Xman 2 pipe[110X[121X. Note that no arguments are needed. The result is either [9Xfail[109X in
case of an error or a record with two components [10Xtoread[110X and [10Xtowrite[110X bound to
the two filedescriptors for reading and writing respectively.[133X
[1X3.2-44 IO_read[101X
[33X[1;0Y[29X[2XIO_read[102X( [3Xfd[103X, [3Xst[103X, [3Xoffset[103X, [3Xcount[103X ) [32X function[133X
[6XReturns:[106X [33X[0;10Yan integer or [9Xfail[109X[133X
[33X[0;0YReads from file descriptor. For details see [21X[10Xman 2 read[110X[121X. Note that there is
one more argument [3Xoffset[103X to specify at which position in the string [3Xst[103X the
read data should be stored. Note that [3Xoffset[103X zero means at the beginning of
the string, which is position 1 in [5XGAP[105X. The number of bytes read or [9Xfail[109X in
case of an error is returned.[133X
[1X3.2-45 IO_readdir[101X
[33X[1;0Y[29X[2XIO_readdir[102X( ) [32X function[133X
[6XReturns:[106X [33X[0;10Ya string or [9Xfail[109X or [9Xfalse[109X[133X
[33X[0;0YReads from a directory. For details see [21X[10Xman 2 readdir[110X[121X. Note that no argument
is required as we have only one [10XDIR[110X struct on the C level. If the directory
is read completely [9Xfalse[109X is returned, and otherwise a string. An error is
indicated by [9Xfail[109X.[133X
[1X3.2-46 IO_readlink[101X
[33X[1;0Y[29X[2XIO_readlink[102X( [3Xpath[103X, [3Xbuf[103X, [3Xbufsize[103X ) [32X function[133X
[6XReturns:[106X [33X[0;10Yan integer or [9Xfail[109X[133X
[33X[0;0YReads the value of a symbolic link. For details see [21X[10Xman 2 readlink[110X[121X. [3Xbuf[103X is
modified. The new length of [3Xbuf[103X is returned or [9Xfail[109X in case of an error.[133X
[1X3.2-47 IO_recv[101X
[33X[1;0Y[29X[2XIO_recv[102X( [3Xfd[103X, [3Xst[103X, [3Xoffset[103X, [3Xlen[103X, [3Xflags[103X ) [32X function[133X
[6XReturns:[106X [33X[0;10Yan integer or [9Xfail[109X[133X
[33X[0;0YReceives data from a socket. For details see [21X[10Xman 2 recv[110X[121X. Note the additional
argument [3Xoffset[103X which plays the same role as for the [2XIO_read[102X ([14X3.2-44[114X)
function.[133X
[1X3.2-48 IO_recvfrom[101X
[33X[1;0Y[29X[2XIO_recvfrom[102X( [3Xfd[103X, [3Xst[103X, [3Xoffset[103X, [3Xlen[103X, [3Xflags[103X, [3Xaddr[103X ) [32X function[133X
[6XReturns:[106X [33X[0;10Yan integer or [9Xfail[109X[133X
[33X[0;0YReceives data from a socket with given address. For details see [21X[10Xman 2
recvfrom[110X[121X. Note the additional argument [3Xoffset[103X which plays the same role as
for the [2XIO_read[102X ([14X3.2-44[114X) function. The argument [3Xaddr[103X can be made with
[2XIO_make_sockaddr_in[102X ([14X3.3-1[114X) and contains its length such that no 7th
argument is necessary.[133X
[1X3.2-49 IO_rename[101X
[33X[1;0Y[29X[2XIO_rename[102X( [3Xoldpath[103X, [3Xnewpath[103X ) [32X function[133X
[6XReturns:[106X [33X[0;10Y[9Xtrue[109X or [9Xfalse[109X[133X
[33X[0;0YRenames a file or moves it. For details see [21X[10Xman 2 rename[110X[121X.[133X
[1X3.2-50 IO_rewinddir[101X
[33X[1;0Y[29X[2XIO_rewinddir[102X( ) [32X function[133X
[6XReturns:[106X [33X[0;10Y[9Xtrue[109X or [9Xfail[109X[133X
[33X[0;0YRewinds a directory. For details see [21X[10Xman 2 rewinddir[110X[121X. Note that no argument
is required as we have only one [10XDIR[110X struct on the C level. Returns [9Xfail[109X
only, if no prior [2XIO_opendir[102X ([14X3.2-42[114X) command has been called.[133X
[1X3.2-51 IO_rmdir[101X
[33X[1;0Y[29X[2XIO_rmdir[102X( [3Xname[103X ) [32X function[133X
[6XReturns:[106X [33X[0;10Y[9Xtrue[109X or [9Xfail[109X[133X
[33X[0;0YRemoves an empty directory. For details see [21X[10Xman 2 rmdir[110X[121X.[133X
[1X3.2-52 IO_seekdir[101X
[33X[1;0Y[29X[2XIO_seekdir[102X( [3Xoffset[103X ) [32X function[133X
[6XReturns:[106X [33X[0;10Y[9Xtrue[109X or [9Xfail[109X[133X
[33X[0;0YSets the position of the next readdir call. For details see [21X[10Xman 3 seekdir[110X[121X.
Note that no second argument is required as we have only one [10XDIR[110X struct on
the C level.[133X
[1X3.2-53 IO_select[101X
[33X[1;0Y[29X[2XIO_select[102X( [3Xinlist[103X, [3Xoutlist[103X, [3Xexclist[103X, [3Xtimeoutsec[103X, [3Xtimeoutusec[103X ) [32X function[133X
[6XReturns:[106X [33X[0;10Yan integer or [9Xfail[109X[133X
[33X[0;0YUsed for I/O multiplexing. For details see [21X[10Xman 2 select[110X[121X. [3Xinlist[103X, [3Xoutlist[103X and
[3Xexclist[103X are lists of filedescriptors, which are modified. If the
corresponding file descriptor is not yet ready, it is replaced by [9Xfail[109X. The
timeout values [3Xtimeoutsec[103X and [3Xtimeoutusec[103X correspond to the usual arguments
of [10Xselect[110X, if both are immediate integers, they are set, otherwise [10Xselect[110X is
called with no timeout value.[133X
[1X3.2-54 IO_send[101X
[33X[1;0Y[29X[2XIO_send[102X( [3Xfd[103X, [3Xst[103X, [3Xoffset[103X, [3Xlen[103X, [3Xflags[103X ) [32X function[133X
[6XReturns:[106X [33X[0;10Yan integer or [9Xfail[109X[133X
[33X[0;0YSends data to a socket. For details see [21X[10Xman 2 send[110X[121X. Note that the additional
argument [3Xoffset[103X specifies the position of the data to send within the string
[3Xst[103X. It is zero based, meaning that zero indicates the start of the string,
which is position 1 in [5XGAP[105X.[133X
[1X3.2-55 IO_sendto[101X
[33X[1;0Y[29X[2XIO_sendto[102X( [3Xfd[103X, [3Xst[103X, [3Xoffset[103X, [3Xlen[103X, [3Xflags[103X, [3Xaddr[103X ) [32X function[133X
[6XReturns:[106X [33X[0;10Yan integer or [9Xfail[109X[133X
[33X[0;0YSends data to a socket. For details see [21X[10Xman 2 sendto[110X[121X. Note that the
additional argument [3Xoffset[103X specifies the position of the data to send within
the string [3Xst[103X. It is zero based, meaning that zero indicates the start of
the string, which is position 1 in [5XGAP[105X. The argument [3Xaddr[103X can be made with
[2XIO_make_sockaddr_in[102X ([14X3.3-1[114X) and contains its length such that no 7th
argument is necessary.[133X
[1X3.2-56 IO_setsockopt[101X
[33X[1;0Y[29X[2XIO_setsockopt[102X( [3Xfd[103X, [3Xlevel[103X, [3Xoptname[103X, [3Xoptval[103X ) [32X function[133X
[6XReturns:[106X [33X[0;10Y[9Xtrue[109X or [9Xfail[109X[133X
[33X[0;0YSets a socket option. For details see [21X[10Xman 2 setsockopt[110X[121X. Note that the
argument [3Xoptval[103X carries its length around, such that no 5th argument is
necessary.[133X
[1X3.2-57 IO_socket[101X
[33X[1;0Y[29X[2XIO_socket[102X( [3Xdomain[103X, [3Xtype[103X, [3Xprotocol[103X ) [32X function[133X
[6XReturns:[106X [33X[0;10Yan integer or [9Xfail[109X[133X
[33X[0;0YCreates a socket, an endpoint for communication. For details see [21X[10Xman 2
socket[110X[121X. There is one little special: On systems that have [10Xgetprotobyname[110X you
can pass a string as third argument [3Xprotocol[103X which is automatically looked
up by [10Xgetprotobyname[110X.[133X
[1X3.2-58 IO_stat[101X
[33X[1;0Y[29X[2XIO_stat[102X( [3Xpathname[103X ) [32X function[133X
[6XReturns:[106X [33X[0;10Ya record or [9Xfail[109X[133X
[33X[0;0YReturns the file metadata for the file [3Xpathname[103X. For details see [21X[10Xman 2 stat[110X[121X.
A [5XGAP[105X record is returned with the same entries than a [10Xstruct stat[110X.[133X
[1X3.2-59 IO_symlink[101X
[33X[1;0Y[29X[2XIO_symlink[102X( [3Xoldpath[103X, [3Xnewpath[103X ) [32X function[133X
[6XReturns:[106X [33X[0;10Y[9Xtrue[109X or [9Xfail[109X[133X
[33X[0;0YCreates a symbolic link. For details see [21X[10Xman 2 symlink[110X[121X.[133X
[1X3.2-60 IO_telldir[101X
[33X[1;0Y[29X[2XIO_telldir[102X( ) [32X function[133X
[6XReturns:[106X [33X[0;10Yan integer or [9Xfail[109X[133X
[33X[0;0YReturn current location in directory. For details see [21X[10Xman 3 telldir[110X[121X. Note
that no second argument is required as we have only one [10XDIR[110X struct on the C
level.[133X
[1X3.2-61 IO_unlink[101X
[33X[1;0Y[29X[2XIO_unlink[102X( [3Xpathname[103X ) [32X function[133X
[6XReturns:[106X [33X[0;10Y[9Xtrue[109X or [9Xfail[109X[133X
[33X[0;0YDelete a name and possibly the file it refers to. For details see [21X[10Xman 2
unlink[110X[121X.[133X
[1X3.2-62 IO_WaitPid[101X
[33X[1;0Y[29X[2XIO_WaitPid[102X( [3Xpid[103X, [3Xwait[103X ) [32X function[133X
[6XReturns:[106X [33X[0;10Ya record or [9Xfail[109X[133X
[33X[0;0YWaits for the termination of a child process. For details see [21X[10Xman 2 waitpid[110X[121X.
Returns a [5XGAP[105X record describing PID and exit status. The second argument
[3Xwait[103X must be either [9Xtrue[109X or [9Xfalse[109X. In the first case, the call blocks until
new information about a terminated child process is available. In the second
case no such waiting is performed, the call returns immediately. See [2XIO_fork[102X
([14X3.2-19[114X). If you do not care about the return value of the process, call
[2XIO_IgnorePid[102X ([14X3.2-63[114X).[133X
[1X3.2-63 IO_IgnorePid[101X
[33X[1;0Y[29X[2XIO_IgnorePid[102X( [3Xpid[103X ) [32X function[133X
[6XReturns:[106X [33X[0;10YNothing[133X
[33X[0;0YDisowns a child process. This means there is no need to call [2XIO_WaitPid[102X
([14X3.2-62[114X). Calling [2XIO_WaitPid[102X ([14X3.2-62[114X) on a pid which was previously passed
to [2XIO_IgnorePid[102X may cause an infinite loop.F[133X
[1X3.2-64 IO_write[101X
[33X[1;0Y[29X[2XIO_write[102X( [3Xfd[103X, [3Xst[103X, [3Xoffset[103X, [3Xcount[103X ) [32X function[133X
[6XReturns:[106X [33X[0;10Yan integer or [9Xfail[109X[133X
[33X[0;0YWrites to a file descriptor. For details see [21X[10Xman 2 write[110X[121X. Note that the
additional argument [3Xoffset[103X specifies the position of the data to send within
the string [3Xst[103X. It is zero based, meaning that zero indicates the start of
the string, which is position 1 in [5XGAP[105X.[133X
[1X3.3 [33X[0;0YFurther C level functions[133X[101X
[33X[0;0YThe following functions do not correspond to functions in the C library, but
are there to provide convenience to use other functions:[133X
[1X3.3-1 IO_make_sockaddr_in[101X
[33X[1;0Y[29X[2XIO_make_sockaddr_in[102X( [3Xip[103X, [3Xport[103X ) [32X function[133X
[6XReturns:[106X [33X[0;10Ya string or [9Xfail[109X[133X
[33X[0;0YMakes a struct [10Xsockaddr_in[110X from IP address and port. The IP address must be
given as a string of length four, containing the four bytes of an IPv4
address in natural order. The port must be a port number. Returns a string
containing the struct, which can be given to all functions above having an
address argument.[133X
[1X3.3-2 IO_environ[101X
[33X[1;0Y[29X[2XIO_environ[102X( ) [32X function[133X
[6XReturns:[106X [33X[0;10Ya list of strings[133X
[33X[0;0YFor details see [21X[10Xman environ[110X[121X. Returns the current environment as a list of
strings of the form [21Xkey=value[121X.[133X
[1X3.3-3 IO_InstallSIGCHLDHandler[101X
[33X[1;0Y[29X[2XIO_InstallSIGCHLDHandler[102X( ) [32X function[133X
[6XReturns:[106X [33X[0;10Y[9Xtrue[109X or [9Xfalse[109X[133X
[33X[0;0YInstalls our SIGCHLD handler. This functions works as an idempotent. That
is, calling it twice does exactly the same as calling it once. It returns
[9Xtrue[109X when it is called for the first time since then a pointer to the old
signal handler is stored in a global variable. This function is
automatically called by any function which creates new processes, so never
needs to be called unless the handler was explictly disabled with
[2XIO_RestoreSIGCHLDHandler[102X ([14X3.3-4[114X) See [2XIO_fork[102X ([14X3.2-19[114X).[133X
[1X3.3-4 IO_RestoreSIGCHLDHandler[101X
[33X[1;0Y[29X[2XIO_RestoreSIGCHLDHandler[102X( ) [32X function[133X
[33X[0;0YRestores the original SIGCHLD handler. This function works as an idempotent.
That is, calling it twice does exactly the same as calling it once. It
returns [9Xtrue[109X when it is called for the first time after calling
[2XIO_InstallSIGCHLDHandler[102X ([14X3.3-3[114X). See [2XIO_fork[102X ([14X3.2-19[114X).[133X
|