if (!s->head) { s->head = smalloc(sizeof(struct buffer)); } else { struct buffer *walk = s->head->next; while (walk) { struct buffer *tmp = walk; walk = tmp->next; sfree(tmp); } } s->head->next = NULL; s->tail = s->head; s->head->buflen = len; memcpy(s->head->buf, buf, len);
bufchain_clear(&s->output_data); assert(len <= sizeof(s->oobdata)); memcpy(s->oobdata, buf, len);
static void sk_tcp_write_oob(Socket sock, char *buf, int len){    Actual_Socket s = (Actual_Socket) sock;    /*     * Replace the buffer list on the socket with the data.     */    if (!s->head) {	s->head = smalloc(sizeof(struct buffer));    } else {	struct buffer *walk = s->head->next;	while (walk) {	    struct buffer *tmp = walk;	    walk = tmp->next;	    sfree(tmp);	}    }    s->head->next = NULL;    s->tail = s->head;    s->head->buflen = len;    memcpy(s->head->buf, buf, len);    /*     * Set the Urgent marker.     */    s->sending_oob = len;    /*     * Now try sending from the start of the buffer list.     */    if (s->writable)	try_send(s);}