afd
const struct afd *afd;
afd = find_afd(pai->ai_family);
if (afd == NULL)
GET_AI(cur->ai_next, afd, afd->a_addrany);
GET_AI(cur->ai_next, afd, afd->a_loopback);
const struct afd *afd;
afd = find_afd(pai->ai_family);
if (afd == NULL)
switch (afd->a_af) {
if (pai->ai_family == afd->a_af ||
GET_AI(cur->ai_next, afd, pton);
if (inet_pton(afd->a_af, hostname, pton) == 1) {
if (pai->ai_family == afd->a_af ||
GET_AI(cur->ai_next, afd, pton);
const struct afd *afd;
afd = find_afd(pai->ai_family);
if (afd == NULL)
if (!afd->a_scoped)
get_ai(const struct addrinfo *pai, const struct afd *afd, const char *addr)
_DIAGASSERT(afd != NULL);
ai = allocaddrinfo((socklen_t)afd->a_socklen);
ai->ai_addrlen = (socklen_t)afd->a_socklen;
ai->ai_addr->sa_family = ai->ai_family = afd->a_af;
memcpy(p + afd->a_off, addr, (size_t)afd->a_addrlen);
static const struct afd *
const struct afd *afd;
for (afd = afdl; afd->a_af; afd++) {
if (afd->a_af == af)
return afd;
const struct afd *afd;
afd = find_afd(ai.ai_family);
if (afd == NULL) {
cur->ai_next = get_ai(&ai, afd, (const char *)cp);
const struct afd *, const char *);
static const struct afd *find_afd(int);
#define GET_AI(ai, afd, addr) \
(ai) = get_ai(pai, (afd), (addr)); \
const struct afd *afd;
afd = &afdl[i];
if (salen < afd->a_socklen)
addr = (const char *)(const void *)sa + afd->a_off;
switch(afd->a_af) {
if (inet_ntop(afd->a_af, addr, numaddr,
hp = gethostbyaddr_r(addr, afd->a_addrlen, afd->a_af, &hent,
switch(afd->a_af) {
if (inet_ntop(afd->a_af, addr, host,
static const struct afd {
int sfd = -1, cfd = -1, afd = -1;
afd = accept(sfd, (struct sockaddr *)&paddr, &plen);
if (afd == -1)
if (read(afd, buf, sizeof(mymsg)) != sizeof(mymsg))
(void)close(afd);
(void)close(afd);
if (da.afd > -1)
da.afd = open(da.auname, O_WRONLY);
if (da.afd < 0) {
rc = ioctl(da.afd, AUDIO_GETENC, &ae);
rc = ioctl(da.afd, AUDIO_GETENC, &ae);
close(da.afd);
da.afd = -1;
rc = ioctl(da.afd, AUDIO_SETINFO, &ai);
close(da.afd);
da.afd = -1;
readaudio(int afd, int lba, int blocks, u_char *data)
rc = ioctl(afd, SCIOCCOMMAND, &sc);
int afd;
da.afd = -1;
if (da.afd == -1 && !openaudio()) {
close(da.afd);
da.afd = -1;
(void)write(da.afd, da.aubuf, aulen);