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.
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. |
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.
The kern_soreserve kernel service can be called from the process environment.
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);
}
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.