summaryrefslogtreecommitdiff
path: root/libaio-0.3.109/harness/cases/7.t
blob: f877d8a083ee3eb90f611f9b7d12f2d33cfb74be (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
29
30
/* 7.t
- Write overlapping the file size rlimit boundary: should be a short
  write. (7.t)
- Write at the file size rlimit boundary: should give EFBIG.  (I think
  the spec requires that you do NOT deliver SIGXFSZ in this case, where
  you would do so for sync IO.) (7.t)
- Special case: a write of zero bytes at or beyond the file size rlimit
  boundary must return success. (7.t)
*/

#include <sys/resource.h>
#include <signal.h>

void SET_RLIMIT(long long limit)
{
	struct rlimit rlim;
	int res;

	/* Seems that we do send SIGXFSZ, but hard to fix... */
	signal(SIGXFSZ, SIG_IGN);
	rlim.rlim_cur = limit;			assert(rlim.rlim_cur == limit);
	rlim.rlim_max = limit;			assert(rlim.rlim_max == limit);

	res = setrlimit(RLIMIT_FSIZE, &rlim);	assert(res == 0);
}

#define LIMIT	8192
#define FILENAME	"testdir/rwfile"

#include "common-7-8.h"