struct sk_buff *sbd_pio_rx(struct sbd_ring_buffer *rb) { struct sk_buff *skb; unsigned int qlen = rb->len; unsigned int out = *rb->rp; skb = recv_data(rb, out); if (unlikely(!skb)) return NULL; *rb->rp = circ_new_ptr(qlen, out, 1); set_lnk_hdr(rb, skb); set_skb_priv(rb, skb); check_more(rb, skb); return skb; }
int main(int ac, char *av[]) { bool restore; /* Revoke setgid privileges */ setgid(getgid()); if (strcmp(av[0], "a.out") == 0) { outf = fopen("q", "w"); setbuf(outf, NULL); Debug = TRUE; } restore = FALSE; switch (ac) { case 2: rest_f(av[1]); restore = TRUE; case 1: break; default: usage(); /* NOTREACHED */ } Play = PLAYER; initscr(); delwin(stdscr); stdscr = Board = newwin(BOARD_Y, BOARD_X, 0, 0); Score = newwin(SCORE_Y, SCORE_X, 0, 40); Miles = newwin(MILES_Y, MILES_X, 17, 0); #ifdef attron idlok(Board, TRUE); idlok(Score, TRUE); idlok(Miles, TRUE); #endif leaveok(Score, TRUE); leaveok(Miles, TRUE); clearok(curscr, TRUE); srandomdev(); cbreak(); noecho(); signal(SIGINT, rub); for (;;) { if (!restore || (Player[PLAYER].total >= 5000 || Player[COMP].total >= 5000)) { if (Player[COMP].total < Player[PLAYER].total) Player[PLAYER].games++; else if (Player[COMP].total > Player[PLAYER].total) Player[COMP].games++; Player[COMP].total = 0; Player[PLAYER].total = 0; } do { if (!restore) Handstart = Play = other(Handstart); if (!restore || On_exit) { shuffle(); init(); } newboard(); if (restore) mvwaddstr(Score, ERR_Y, ERR_X, Initstr); prboard(); do { domove(); if (Finished) newscore(); prboard(); } while (!Finished); check_more(); restore = On_exit = FALSE; } while (Player[COMP].total < 5000 && Player[PLAYER].total < 5000); } }