MCPcopy Create free account
hub / github.com/OpenPrinting/cups / cupsBackChannelRead

Function cupsBackChannelRead

cups/backchannel.c:44–81  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

42 */
43
44ssize_t /* O - Bytes read or -1 on error */
45cupsBackChannelRead(char *buffer, /* I - Buffer to read into */
46 size_t bytes, /* I - Bytes to read */
47 double timeout) /* I - Timeout in seconds, typically 0.0 to poll */
48{
49 fd_set input; /* Input set */
50 struct timeval tval; /* Timeout value */
51 int status; /* Select status */
52
53
54 /*
55 * Wait for input ready.
56 */
57
58 do
59 {
60 cups_setup(&input, &tval, timeout);
61
62 if (timeout < 0.0)
63 status = select(4, &input, NULL, NULL, NULL);
64 else
65 status = select(4, &input, NULL, NULL, &tval);
66 }
67 while (status < 0 && errno != EINTR && errno != EAGAIN);
68
69 if (status <= 0)
70 return (-1); /* Timeout! */
71
72 /*
73 * Read bytes from the pipe...
74 */
75
76#ifdef _WIN32
77 return ((ssize_t)_read(3, buffer, (unsigned)bytes));
78#else
79 return (read(3, buffer, bytes));
80#endif /* _WIN32 */
81}
82
83
84/*

Callers 2

mainFunction · 0.85
auto_configureFunction · 0.85

Calls 1

cups_setupFunction · 0.85

Tested by 1

mainFunction · 0.68