fs/vfs/fs_poll.c: Add poll use in kernel space.

This commit is contained in:
dongjianli
2018-08-26 13:44:07 -06:00
committed by Gregory Nutt
parent 3f50451046
commit 56883eef3b
2 changed files with 115 additions and 37 deletions
+20 -6
View File
@@ -1,7 +1,7 @@
/****************************************************************************
* include/poll.h
*
* Copyright (C) 2008-2009 Gregory Nutt. All rights reserved.
* Copyright (C) 2008-2009, 2018 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@@ -88,6 +88,11 @@
#define POLLHUP (0x08)
#define POLLNVAL (0x10)
#define POLLFD (0x00)
#define POLLFILE (0x40)
#define POLLSOCK (0x80)
#define POLLMASK (0xC0)
/****************************************************************************
* Public Type Definitions
****************************************************************************/
@@ -107,11 +112,20 @@ typedef uint8_t pollevent_t;
struct pollfd
{
int fd; /* The descriptor being polled */
sem_t *sem; /* Pointer to semaphore used to post output event */
pollevent_t events; /* The input event flags */
pollevent_t revents; /* The output event flags */
FAR void *priv; /* For use by drivers */
/* REVISIT: Un-named unions are forbidden by the coding standard because
* they are not available in C89.
*/
union
{
int fd; /* The descriptor being polled */
FAR void *ptr; /* The psock or file being polled */
};
FAR sem_t *sem; /* Pointer to semaphore used to post output event */
pollevent_t events; /* The input event flags */
pollevent_t revents; /* The output event flags */
FAR void *priv; /* For use by drivers */
};
/****************************************************************************