Lines Matching refs:fd

52     int fd;
82 printf("%d ", ufds[i].fd);
127 static int _close(int fd, int type) {
130 printf("%d: close(%d)\n", gettid(), fd);
131 ret = close(fd);
132 printf("%d: close(%d) = %d\n", gettid(), fd, ret);
138 static int _bind(int fd, int type) {
167 printf("%d: bind(%d)\n", gettid(), fd);
168 ret = bind(fd, addr, len);
169 printf("%d: bind(%d) = %d\n", gettid(), fd, ret);
175 static int _listen(int fd, int type) {
178 printf("%d: listen(%d)\n", gettid(), fd);
179 ret = listen(fd, 1);
180 printf("%d: listen(%d) = %d\n", gettid(), fd, ret);
186 static int _read(int fd) {
190 printf("%d: read(%d)\n", gettid(), fd);
191 ret = read(fd, &buf, 1);
192 printf("%d: read(%d) = %d [%d]\n", gettid(), fd, ret, (int)buf);
199 static int _accept(int fd, int type) {
227 printf("%d: accept(%d)\n", gettid(), fd);
228 ret = accept(fd, addr, &len);
229 printf("%d: accept(%d) = %d\n", gettid(), fd, ret);
238 static int _connect(int fd, int type) {
266 printf("%d: connect(%d)\n", gettid(), fd);
267 ret = connect(fd, addr, len);
268 printf("%d: connect(%d) = %d\n", gettid(), fd, ret);
274 static int _write(int fd, int type) {
278 printf("%d: write(%d)\n", gettid(), fd);
279 ret = write(fd, &buf, 1);
280 printf("%d: write(%d) = %d\n", gettid(), fd, ret);
286 static int _shutdown(int fd, int how) {
289 printf("%d: shutdown(%d)\n", gettid(), fd);
290 ret = shutdown(fd, how);
291 printf("%d: shutdown(%d) = %d\n", gettid(), fd, ret);
310 printf("\tfd %d ", ufds[i].fd); print_events(ufds[i].revents);
320 _close(args->fd, args->type);
325 int fd = (int)args;
328 pfd.fd = fd;
335 int fd = (int)args;
337 _read(fd);
342 int fd = (int)args;
345 pfd.fd = fd;
351 static void thread_shutdown(int fd) {
354 _shutdown(fd, SHUT_RDWR);
361 _accept(args->fd, args->type);
368 _connect(args->fd, args->type);
375 _close(args->fd, args->type);
377 _write(args->fd, args->type);
384 _accept(args->fd, args->type);
386 _write(args->fd, args->type);
393 args->fd = _socket(args->type);
394 _connect(args->fd, args->type);
399 int fd;
401 fd = _socket(type);
402 if (fd < 0) goto error;
404 if (_bind(fd, type) < 0) goto error;
406 if (_listen(fd, type) < 0) goto error;
409 _accept(fd, type);
419 int fd;
423 fd = _socket(type);
424 if (fd < 0) goto error;
426 if (_bind(fd, type) < 0) goto error;
428 if (_listen(fd, type) < 0) goto error;
430 args.fd = fd;
433 _accept(fd, type);
444 int fd;
448 fd = _socket(type);
449 if (fd < 0) goto error;
451 if (_bind(fd, type) < 0) goto error;
453 if (_listen(fd, type) < 0) goto error;
455 args.fd = fd;
459 _shutdown(fd, SHUT_RDWR);
463 _close(fd, type);
472 int fd;
476 fd = _socket(type);
477 if (fd < 0) goto error;
479 args.fd = fd;
483 _shutdown(fd, SHUT_RDWR);
487 _close(fd, type);
497 int fd;
501 fd = _socket(type);
502 if (fd < 0) goto error;
504 if (_bind(fd, type) < 0) goto error;
506 if (_listen(fd, type) < 0) goto error;
508 args.fd = fd;
511 _accept(fd, type);
523 int fd;
527 fd = _socket(type);
530 pthread_create(&t[i], NULL, (void *)thread_poll, (void *)fd);
534 _shutdown(fd, SHUT_RDWR);
539 _close(fd, type);
546 int fd;
550 fd = _socket(type);
553 pthread_create(&t[i], NULL, (void *)thread_poll, (void *)fd);
557 _close(fd, type);
567 int fd;
571 fd = _socket(type);
574 pthread_create(&t[i], NULL, (void *)thread_read, (void *)fd);
578 _close(fd, type);
588 int fd;
592 fd = _socket(type);
595 pthread_create(&t[i], NULL, (void *)thread_read, (void *)fd);
599 _shutdown(fd, SHUT_RDWR);
604 _close(fd, type);
623 a1.fd = fd1;
644 int fd;
650 fd = _socket(type);
651 if (fd < 0) goto error;
653 if (_bind(fd, type) < 0) goto error;
655 if (_listen(fd, type) < 0) goto error;
660 _accept(fd, type);