diff options
author | Christian Grothoff <christian@grothoff.org> | 2020-07-18 00:44:39 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2020-07-18 00:44:39 +0200 |
commit | 7f4ddbcab8598e3d5e29c23ce883cdfa664408f1 (patch) | |
tree | 5f1b18463f641f24fad519e0aefb60b97d707b52 /src/include/gnunet_disk_lib.h | |
parent | 28ab2c446fba4980a8295d59fdf203a028a35dd6 (diff) | |
download | gnunet-7f4ddbcab8598e3d5e29c23ce883cdfa664408f1.tar.gz gnunet-7f4ddbcab8598e3d5e29c23ce883cdfa664408f1.zip |
merge flags into enum for GNUNET_DISK_pipe() API, fixing #6188
Diffstat (limited to 'src/include/gnunet_disk_lib.h')
-rw-r--r-- | src/include/gnunet_disk_lib.h | 46 |
1 files changed, 34 insertions, 12 deletions
diff --git a/src/include/gnunet_disk_lib.h b/src/include/gnunet_disk_lib.h index f43cf8943..51ae7d8d5 100644 --- a/src/include/gnunet_disk_lib.h +++ b/src/include/gnunet_disk_lib.h | |||
@@ -391,33 +391,54 @@ GNUNET_DISK_file_handle_size (struct GNUNET_DISK_FileHandle *fh, | |||
391 | 391 | ||
392 | 392 | ||
393 | /** | 393 | /** |
394 | * Flags for #GNUNET_DISK_pipe(). | ||
395 | */ | ||
396 | enum GNUNET_DISK_PipeFlags | ||
397 | { | ||
398 | |||
399 | /** | ||
400 | * No special options, use non-blocking read/write operations. | ||
401 | */ | ||
402 | GNUNET_DISK_PF_NONE, | ||
403 | |||
404 | /** | ||
405 | * Configure read end to block when reading if set. | ||
406 | */ | ||
407 | GNUNET_DISK_PF_BLOCKING_READ = 1, | ||
408 | /** | ||
409 | * Configure write end to block when writing if set. | ||
410 | */ | ||
411 | GNUNET_DISK_PF_BLOCKING_WRITE = 2, | ||
412 | |||
413 | /** | ||
414 | * Configure both pipe ends for blocking operations if set. | ||
415 | */ | ||
416 | GNUNET_DISK_PF_BLOCKING_RW = GNUNET_DISK_PF_BLOCKING_READ | ||
417 | | GNUNET_DISK_PF_BLOCKING_WRITE | ||
418 | |||
419 | }; | ||
420 | |||
421 | |||
422 | /** | ||
394 | * Creates an interprocess channel | 423 | * Creates an interprocess channel |
395 | * | 424 | * |
396 | * @param blocking_read creates an asynchronous pipe for reading if set to #GNUNET_NO | 425 | * @param pf how to configure the pipe |
397 | * @param blocking_write creates an asynchronous pipe for writing if set to #GNUNET_NO | ||
398 | * @param inherit_read 1 to make read handle inheritable, 0 otherwise (NT only) | ||
399 | * @param inherit_write 1 to make write handle inheritable, 0 otherwise (NT only) | ||
400 | * @return handle to the new pipe, NULL on error | 426 | * @return handle to the new pipe, NULL on error |
401 | */ | 427 | */ |
402 | struct GNUNET_DISK_PipeHandle * | 428 | struct GNUNET_DISK_PipeHandle * |
403 | GNUNET_DISK_pipe (int blocking_read, | 429 | GNUNET_DISK_pipe (enum GNUNET_DISK_PipeFlags pf); |
404 | int blocking_write, | ||
405 | int inherit_read, | ||
406 | int inherit_write); | ||
407 | 430 | ||
408 | 431 | ||
409 | /** | 432 | /** |
410 | * Creates a pipe object from a couple of file descriptors. | 433 | * Creates a pipe object from a couple of file descriptors. |
411 | * Useful for wrapping existing pipe FDs. | 434 | * Useful for wrapping existing pipe FDs. |
412 | * | 435 | * |
413 | * @param blocking_read creates an asynchronous pipe for reading if set to #GNUNET_NO | 436 | * @param pf how to configure the pipe |
414 | * @param blocking_write creates an asynchronous pipe for writing if set to #GNUNET_NO | ||
415 | * @param fd an array of two fd values. One of them may be -1 for read-only or write-only pipes | 437 | * @param fd an array of two fd values. One of them may be -1 for read-only or write-only pipes |
416 | * @return handle to the new pipe, NULL on error | 438 | * @return handle to the new pipe, NULL on error |
417 | */ | 439 | */ |
418 | struct GNUNET_DISK_PipeHandle * | 440 | struct GNUNET_DISK_PipeHandle * |
419 | GNUNET_DISK_pipe_from_fd (int blocking_read, | 441 | GNUNET_DISK_pipe_from_fd (enum GNUNET_DISK_PipeFlags pf, |
420 | int blocking_write, | ||
421 | int fd[2]); | 442 | int fd[2]); |
422 | 443 | ||
423 | 444 | ||
@@ -479,6 +500,7 @@ const struct GNUNET_DISK_FileHandle * | |||
479 | GNUNET_DISK_pipe_handle (const struct GNUNET_DISK_PipeHandle *p, | 500 | GNUNET_DISK_pipe_handle (const struct GNUNET_DISK_PipeHandle *p, |
480 | enum GNUNET_DISK_PipeEnd n); | 501 | enum GNUNET_DISK_PipeEnd n); |
481 | 502 | ||
503 | |||
482 | /** | 504 | /** |
483 | * Update POSIX permissions mask of a file on disk. If both argumets | 505 | * Update POSIX permissions mask of a file on disk. If both argumets |
484 | * are #GNUNET_NO, the file is made world-read-write-executable (777). | 506 | * are #GNUNET_NO, the file is made world-read-write-executable (777). |