Warning: Attempt to read property "date" on null in /usr/local/www/websvn.planix.org/blame.php on line 247

Warning: Attempt to read property "msg" on null in /usr/local/www/websvn.planix.org/blame.php on line 247
WebSVN – planix.SVN – Blame – /os/branches/feature_tlsv12/sys/src/libbio/bflush.c – Rev 2

Subversion Repositories planix.SVN

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 - 1
#include	<u.h>
2
#include	<libc.h>
3
#include	<bio.h>
4
 
5
int
6
Bflush(Biobufhdr *bp)
7
{
8
	int n, c;
9
 
10
	switch(bp->state) {
11
	case Bwactive:
12
		n = bp->bsize+bp->ocount;
13
		if(n == 0)
14
			return 0;
15
		c = write(bp->fid, bp->bbuf, n);
16
		if(n == c) {
17
			bp->offset += n;
18
			bp->ocount = -bp->bsize;
19
			return 0;
20
		}
21
		bp->state = Binactive;
22
		bp->ocount = 0;
23
		break;
24
 
25
	case Bracteof:
26
		bp->state = Bractive;
27
 
28
	case Bractive:
29
		bp->icount = 0;
30
		bp->gbuf = bp->ebuf;
31
		return 0;
32
	}
33
	return Beof;
34
}