mirror of
https://git.openafs.org/openafs.git
synced 2025-02-01 14:07:39 +00:00
STABLE14-linux-reduce-stack-use-20050726
FIXES 20337 don't do pointless work in osi_NetSend, and save some stack (cherry picked from commit a21fc56daf70d0433276eab29798542f6ef362ad)
This commit is contained in:
parent
87dbfa307a
commit
58bb7856fb
@ -95,27 +95,15 @@ rxk_FreeSocket(register struct socket *asocket)
|
|||||||
* non-zero = failure
|
* non-zero = failure
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
osi_NetSend(osi_socket sop, struct sockaddr_in *to, struct iovec *iov,
|
osi_NetSend(osi_socket sop, struct sockaddr_in *to, struct iovec *iovec,
|
||||||
int iovcnt, afs_int32 size, int istack)
|
int iovcnt, afs_int32 size, int istack)
|
||||||
{
|
{
|
||||||
KERNEL_SPACE_DECL;
|
KERNEL_SPACE_DECL;
|
||||||
struct msghdr msg;
|
struct msghdr msg;
|
||||||
int code;
|
int code;
|
||||||
struct iovec tmpvec[RX_MAXWVECS + 2];
|
|
||||||
|
|
||||||
if (iovcnt > RX_MAXWVECS + 2) {
|
msg.msg_iovlen = iovcnt;
|
||||||
osi_Panic("Too many (%d) iovecs passed to osi_NetSend\n", iovcnt);
|
msg.msg_iov = iovec;
|
||||||
}
|
|
||||||
|
|
||||||
if (iovcnt <= 2) { /* avoid pointless uiomove */
|
|
||||||
tmpvec[0].iov_base = iov[0].iov_base;
|
|
||||||
tmpvec[0].iov_len = size;
|
|
||||||
msg.msg_iovlen = 1;
|
|
||||||
} else {
|
|
||||||
memcpy(tmpvec, iov, iovcnt * sizeof(struct iovec));
|
|
||||||
msg.msg_iovlen = iovcnt;
|
|
||||||
}
|
|
||||||
msg.msg_iov = tmpvec;
|
|
||||||
msg.msg_name = to;
|
msg.msg_name = to;
|
||||||
msg.msg_namelen = sizeof(*to);
|
msg.msg_namelen = sizeof(*to);
|
||||||
msg.msg_control = NULL;
|
msg.msg_control = NULL;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user