poll

Autres langues

Langue: ru

Autres versions - même langue

Version: 7 ÄÅËÁÂÒÑ 1997 (openSuse - 09/10/07)

Section: 2 (Appels système)

îáú÷áîéå

poll - ÏÖÉÄÁÎÉÅ ÒÁÚÎÏÏÂÒÁÚÎÙÈ ÓÏÂÙÔÉÊ ÎÁ ÆÁÊÌÏ×ÏÍ ÄÅÓËÒÉÐÔÏÒÅ

ëòáôëáñ ó÷ïäëá

#include <sys/poll.h>

int poll(struct pollfd *ufds, unsigned int nfds, int timeout);

ïðéóáîéå

poll Ñ×ÌÑÅÔÓÑ ×ÁÒÉÁÃÉÅÊ ÎÁ ÔÅÍÕ select. úÄÅÓØ ÚÁÄÁÅÔÓÑ ÍÁÓÓÉ× ÉÚ nfds ÓÔÒÕËÔÕÒ ÔÉÐÁ

        struct pollfd {

                int fd;           /* ÆÁÊÌÏ×ÙÊ ÄÅÓËÒÉÐÔÏÒ */

                short events;     /* ÚÁÐÒÏÛÅÎÎÙÅ ÓÏÂÙÔÉÑ */

                short revents;    /* ×ÏÚ×ÒÁÝÅÎÎÙÅ ÓÏÂÙÔÉÑ */

        };

É timeout × ÍÉÌÌÉÓÅËÕÎÄÁÈ. ïÔÒÉÃÁÔÅÌØÎÏÅ ÚÎÁÞÅÎÉÅ ÏÚÎÁÞÁÅÔ ÂÅÓËÏÎÅÞÎÙÊ ÔÁÊÍ-ÁÕÔ. ðÏÌÅ fd ÓÏÄÅÒÖÉÔ ÆÁÊÌÏ×ÙÊ ÄÅÓËÒÉÐÔÏÒ ÏÔËÒÙÔÏÇÏ ÆÁÊÌÁ. ðÏÌÅ events-- ×ÈÏÄÎÏÊ ÐÁÒÁÍÅÔÒ, ÕËÁÚÙ×ÁÀÝÉÊ ÂÉÔÏ×ÕÀ ÍÁÓËÕ ÓÏÂÙÔÉÊ, ÉÎÔÅÒÅÓÕÀÝÉÈ ÐÒÉÌÏÖÅÎÉÅ. ðÏÌÅ revents-- ×ÙÈÏÄÎÏÊ ÐÁÒÁÍÅÔÒ, ËÕÄÁ ÑÄÒÏ ÐÏÍÅÝÁÅÔ ÉÎÆÏÒÍÁÃÉÀ Ï ÐÒÏÉÚÏÛÅÄÛÉÈ ÓÏÂÙÔÉÑÈ: ÚÁÐÒÏÛÅÎÎÙÈ ÉÌÉ ÓÏÂÙÔÉÊ ÔÉÐÁ POLLERR, POLLHUP ÉÌÉ POLLNVAL. (üÔÉ ÔÒÉ ÂÉÔÏ×ÙÈ ÆÌÁÇÁ ÎÅ ÉÍÅÀÔ ÓÍÙÓÌÁ ÐÒÉ ÉÓÐÏÌØÚÏ×ÁÎÉÉ × ÐÏÌÅ events É ÂÕÄÕÔ ÕÓÔÁÎÏ×ÌÅÎÙ × ÐÏÌÅ revents, ÅÓÌÉ ÓÏÏÔ×ÅÔÓÔ×ÕÀÝÅÅ ÕÓÌÏ×ÉÅ ÉÓÔÉÎÎÏ.) åÓÌÉ ÎÉ ÏÄÎÏ ÉÚ ÚÁÐÒÏÛÅÎÎÙÈ ÓÏÂÙÔÉÊ (ÉÌÉ ÏÛÉÂÏË) ÎÅ ÓÌÕÞÉÌÏÓØ, ÔÏ ÑÄÒÏ ÖÄÅÔ ÉÈ ÐÏÑ×ÌÅÎÉÑ ÄÏ ÔÁÊÍ-ÁÕÔÁ. ÷ÏÔ ×ÏÚÍÏÖÎÙÅ ÂÉÔÙ, ÏÐÉÓÁÎÎÙÅ × <sys/poll.h>:

    #define POLLIN      0x0001    /* íÏÖÎÏ ÞÉÔÁÔØ ÄÁÎÎÙÅ */

    #define POLLPRI     0x0002    /* åÓÔØ ÓÒÏÞÎÙÅ ÄÁÎÎÙÅ */

    #define POLLOUT     0x0004    /* úÁÐÉÓØ ÎÅ ÂÕÄÅÔ ÂÌÏËÉÒÏ×ÁÎÁ */

    #define POLLERR     0x0008    /* ðÒÏÉÚÏÛÌÁ ÏÛÉÂËÁ */

    #define POLLHUP     0x0010    /* "ðÏÌÏÖÉÌÉ ÔÒÕÂËÕ" */

    #define POLLNVAL    0x0020    /* îÅ×ÅÒÎÙÊ ÚÁÐÒÏÓ: fd ÎÅ ÏÔËÒÙÔ */

