aboutsummaryrefslogtreecommitdiff
path: root/src/include/gnunet_disk_lib.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/include/gnunet_disk_lib.h')
-rw-r--r--src/include/gnunet_disk_lib.h46
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 */
396enum 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 */
402struct GNUNET_DISK_PipeHandle * 428struct GNUNET_DISK_PipeHandle *
403GNUNET_DISK_pipe (int blocking_read, 429GNUNET_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 */
418struct GNUNET_DISK_PipeHandle * 440struct GNUNET_DISK_PipeHandle *
419GNUNET_DISK_pipe_from_fd (int blocking_read, 441GNUNET_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 *
479GNUNET_DISK_pipe_handle (const struct GNUNET_DISK_PipeHandle *p, 500GNUNET_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).