Changeset View
Changeset View
Standalone View
Standalone View
sys/netgraph/ng_socket.c
Show First 20 Lines • Show All 981 Lines • ▼ Show 20 Lines | #endif | ||||
/* Send it up to the socket. */ | /* Send it up to the socket. */ | ||||
if (sbappendaddr_locked(&so->so_rcv, (struct sockaddr *)&addr, m, | if (sbappendaddr_locked(&so->so_rcv, (struct sockaddr *)&addr, m, | ||||
NULL) == 0) { | NULL) == 0) { | ||||
SOCKBUF_UNLOCK(&so->so_rcv); | SOCKBUF_UNLOCK(&so->so_rcv); | ||||
TRAP_ERROR; | TRAP_ERROR; | ||||
m_freem(m); | m_freem(m); | ||||
return (ENOBUFS); | return (ENOBUFS); | ||||
} | } | ||||
/* sorwakeup_locked () releases the lock internally. */ | |||||
sorwakeup_locked(so); | sorwakeup_locked(so); | ||||
return (error); | return (error); | ||||
} | } | ||||
/* | /* | ||||
* Receive data on a hook | * Receive data on a hook | ||||
*/ | */ | ||||
Show All 22 Lines | ngs_rcvdata(hook_p hook, item_p item) | ||||
addrlen = strlen(NG_HOOK_NAME(hook)); /* <= NG_HOOKSIZ - 1 */ | addrlen = strlen(NG_HOOK_NAME(hook)); /* <= NG_HOOKSIZ - 1 */ | ||||
addr = (struct sockaddr_ng *) addrbuf; | addr = (struct sockaddr_ng *) addrbuf; | ||||
addr->sg_len = addrlen + 3; | addr->sg_len = addrlen + 3; | ||||
addr->sg_family = AF_NETGRAPH; | addr->sg_family = AF_NETGRAPH; | ||||
bcopy(NG_HOOK_NAME(hook), addr->sg_data, addrlen); | bcopy(NG_HOOK_NAME(hook), addr->sg_data, addrlen); | ||||
addr->sg_data[addrlen] = '\0'; | addr->sg_data[addrlen] = '\0'; | ||||
/* Try to tell the socket which hook it came in on. */ | /* Try to tell the socket which hook it came in on. */ | ||||
if (sbappendaddr(&so->so_rcv, (struct sockaddr *)addr, m, NULL) == 0) { | SOCKBUF_LOCK(&so->so_rcv); | ||||
if (sbappendaddr_locked(&so->so_rcv, (struct sockaddr *)addr, m, | |||||
NULL) == 0) { | |||||
markj: Indentation on the second line should be by four spaces. | |||||
SOCKBUF_UNLOCK(&so->so_rcv); | |||||
m_freem(m); | m_freem(m); | ||||
TRAP_ERROR; | TRAP_ERROR; | ||||
return (ENOBUFS); | return (ENOBUFS); | ||||
} | } | ||||
sorwakeup(so); | |||||
/* sorwakeup_locked () releases the lock internally. */ | |||||
sorwakeup_locked(so); | |||||
Done Inline ActionsThat might want a comment to explain that sorwakeup_locked() releases the lock. kp: That might want a comment to explain that sorwakeup_locked() releases the lock. | |||||
Done Inline ActionsYes, I thought about it)) While I'm here, add the same comment to ngs_rcvmsg(). afedorov: Yes, I thought about it)) While I'm here, add the same comment to ngs_rcvmsg(). | |||||
return (0); | return (0); | ||||
} | } | ||||
/* | /* | ||||
* Hook disconnection | * Hook disconnection | ||||
* | * | ||||
* For this type, removal of the last link destroys the node | * For this type, removal of the last link destroys the node | ||||
* if the NOLINGER flag is set. | * if the NOLINGER flag is set. | ||||
▲ Show 20 Lines • Show All 175 Lines • Show Last 20 Lines |
Indentation on the second line should be by four spaces.