Lines Matching defs:head

176 	struct socket *head = so->so_head;
183 if (head && (so->so_state & SS_INCOMP)) {
186 if (head->so_proto->pr_getlock != NULL) {
188 socket_lock(head, 1);
190 postevent(head, 0, EV_RCONN);
191 TAILQ_REMOVE(&head->so_incomp, so, so_list);
192 head->so_incqlen--;
193 TAILQ_INSERT_TAIL(&head->so_comp, so, so_list);
194 sorwakeup(head);
195 wakeup_one((caddr_t)&head->so_timeo);
196 if (head->so_proto->pr_getlock != NULL) {
197 socket_unlock(head, 1);
257 sonewconn_internal(struct socket *head, int connstatus)
263 if (head->so_proto->pr_getlock != NULL)
264 mutex_held = (*head->so_proto->pr_getlock)(head, 0);
266 mutex_held = head->so_proto->pr_domain->dom_mtx;
274 so_qlen = head->so_qlen;
284 so_qlen = head->so_qlen - head->so_incqlen;
285 if (head->so_incqlen > somaxconn)
290 (soqlimitcompat ? head->so_qlimit : (3 * head->so_qlimit / 2)))
292 so = soalloc(1, head->so_proto->pr_domain->dom_family,
293 head->so_type);
296 /* check if head was closed during the soalloc */
297 if (head->so_proto == NULL) {
302 so->so_type = head->so_type;
303 so->so_options = head->so_options &~ SO_ACCEPTCONN;
304 so->so_linger = head->so_linger;
305 so->so_state = head->so_state | SS_NOFDREF;
306 so->so_proto = head->so_proto;
307 so->so_timeo = head->so_timeo;
308 so->so_pgid = head->so_pgid;
309 kauth_cred_ref(head->so_cred);
310 so->so_cred = head->so_cred;
311 so->last_pid = head->last_pid;
312 so->last_upid = head->last_upid;
314 so->so_flags = head->so_flags & (SOF_NOSIGPIPE |
335 mac_socket_label_associate_accept(head, so);
339 so->so_traffic_mgt_flags = head->so_traffic_mgt_flags & (TRAFFIC_MGT_SO_BACKGROUND);
340 so->so_background_thread = head->so_background_thread;
341 so->so_traffic_class = head->so_traffic_class;
343 if (soreserve(so, head->so_snd.sb_hiwat, head->so_rcv.sb_hiwat)) {
347 so->so_rcv.sb_flags |= (head->so_rcv.sb_flags & SB_USRSIZE);
348 so->so_snd.sb_flags |= (head->so_snd.sb_flags & SB_USRSIZE);
351 * Must be done with head unlocked to avoid deadlock
354 if (head->so_proto->pr_unlock)
355 socket_unlock(head, 0);
359 if (head->so_proto->pr_unlock)
360 socket_lock(head, 0);
363 if (head->so_proto->pr_unlock) {
364 socket_lock(head, 0);
365 /* Radar 7385998 Recheck that the head is still accepting
366 * to avoid race condition when head is getting closed.
368 if ((head->so_options & SO_ACCEPTCONN) == 0) {
378 /* Insert in head appropriate lists */
379 so->so_head = head;
390 TAILQ_INSERT_TAIL(&head->so_comp, so, so_list);
393 TAILQ_INSERT_TAIL(&head->so_incomp, so, so_list);
395 head->so_incqlen++;
397 head->so_qlen++;
406 sorwakeup(head);
407 wakeup((caddr_t)&head->so_timeo);
414 sonewconn(struct socket *head, int connstatus, const struct sockaddr *from)
416 int error = sflt_connectin(head, from);
421 return (sonewconn_internal(head, connstatus));