kern_soreserve Kernel Service

Purpose

The routine enforces the limit for the send and receive buffer space for a socket. It does not actually allocate memory only sets the buffer size.

Syntax

#include <sys/kern_socket.h>
int kern_soreserve( ksocket_t  so, uint64_t sndcc, uint64_t rcvcc )

Parameters

Item Description
so The socket that will be used in reserving the space.
sndcc Send buffer size in bytes.
rcvcc Receive buffer size in bytes.

Description

The kern_soreserve kernel service enforces the limit for the send and receive buffer space for a socket. It does not actually allocate memory. It sets the buffer size.

Execution Environment

The kern_soreserve kernel service can be called from the process environment.

Examples

ksocket_t   so;
uint64_t    sb_snd_hiwat = 2048;		 		 
uint64_t    sb_rcv_hiwat = 2048;		 		 
int		       rc;
rc = kern_socreate(AF_INET, &so, SOCK_STREAM, IPPROTO_TCP);
if (rc != 0 )  		 
{ 		 		 
		 return(-1); 		 
}		   		 
rc = kern_soreserve(so, sb_snd_hiwat, sb_rcv_hiwat);
if (rc != 0 ) 
{ 		 		 
     return(-1); 		 
}		 	  

Return Values

Item Description
0 Upon Success
>0 Error

The nonzero return value is the error number that is defined in the /usr/include/sys/errno.h file.