÷ <asm/poll.h> ÔÁËÖÅ ÏÐÒÅÄÅÌÅÎÙ ÚÎÁÞÅÎÉÑ POLLRDNORM, POLLRDBAND, POLLWRNORM, POLLWRBAND É POLLMSG.

÷ïú÷òáýáåíïå úîáþåîéå

ðÒÉ ÕÓÐÅÛÎÏÍ ÚÁ×ÅÒÛÅÎÉÉ ×ÏÚ×ÒÁÝÁÅÔÓÑ ÐÏÌÏÖÉÔÅÌØÎÏÅ ÚÎÁÞÅÎÉÅ, ÒÁ×ÎÏÅ ËÏÌÉÞÅÓÔ×Õ ÓÔÒÕËÔÕÒ Ó ÎÅÎÕÌÅ×ÙÍÉ ÐÏÌÑÍÉ revents (ÄÒÕÇÉÍÉ ÓÌÏ×ÁÍÉ, ÄÅÓËÒÉÐÔÏÒÙ Ó ÏÂÎÁÒÕÖÅÎÎÙÍÉ ÓÏÂÙÔÉÑÍÉ ÉÌÉ ÏÛÉÂËÁÍÉ). îÕÌØ ÏÚÎÁÞÁÅÔ, ÞÔÏ ÓÉÓÔÅÍÎÙÊ ×ÙÚÏ× ×ÙÛÅÌ ÐÏ ÔÁÊÍ-ÁÕÔÕ, É ÎÉ ÏÄÉÎ ÉÚ ÆÁÊÌÏ×ÙÈ ÄÅÓËÒÉÐÔÏÒÏ× ÎÅ ÂÙÌ ×ÙÂÒÁÎ. ðÒÉ ÏÛÉÂËÅ ×ÏÚ×ÒÁÝÁÅÔÓÑ -1, Á errno ÕÓÔÁÎÁ×ÌÉ×ÁÅÔÓÑ × ÓÏÏÔ×ÅÔÓÔ×ÕÀÝÅÅ ÚÎÁÞÅÎÉÅ.

ïûéâëé

ENOMEM
îÅ È×ÁÔÉÌÏ ÐÁÍÑÔÉ ÄÌÑ ÓÏÚÄÁÎÉÑ ÔÁÂÌÉÃÙ ÆÁÊÌÏ×ÙÈ ÄÅÓËÒÉÐÔÏÒÏ×.
EFAULT
íÁÓÓÉ×, ÐÅÒÅÄÁÎÎÙÊ × ËÁÞÅÓÔ×Å ÁÒÇÕÍÅÎÔÁ, ÎÅ ÎÁÈÏÄÉÔÓÑ × ÁÄÒÅÓÎÏÍ ÐÒÏÓÔÒÁÎÓÔ×Å ×ÙÚÙ×ÁÀÝÅÊ ÐÒÏÇÒÁÍÍÙ.
EINTR
äÏ ÐÏÑ×ÌÅÎÉÑ ÚÁÐÒÏÛÅÎÎÏÇÏ ÓÏÂÙÔÉÑ ÐÒÏÉÚÏÛÅÌ ÓÉÇÎÁÌ.

óïïô÷åôóô÷éå óôáîäáòôáí

XPG4-UNIX.

äïóôõðîïóôø

óÉÓÔÅÍÎÙÊ ×ÙÚÏ× poll() ÐÏÑ×ÉÌÓÑ × Linux 2.1.23. âÉÂÌÉÏÔÅÞÎÙÊ ×ÙÚÏ× poll() ÐÏÑ×ÉÌÓÑ × libc 5.4.28 (ÉÓÐÏÌØÚÕÅÔ ÜÍÕÌÑÃÉÀ Ó ÐÏÍÏÝØÀ select(2), ÅÓÌÉ × ×ÁÛÅÍ ÑÄÒÅ ÎÅÔ ÓÉÓÔÅÍÎÏÇÏ ×ÙÚÏ×Á poll(2).

óíïôòé ôáëöå

select(2)

ðåòå÷ïä

Copyright (C) Alexey Mahotkin <alexm@hsys.msk.ru> 2000