Don't pass size_t arguments to setsockopt(SO_SNDBUF/SO_RCVBUF).

These command take an int. The tests work by accident on little-endian,
64-bit systems.

PR:		218919
Tested with:	qemu-cheri and CheriBSD built for mips64
Reviewed by:	asomers, ngie
Obtained from:	CheriBSD
MFC after:	1 week
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D10518
This commit is contained in:
Brooks Davis 2017-04-28 17:58:15 +00:00
parent a0f9777dc4
commit ea703329bf

View File

@ -127,7 +127,7 @@ shutdown_send_sigpipe_handler(int __unused x)
* Parameterized test function bodies
*/
static void
test_eagain(size_t sndbufsize, size_t rcvbufsize)
test_eagain(int sndbufsize, int rcvbufsize)
{
int i;
int sv[2];
@ -165,7 +165,7 @@ test_eagain(size_t sndbufsize, size_t rcvbufsize)
}
static void
test_sendrecv_symmetric_buffers(size_t bufsize, int blocking) {
test_sendrecv_symmetric_buffers(int bufsize, int blocking) {
int s;
int sv[2];
const ssize_t pktsize = bufsize / 2;
@ -209,7 +209,7 @@ test_sendrecv_symmetric_buffers(size_t bufsize, int blocking) {
}
static void
test_pipe_simulator(size_t sndbufsize, size_t rcvbufsize)
test_pipe_simulator(int sndbufsize, int rcvbufsize)
{
int num_sent, num_received;
int sv[2];
@ -341,7 +341,7 @@ test_pipe_reader(void* args)
static void
test_pipe(size_t sndbufsize, size_t rcvbufsize)
test_pipe(int sndbufsize, int rcvbufsize)
{
test_pipe_thread_data_t writer_data, reader_data;
pthread_t writer, reader;
@ -875,8 +875,8 @@ ATF_TC_WITHOUT_HEAD(emsgsize);
ATF_TC_BODY(emsgsize, tc)
{
int sv[2];
const size_t sndbufsize = 8192;
const size_t rcvbufsize = 8192;
const int sndbufsize = 8192;
const int rcvbufsize = 8192;
const size_t pktsize = (sndbufsize + rcvbufsize) * 2;
char sndbuf[pktsize];
ssize_t ssize;
@ -904,8 +904,8 @@ ATF_TC_WITHOUT_HEAD(emsgsize_nonblocking);
ATF_TC_BODY(emsgsize_nonblocking, tc)
{
int sv[2];
const size_t sndbufsize = 8192;
const size_t rcvbufsize = 8192;
const int sndbufsize = 8192;
const int rcvbufsize = 8192;
const size_t pktsize = (sndbufsize + rcvbufsize) * 2;
char sndbuf[pktsize];
ssize_t ssize;
@ -962,8 +962,8 @@ ATF_TC_BODY(rcvbuf_oversized, tc)
int i;
int sv[2];
const ssize_t pktsize = 1024;
const size_t sndbufsize = 8192;
const size_t rcvbufsize = 131072;
const int sndbufsize = 8192;
const int rcvbufsize = 131072;
const size_t geometric_mean_bufsize = 32768;
const int numpkts = geometric_mean_bufsize / pktsize;
char sndbuf[pktsize];