GRASS GIS 8 Programmer's Manual
8.4.1(2025)-45ca3179ab
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 GIS 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
#include <grass/gis.h>
19
#include "local_proto.h"
20
21
/**
22
* \brief Internal use only
23
*
24
* Pages segment to disk.
25
*
26
* Finds segment value <b>i</b> in segment <b>seg</b> and pages it out
27
* to disk.
28
*
29
* \param[in] SEG segment
30
* \param[in] i segment value
31
* \return 1 if successful
32
* \return -1 on error
33
*/
34
35
int
seg_pageout
(SEGMENT *SEG,
int
i)
36
{
37
SEG->seek(SEG, SEG->scb[i].n, 0);
38
errno = 0;
39
if
(write(SEG->fd, SEG->scb[i].buf, SEG->size) != SEG->size) {
40
int
err
= errno;
41
42
if
(
err
)
43
G_warning
(
"Segment pageout: %s"
, strerror(
err
));
44
else
45
G_warning
(
"Segment pageout: insufficient disk space?"
);
46
return
-1;
47
}
48
SEG->scb[i].dirty = 0;
49
50
return
1;
51
}
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:35
err
SYMBOL * err(FILE *fp, SYMBOL *s, char *msg)
Definition
symbol/read.c:216
segment
pageout.c
Generated on Sat Jun 21 2025 21:07:27 for GRASS GIS 8 Programmer's Manual by
1.13.2