#include <sys/queue.h>
#include <sys/select.h>
Go to the source code of this file.
|
#define | SB_MAX (256L*1024L) /* default for max chars in sockbuf */ |
|
#define | SB_LOCK 0x01 /* lock on data queue */ |
|
#define | SB_WANT 0x02 /* someone is waiting to lock */ |
|
#define | SB_WAIT 0x04 /* someone is waiting for data/space */ |
|
#define | SB_SEL 0x08 /* someone is selecting */ |
|
#define | SB_ASYNC 0x10 /* ASYNC I/O, need signals */ |
|
#define | SB_NOTIFY (SB_WAIT|SB_SEL|SB_ASYNC) |
|
#define | SB_NOINTR 0x40 /* operations not interruptible */ |
|
#define | SS_NOFDREF 0x0001 /* no file table ref any more */ |
|
#define | SS_ISCONNECTED 0x0002 /* socket connected to a peer */ |
|
#define | SS_ISCONNECTING 0x0004 /* in process of connecting to peer */ |
|
#define | SS_ISDISCONNECTING 0x0008 /* in process of disconnecting */ |
|
#define | SS_CANTSENDMORE 0x0010 /* can't send more data to peer */ |
|
#define | SS_CANTRCVMORE 0x0020 /* can't receive more data from peer */ |
|
#define | SS_RCVATMARK 0x0040 /* at mark on input */ |
|
#define | SS_PRIV 0x0080 /* privileged for broadcast, raw... */ |
|
#define | SS_NBIO 0x0100 /* non-blocking ops */ |
|
#define | SS_ASYNC 0x0200 /* async i/o notify */ |
|
#define | SS_ISCONFIRMING 0x0400 /* deciding to accept connection req */ |
|
#define | SS_INCOMP 0x0800 /* unaccepted, incomplete connection */ |
|
#define | SS_COMP 0x1000 /* unaccepted, complete connection */ |
|
#define | sbspace(sb) |
|
#define | sosendallatonce(so) ((so)->so_proto->pr_flags & PR_ATOMIC) |
|
#define | soreadable(so) |
|
#define | sowriteable(so) |
|
#define | sballoc(sb, m) |
|
#define | sbfree(sb, m) |
|
#define | sblock(sb, wf) |
|
#define | sbunlock(sb) |
|
#define | sorwakeup(so) |
|
#define | sowwakeup(so) sowakeup((so), &(so)->so_snd) |
|
|
typedef u_quad_t | so_gen_t |
|
◆ sballoc
#define sballoc |
( |
|
sb, |
|
|
|
m |
|
) |
| |
Value:{ \
(sb)->sb_cc += (m)->m_len; \
(sb)->sb_mbcnt += MSIZE; \
if ((m)->m_flags & M_EXT) \
(sb)->sb_mbcnt += (m)->m_ext.ext_size; \
}
◆ sbfree
Value:{ \
(sb)->sb_cc -= (m)->m_len; \
(sb)->sb_mbcnt -= MSIZE; \
if ((m)->m_flags & M_EXT) \
(sb)->sb_mbcnt -= (m)->m_ext.ext_size; \
}
◆ sblock
#define sblock |
( |
|
sb, |
|
|
|
wf |
|
) |
| |
Value:((sb)->sb_flags & SB_LOCK ? \
(((wf) == M_WAITOK) ? sb_lock(sb) : EWOULDBLOCK) : \
((sb)->sb_flags |= SB_LOCK), 0)
◆ sbspace
Value:((long) imin((int)((sb)->sb_hiwat - (sb)->sb_cc), \
(int)((sb)->sb_mbmax - (sb)->sb_mbcnt)))
◆ sbunlock
Value:{ \
(sb)->sb_flags &= ~SB_LOCK; \
if ((sb)->sb_flags & SB_WANT) { \
(sb)->sb_flags &= ~SB_WANT; \
wakeup((caddr_t)&(sb)->sb_flags); \
} \
}
◆ soreadable
Value:((so)->so_rcv.sb_cc >= (so)->so_rcv.sb_lowat || \
((so)->so_state & SS_CANTRCVMORE) || \
(so)->so_comp.tqh_first || (so)->so_error)
◆ sorwakeup
Value:{ sowakeup((so), &(so)->so_rcv); \
if ((so)->so_upcall) \
(*((so)->so_upcall))((so), (so)->so_upcallarg, M_DONTWAIT); \
}
◆ sowriteable
#define sowriteable |
( |
|
so | ) |
|
Value:((sbspace(&(so)->so_snd) >= (so)->so_snd.sb_lowat && \
(((so)->so_state&SS_ISCONNECTED) || \
((so)->so_proto->pr_flags&PR_CONNREQUIRED)==0)) || \
((so)->so_state & SS_CANTSENDMORE) || \
(so)->so_error)