/**
- * Create an (empty) temporary file on disk.
+ * Create an (empty) temporary file on disk. If the given name is not
+ * an absolute path, the current 'TMPDIR' will be prepended. In any case,
+ * 6 random characters will be appended to the name to create a unique
+ * filename.
*
* @param t component to use for the name;
* does NOT contain "XXXXXX" or "/tmp/".
* @param fn file name to be opened
* @param flags opening flags, a combination of GNUNET_DISK_OPEN_xxx bit flags
* @param perm permissions for the newly created file, use
- * GNUNET_DISK_PERM_USER_NONE if a file could not be created by this
+ * GNUNET_DISK_PERM_NONE if a file could not be created by this
* call (because of flags)
* @return IO handle on success, NULL on error
*/
*/
struct GNUNET_DISK_PipeHandle *GNUNET_DISK_pipe (int blocking);
+
/**
* Closes an interprocess channel
* @param p pipe
*/
int GNUNET_DISK_pipe_close (struct GNUNET_DISK_PipeHandle *p);
+/**
+ * Closes one half of an interprocess channel
+ *
+ * @param p pipe to close end of
+ * @param end which end of the pipe to close
+ * @return GNUNET_OK on success, GNUNET_SYSERR otherwise
+ */
+int
+GNUNET_DISK_pipe_close_end (struct GNUNET_DISK_PipeHandle *p,
+ enum GNUNET_DISK_PipeEnd end);
+
/**
* Close an open file.
*
*/
int GNUNET_DISK_file_close (struct GNUNET_DISK_FileHandle *h);
+
/**
* Get the handle to a particular pipe end
+ *
* @param p pipe
* @param n end to access
* @return handle for the respective end
* @param h handle to open file
* @param buffer the data to write
* @param n number of bytes to write
- * @return GNUNET_OK on success, GNUNET_SYSERR on error
+ * @return number of bytes written on success, GNUNET_SYSERR on error
*/
ssize_t GNUNET_DISK_file_write (const struct GNUNET_DISK_FileHandle *h,
const void *buffer,
*
* @param cls closure
* @param di argument to pass to "GNUNET_DISK_directory_iterator_next" to
- * get called on the next entry (or finish cleanly)
+ * get called on the next entry (or finish cleanly);
+ * NULL on error (will be the last call in that case)
* @param filename complete filename (absolute path)
* @param dirname directory name (absolute path)
*/