Bugzilla – Attachment 848031 Details for
Bug 1184339
select() no longer modifies timeout value
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Forgot Password
test program
t.c (text/x-csrc), 839 bytes, created by
Steffen Winterfeldt
on 2021-04-07 07:33:22 UTC
(
hide
)
Description:
test program
Filename:
MIME Type:
Creator:
Steffen Winterfeldt
Created:
2021-04-07 07:33:22 UTC
Size:
839 bytes
patch
obsolete
>#include <stdio.h> >#include <stdlib.h> >#include <unistd.h> >#include <errno.h> >#include <signal.h> >#include <time.h> >#include <sys/time.h> >#include <sys/select.h> > >void sig(int signum) >{ > fprintf(stderr, "alarm %d\n", signum); >} > >int main(int argc, char **argv) >{ > int i; > fd_set readable; > > signal(SIGALRM, &sig); > > FD_ZERO(&readable); > FD_SET(0, &readable); > > struct itimerval itv = { it_interval: { tv_sec: 1 }, it_value: { tv_sec: 1 } }; > setitimer(ITIMER_REAL, &itv, NULL); > > struct timeval tv = { tv_sec: 10 }; > > do { > i = select(FD_SETSIZE, &readable, NULL, NULL, &tv); > fprintf(stderr, "select: %d.%06d\n", (int) tv.tv_sec, (int) tv.tv_usec); > } while (i == -1 && errno == EINTR); > > if(i > 0) { > char *s = NULL; > size_t n = 0; > getline(&s, &n, stdin); > fprintf(stderr, "read: %s", s); > } > > return 0; >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
Actions:
View
Attachments on
bug 1184339
:
847988
|
847991
| 848031