File: unistd.h

package info (click to toggle)
netsurf 3.11-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 87,296 kB
  • sloc: ansic: 403,115; xml: 81,988; cpp: 6,246; perl: 4,605; makefile: 2,907; yacc: 2,246; python: 2,057; sh: 1,500; jsp: 1,156; lex: 623; javascript: 551; ruby: 329; asm: 326; lisp: 151; php: 6
file content (57 lines) | stat: -rw-r--r-- 1,710 bytes parent folder | download | duplicates (3)
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
/*
 * Copyright 2015 Vincent Sanders <vince@netsurf-browser.org>
 *
 * This file is part of libnsutils.
 *
 * Licensed under the MIT License,
 *                http://www.opensource.org/licenses/mit-license.php
 */

/**
 * \file
 * Time related operations.
 */

#ifndef NSUTILS_UNISTD_H_
#define NSUTILS_UNISTD_H_

#include <unistd.h>

/**
 * Perform a write operation at a specific offset
 *
 * This writes the data into the file specifid by teh file handle at teh given
 * offset. The offset may be beyond the existing file extent.
 *
 * This provides a uniform interface to the pwrite operation without system
 * specific implementation details.
 *
 * \note The write pointer on the fd may be moved by this operation which
 * differs from the posix version.
 *
 * \param fd The file descriptor.
 * \param buf The data to write.
 * \param count The length of data in \a buf to write.
 * \param offset The offset into the file to write the data.
 * \return the number of bytes written or -1 on error and errno set.
 */
ssize_t nsu_pwrite(int fd, const void *buf, size_t count, off_t offset);

/**
 * Perform a read from a specific offset.
 *
 * This provides a uniform interface to the POSIX pread operation without
 * system specific implementation details.
 *
 * \note The read pointer on the fd may be moved by this operation which
 * differs from the POSIX version.
 *
 * \param fd The file descriptor.
 * \param buf The buffer to place the data into.
 * \param count The length of data to read.
 * \param offset The offset into the file to read the data from.
 * \return the number of bytes read or -1 on error and errno set.
 */
ssize_t nsu_pread(int fd, void *buf, size_t count, off_t offset);

#endif