c++ - What does `POLLOUT` event in `poll` Linux function mean? -
from linux documentation, pollout means normal data may written without blocking. well, explanation ambigous. how data possible write without blocking after poll reported event? 1 byte? 2 bytes? gigabyte? after pollout event on blocking socket, how check how data can send socket without block?
poll system call tells there happen in file descriptor(physical device) doesn't tell how space available read or write. in order know how many bytes data available used reading or writing, must use read() or write() system call return value says number of bytes have been read or written.
thus,poll() used applications must use multiple input or output streams without getting stuck on 1 of them. can't use write() or read() in case since can't monitor multiple descriptors @ same time within 1 thread.
btw,for device driver,the underlying implementation poll in driver likes this(code ldd3):
static unsigned int scull_p_poll(struct file *filp, poll_table *wait) { poll_wait(filp, &dev->inq, wait); poll_wait(filp, &dev->outq, wait); ........... if (spacefree(dev)) mask |= pollout | pollwrnorm; /* writable */ up(&dev->sem); return mask; }
Comments
Post a Comment