aboutsummaryrefslogtreecommitdiff
path: root/src/include/gnunet_disk_lib.h
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2012-01-14 23:18:06 +0000
committerChristian Grothoff <christian@grothoff.org>2012-01-14 23:18:06 +0000
commit91ab799c42b2496e65afd0c866811999d88119ed (patch)
tree2c31aa87ead94723c1d959a691b11811fc4589f8 /src/include/gnunet_disk_lib.h
parenta72a1c6fc09216c5be7f5ee697ff55cf66907c80 (diff)
downloadgnunet-91ab799c42b2496e65afd0c866811999d88119ed.tar.gz
gnunet-91ab799c42b2496e65afd0c866811999d88119ed.zip
LRN: enable more fine-grained control over blocking/non-blocking pipe operation
Diffstat (limited to 'src/include/gnunet_disk_lib.h')
-rw-r--r--src/include/gnunet_disk_lib.h28
1 files changed, 26 insertions, 2 deletions
diff --git a/src/include/gnunet_disk_lib.h b/src/include/gnunet_disk_lib.h
index be92a91c6..46dd7c4c4 100644
--- a/src/include/gnunet_disk_lib.h
+++ b/src/include/gnunet_disk_lib.h
@@ -395,7 +395,7 @@ GNUNET_DISK_file_handle_size (struct GNUNET_DISK_FileHandle *fh,
395 * @return handle to the new pipe, NULL on error 395 * @return handle to the new pipe, NULL on error
396 */ 396 */
397struct GNUNET_DISK_PipeHandle * 397struct GNUNET_DISK_PipeHandle *
398GNUNET_DISK_pipe (int blocking, int inherit_read, int inherit_write); 398GNUNET_DISK_pipe (int blocking_read, int blocking_write, int inherit_read, int inherit_write);
399 399
400 400
401/** 401/**
@@ -408,7 +408,7 @@ GNUNET_DISK_pipe (int blocking, int inherit_read, int inherit_write);
408 * @return handle to the new pipe, NULL on error 408 * @return handle to the new pipe, NULL on error
409 */ 409 */
410struct GNUNET_DISK_PipeHandle * 410struct GNUNET_DISK_PipeHandle *
411GNUNET_DISK_pipe_from_fd (int blocking, int fd[2]); 411GNUNET_DISK_pipe_from_fd (int blocking_read, int blocking_write, int fd[2]);
412 412
413/** 413/**
414 * Closes an interprocess channel 414 * Closes an interprocess channel
@@ -461,6 +461,19 @@ ssize_t
461GNUNET_DISK_file_read (const struct GNUNET_DISK_FileHandle *h, void *result, 461GNUNET_DISK_file_read (const struct GNUNET_DISK_FileHandle *h, void *result,
462 size_t len); 462 size_t len);
463 463
464/**
465 * Read the contents of a binary file into a buffer.
466 * Guarantees not to block (returns GNUNET_SYSERR and sets errno to EAGAIN
467 * when no data can be read).
468 *
469 * @param h handle to an open file
470 * @param result the buffer to write the result to
471 * @param len the maximum number of bytes to read
472 * @return the number of bytes read on success, GNUNET_SYSERR on failure
473 */
474ssize_t
475GNUNET_DISK_file_read_non_blocking (const struct GNUNET_DISK_FileHandle * h,
476 void *result, size_t len);
464 477
465/** 478/**
466 * Read the contents of a binary file into a buffer. 479 * Read the contents of a binary file into a buffer.
@@ -488,6 +501,17 @@ GNUNET_DISK_file_write (const struct GNUNET_DISK_FileHandle *h,
488 501
489 502
490/** 503/**
504 * Write a buffer to a file, blocking, if necessary.
505 * @param h handle to open file
506 * @param buffer the data to write
507 * @param n number of bytes to write
508 * @return number of bytes written on success, GNUNET_SYSERR on error
509 */
510ssize_t
511GNUNET_DISK_file_write_blocking (const struct GNUNET_DISK_FileHandle * h,
512 const void *buffer, size_t n);
513
514/**
491 * Write a buffer to a file. If the file is longer than 515 * Write a buffer to a file. If the file is longer than
492 * the given buffer size, it will be truncated. 516 * the given buffer size, it will be truncated.
493 * 517 *