GRASS 8 Programmer's Manual
8.5.0RC1(2026)-3334b87d9c
Loading...
Searching...
No Matches
pageout.c
Go to the documentation of this file.
1
/**
2
* \file pageout.c
3
*
4
* \brief Segment page-out routines.
5
*
6
* This program is free software under the GNU General Public License
7
* (>=v2). Read the file COPYING that comes with GRASS for details.
8
*
9
* \author GRASS Development Team
10
*
11
* \date 2005-2009
12
*/
13
14
#include <stdio.h>
15
#include <unistd.h>
16
#include <string.h>
17
#include <errno.h>
18
19
#include <grass/gis.h>
20
#include <grass/glocale.h>
21
22
#include "local_proto.h"
23
24
/**
25
* \brief Internal use only
26
*
27
* Pages segment to disk.
28
*
29
* Finds segment value <b>i</b> in segment <b>seg</b> and pages it out
30
* to disk.
31
*
32
* \param[in] SEG segment
33
* \param[in] i segment value
34
* \return 1 if successful
35
* \return -1 on error
36
*/
37
int
seg_pageout
(SEGMENT *SEG,
int
i)
38
{
39
if
(SEG->seek(SEG, SEG->scb[i].n, 0) == -1) {
40
int
err
= errno;
41
G_warning
(_(
"File read/write operation failed: %s (%d)"
), strerror(
err
),
42
err
);
43
return
-1;
44
}
45
errno = 0;
46
if
(write(SEG->fd, SEG->scb[i].buf, SEG->size) != SEG->size) {
47
int
err
= errno;
48
49
if
(
err
)
50
G_warning
(
"Segment pageout: %s"
, strerror(
err
));
51
else
52
G_warning
(
"Segment pageout: insufficient disk space?"
);
53
return
-1;
54
}
55
SEG->scb[i].dirty = 0;
56
57
return
1;
58
}
G_warning
void G_warning(const char *msg,...)
Print a warning message to stderr.
Definition
gis/error.c:203
seg_pageout
int seg_pageout(SEGMENT *SEG, int i)
Internal use only.
Definition
pageout.c:37
err
SYMBOL * err(FILE *fp, SYMBOL *s, char *msg)
Definition
symbol/read.c:216
segment
pageout.c
Generated on
for GRASS 8 Programmer's Manual by
1.15.0