=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/aucat/Attic/sock.c,v retrieving revision 1.19 retrieving revision 1.20 diff -u -r1.19 -r1.20 --- src/usr.bin/aucat/Attic/sock.c 2009/07/25 08:44:27 1.19 +++ src/usr.bin/aucat/Attic/sock.c 2009/07/25 10:52:19 1.20 @@ -1,4 +1,4 @@ -/* $OpenBSD: sock.c,v 1.19 2009/07/25 08:44:27 ratchov Exp $ */ +/* $OpenBSD: sock.c,v 1.20 2009/07/25 10:52:19 ratchov Exp $ */ /* * Copyright (c) 2008 Alexandre Ratchov * @@ -24,13 +24,14 @@ #include #include #include -#include "aproc.h" + #include "abuf.h" -#include "sock.h" -#include "dev.h" +#include "aproc.h" #include "conf.h" +#include "dev.h" #include "midi.h" #include "opt.h" +#include "sock.h" int sock_attach(struct sock *, int); int sock_read(struct sock *); @@ -97,9 +98,9 @@ DPRINTFN(4, "rsock_out: %p\n", f); /* - * when calling sock_read(), we may receive a ``STOP'' command, + * When calling sock_read(), we may receive a ``STOP'' command, * and detach ``obuf''. In this case, there's no more caller and - * we'll stop processing further messages, resulting in a dead lock. + * we'll stop processing further messages, resulting in a deadlock. * The solution is to iterate over sock_read() in order to * consume all messages(). */ @@ -190,7 +191,7 @@ DPRINTFN(4, "wsock_in: %p\n", f); /* - * see remark in rsock_out() + * See remark in rsock_out(). */ for (;;) { if (!sock_write(f)) @@ -270,8 +271,8 @@ }; /* - * initialise socket in the SOCK_HELLO state with default - * parameters + * Initialise socket in the SOCK_HELLO state with default + * parameters. */ struct sock * sock_new(struct fileops *ops, int fd) @@ -313,7 +314,7 @@ } /* - * free buffers + * Free buffers. */ void sock_freebuf(struct sock *f) @@ -331,7 +332,7 @@ } /* - * allocate buffers, so client can start filling write-end. + * Allocate buffers, so client can start filling write-end. */ void sock_allocbuf(struct sock *f) @@ -357,7 +358,7 @@ } /* - * free buffers + * Set volume. */ void sock_setvol(struct sock *f, int vol) @@ -374,7 +375,7 @@ } /* - * attach play and/or record buffers to dev_mix and/or dev_sub + * Attach play and/or record buffers to dev_mix and/or dev_sub. */ int sock_attach(struct sock *f, int force) @@ -385,8 +386,8 @@ wbuf = LIST_FIRST(&f->pipe.file.wproc->ibuflist); /* - * if in SOCK_START state, dont attach until - * the buffer isn't completely filled + * If in SOCK_START state, dont attach until + * the buffer isn't completely filled. */ if (!force && rbuf && ABUF_WOK(rbuf)) return 0; @@ -395,7 +396,7 @@ f->pstate = SOCK_RUN; /* - * attach them to the device + * Attach them to the device. */ dev_attach(f->pipe.file.name, (f->mode & AMSG_PLAY) ? rbuf : NULL, &f->rpar, f->xrun, @@ -405,7 +406,7 @@ dev_setvol(rbuf, f->vol); /* - * send the initial position, if needed + * Send the initial position, if needed. */ for (;;) { if (!sock_write(f)) @@ -433,8 +434,8 @@ } /* - * read a message from the file descriptor, return 1 if done, 0 - * otherwise. The message is stored in f->rmsg + * Read a message from the file descriptor, return 1 if done, 0 + * otherwise. The message is stored in f->rmsg. */ int sock_rmsg(struct sock *f) @@ -459,7 +460,7 @@ } /* - * write a message to the file descriptor, return 1 if done, 0 + * Write a message to the file descriptor, return 1 if done, 0 * otherwise. The "m" argument is f->rmsg or f->wmsg, and the "ptodo" * points to the f->rtodo or f->wtodo respectively. */ @@ -486,7 +487,7 @@ } /* - * read data chunk from the file descriptor, return 1 if at least one + * Read data chunk from the file descriptor, return 1 if at least one * byte was read, 0 if the file blocked. */ int @@ -522,7 +523,7 @@ } /* - * write data chunk to the file descriptor, return 1 if at least one + * Write data chunk to the file descriptor, return 1 if at least one * byte was written, 0 if the file blocked. */ int @@ -561,7 +562,7 @@ if (f->pstate == SOCK_MIDI) return 0; /* - * there's no dev_detach() routine yet, + * There's no dev_detach() routine yet, * so now we abruptly destroy the buffer. * Until we implement dev_detach, complete * the packet with zeros... @@ -785,7 +786,7 @@ } /* - * execute message in f->rmsg and change the state accordingly; return 1 + * Execute message in f->rmsg and change the state accordingly; return 1 * on success, and 0 on failure, in which case the socket is destroyed. */ int @@ -962,7 +963,7 @@ } /* - * create a new data/pos message + * Create a new data/pos message. */ int sock_buildmsg(struct sock *f) @@ -978,7 +979,7 @@ } /* - * if pos changed, build a MOVE message + * If pos changed, build a MOVE message. */ if (f->tickpending && f->delta >= 0) { DPRINTFN(4, "sock_buildmsg: %p: POS: %d\n", f, f->delta); @@ -993,7 +994,7 @@ } /* - * if data available, build a DATA message + * If data available, build a DATA message. */ p = f->pipe.file.wproc; ibuf = LIST_FIRST(&p->ibuflist); @@ -1015,7 +1016,7 @@ } /* - * read from the socket file descriptor, fill input buffer and update + * Read from the socket file descriptor, fill input buffer and update * the state. Return 1 if at least one message or 1 data byte was * processed, 0 if something blocked. */ @@ -1051,7 +1052,7 @@ } /* - * process messages to return + * Process messages to return. */ int sock_return(struct sock *f) @@ -1075,7 +1076,7 @@ for (;;) { /* * in() may trigger rsock_done and destroy the - * wsock + * wsock. */ rp = f->pipe.file.rproc; if (!rp || !rp->ops->in(rp, NULL)) @@ -1089,7 +1090,7 @@ } /* - * write messages and data on the socket file descriptor. Return 1 if + * Write messages and data on the socket file descriptor. Return 1 if * at least one message or one data byte was processed, 0 if something * blocked. */