~ubuntu-branches/ubuntu/vivid/grass/vivid-proposed

« back to all changes in this revision

Viewing changes to lib/segment/pageout.c

  • Committer: Package Import Robot
  • Author(s): Bas Couwenberg
  • Date: 2015-02-20 23:12:08 UTC
  • mfrom: (8.2.6 experimental)
  • Revision ID: package-import@ubuntu.com-20150220231208-1u6qvqm84v430b10
Tags: 7.0.0-1~exp1
* New upstream release.
* Update python-ctypes-ternary.patch to use if/else instead of and/or.
* Drop check4dev patch, rely on upstream check.
* Add build dependency on libpq-dev to grass-dev for libpq-fe.h.
* Drop patches applied upstream, refresh remaining patches.
* Update symlinks for images switched from jpg to png.

Show diffs side-by-side

added added

removed removed

Lines of Context:
9
9
 *
10
10
 * \author GRASS GIS Development Team
11
11
 *
12
 
 * \date 2005-2006
 
12
 * \date 2005-2009
13
13
 */
14
14
 
15
15
#include <stdio.h>
16
16
#include <unistd.h>
17
17
#include <string.h>
18
18
#include <errno.h>
19
 
#include <grass/segment.h>
 
19
#include <grass/gis.h>
 
20
#include "local_proto.h"
20
21
 
21
22
 
22
23
/**
23
 
 * \fn int segment_pageout(SEGMENT *SEG, int i)
24
 
 *
25
 
 * \brief Pages segment to disk.
 
24
 * \brief Internal use only
 
25
 * 
 
26
 * Pages segment to disk.
26
27
 *
27
28
 * Finds segment value <b>i</b> in segment <b>seg</b> and pages it out 
28
29
 * to disk.
29
30
 *
30
 
 * \param[in] seg segment
 
31
 * \param[in] SEG segment
31
32
 * \param[in] i segment value
32
33
 * \return 1 if successful
33
34
 * \return -1 on error
34
35
 */
35
36
 
36
 
int segment_pageout(SEGMENT * SEG, int i)
 
37
int seg_pageout(SEGMENT * SEG, int i)
37
38
{
38
 
    segment_seek(SEG, SEG->scb[i].n, 0);
 
39
    SEG->seek(SEG, SEG->scb[i].n, 0);
 
40
    errno = 0;
39
41
    if (write(SEG->fd, SEG->scb[i].buf, SEG->size) != SEG->size) {
40
 
        G_warning("segment_pageout: %s", strerror(errno));
 
42
        int err = errno;
 
43
 
 
44
        if (err)
 
45
            G_warning("Segment pageout: %s", strerror(err));
 
46
        else
 
47
            G_warning("Segment pageout: insufficient disk space?");
41
48
        return -1;
42
49
    }
43
50
    SEG->scb[i].dirty = 0;