summaryrefslogtreecommitdiff
path: root/libaio-0.3.109/harness/cases/8.t
blob: e59199f3e13d8f9b9075467e59ceef20585ae64c (plain)
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
/* 8.t
- Ditto for the above three tests at the offset maximum (largest
  possible ext2/3 file size.) (8.t)
 */
#include <sys/types.h>
#include <unistd.h>

long long get_fs_limit(int fd)
{
	long long min = 0, max = 9223372036854775807LL;
	char c = 0;

	while (max - min > 1) {
		if (pwrite64(fd, &c, 1, (min + max) / 2) == -1)
			max = (min + max) / 2;
		else {
			ftruncate(fd, 0);
			min = (min + max) / 2;
		}
	}
	return max;
}

#define SET_RLIMIT(x)	do ; while (0)
#define LIMIT		get_fs_limit(rwfd)
#define FILENAME	"testdir.ext2/rwfile"

#include "common-7-8.h"