summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorDavide Libenzi <davidel@xmailserver.org>2002-11-02 19:40:57 -0800
committerLinus Torvalds <torvalds@penguin.transmeta.com>2002-11-02 19:40:57 -0800
commit3a35d84ab5e98eb27a3be47eaee3392ea4fd7c10 (patch)
tree7199e469903cc8f5ed8992b4d76e3aee530ef834 /include
parentb1b782f7b7fced03a6dc51d3e52595fcfc9ac106 (diff)
[PATCH] epoll update r3
- EP_CTL_MOD drops an event if conditions events are met - The source file eventpoll.c moved from drivers/char to fs - Fixed a weirdness with tty's Missing: system calls for arch != i386 ...
Diffstat (limited to 'include')
-rw-r--r--include/linux/eventpoll.h34
-rw-r--r--include/linux/fcblist.h71
-rw-r--r--include/linux/fs.h4
-rw-r--r--include/linux/pipe_fs_i.h4
-rw-r--r--include/linux/poll.h18
-rw-r--r--include/net/sock.h12
6 files changed, 31 insertions, 112 deletions
diff --git a/include/linux/eventpoll.h b/include/linux/eventpoll.h
index c028d5b7576b..4a26e6520823 100644
--- a/include/linux/eventpoll.h
+++ b/include/linux/eventpoll.h
@@ -1,6 +1,6 @@
/*
* include/linux/eventpoll.h ( Efficent event polling implementation )
- * Copyright (C) 2001,...,2002 Davide Libenzi
+ * Copyright (C) 2001,...,2002 Davide Libenzi
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -14,37 +14,25 @@
#ifndef _LINUX_EVENTPOLL_H
#define _LINUX_EVENTPOLL_H
+/* Forward declarations to avoid compiler errors */
+struct file;
+struct pollfd;
-#define EVENTPOLL_MINOR 124
-#define POLLFD_X_PAGE (PAGE_SIZE / sizeof(struct pollfd))
-#define MAX_FDS_IN_EVENTPOLL (1024 * 128)
-#define MAX_EVENTPOLL_PAGES (MAX_FDS_IN_EVENTPOLL / POLLFD_X_PAGE)
-#define EVENT_PAGE_INDEX(n) ((n) / POLLFD_X_PAGE)
-#define EVENT_PAGE_REM(n) ((n) % POLLFD_X_PAGE)
-#define EVENT_PAGE_OFFSET(n) (((n) % POLLFD_X_PAGE) * sizeof(struct pollfd))
-#define EP_FDS_PAGES(n) (((n) + POLLFD_X_PAGE - 1) / POLLFD_X_PAGE)
-#define EP_MAP_SIZE(n) (EP_FDS_PAGES(n) * PAGE_SIZE * 2)
-
-
-struct evpoll {
- int ep_timeout;
- unsigned long ep_resoff;
-};
-
-#define EP_ALLOC _IOR('P', 1, int)
-#define EP_POLL _IOWR('P', 2, struct evpoll)
-#define EP_FREE _IO('P', 3)
-#define EP_ISPOLLED _IOWR('P', 4, struct pollfd)
+/* Valid opcodes to issue to sys_epoll_ctl() */
#define EP_CTL_ADD 1
#define EP_CTL_DEL 2
#define EP_CTL_MOD 3
-asmlinkage int sys_epoll_create(int maxfds);
+/* Kernel space functions implementing the user space "epoll" API */
+asmlinkage int sys_epoll_create(int size);
asmlinkage int sys_epoll_ctl(int epfd, int op, int fd, unsigned int events);
-asmlinkage int sys_epoll_wait(int epfd, struct pollfd const **events, int timeout);
+asmlinkage int sys_epoll_wait(int epfd, struct pollfd *events, int maxevents,
+ int timeout);
+/* Used in fs/file_table.c:__fput() to unlink files from the eventpoll interface */
+void ep_notify_file_close(struct file *file);
#endif
diff --git a/include/linux/fcblist.h b/include/linux/fcblist.h
deleted file mode 100644
index 85be93ae40fd..000000000000
--- a/include/linux/fcblist.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * include/linux/fcblist.h ( File event callbacks handling )
- * Copyright (C) 2001,...,2002 Davide Libenzi
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * Davide Libenzi <davidel@xmailserver.org>
- *
- */
-
-#ifndef __LINUX_FCBLIST_H
-#define __LINUX_FCBLIST_H
-
-#include <linux/config.h>
-#include <linux/list.h>
-#include <linux/spinlock.h>
-#include <linux/fs.h>
-#include <linux/file.h>
-
-
-
-/* file callback notification events */
-#define ION_IN 1
-#define ION_OUT 2
-#define ION_HUP 3
-#define ION_ERR 4
-
-#define FCB_LOCAL_SIZE 4
-
-
-struct fcb_struct {
- struct list_head llink;
- void (*cbproc)(struct file *, void *, unsigned long *, long *);
- void *data;
- unsigned long local[FCB_LOCAL_SIZE];
-};
-
-
-extern long ion_band_table[];
-extern long poll_band_table[];
-
-
-void file_notify_event(struct file *filep, long *event);
-
-int file_notify_addcb(struct file *filep,
- void (*cbproc)(struct file *, void *, unsigned long *, long *),
- void *data);
-
-int file_notify_delcb(struct file *filep,
- void (*cbproc)(struct file *, void *, unsigned long *, long *));
-
-void file_notify_cleanup(struct file *filep);
-
-
-static inline void file_notify_init(struct file *filep)
-{
- rwlock_init(&filep->f_cblock);
- INIT_LIST_HEAD(&filep->f_cblist);
-}
-
-static inline void file_send_notify(struct file *filep, long ioevt, long plevt)
-{
- long event[] = { ioevt, plevt, -1 };
-
- file_notify_event(filep, event);
-}
-
-#endif
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 9a3e78ba7592..91845f06c28f 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -504,10 +504,6 @@ struct file {
/* needed for tty driver, and maybe others */
void *private_data;
-
- /* file callback list */
- rwlock_t f_cblock;
- struct list_head f_cblist;
};
extern spinlock_t files_lock;
#define file_list_lock() spin_lock(&files_lock);
diff --git a/include/linux/pipe_fs_i.h b/include/linux/pipe_fs_i.h
index bdf0a3686916..407c0e0b3e84 100644
--- a/include/linux/pipe_fs_i.h
+++ b/include/linux/pipe_fs_i.h
@@ -12,8 +12,6 @@ struct pipe_inode_info {
unsigned int waiting_writers;
unsigned int r_counter;
unsigned int w_counter;
- struct file *rdfile;
- struct file *wrfile;
struct fasync_struct *fasync_readers;
struct fasync_struct *fasync_writers;
};
@@ -32,8 +30,6 @@ struct pipe_inode_info {
#define PIPE_WAITING_WRITERS(inode) ((inode).i_pipe->waiting_writers)
#define PIPE_RCOUNTER(inode) ((inode).i_pipe->r_counter)
#define PIPE_WCOUNTER(inode) ((inode).i_pipe->w_counter)
-#define PIPE_READFILE(inode) ((inode).i_pipe->rdfile)
-#define PIPE_WRITEFILE(inode) ((inode).i_pipe->wrfile)
#define PIPE_FASYNC_READERS(inode) (&((inode).i_pipe->fasync_readers))
#define PIPE_FASYNC_WRITERS(inode) (&((inode).i_pipe->fasync_writers))
diff --git a/include/linux/poll.h b/include/linux/poll.h
index 796aac51388a..318ff6ab5a53 100644
--- a/include/linux/poll.h
+++ b/include/linux/poll.h
@@ -13,6 +13,9 @@
struct poll_table_page;
typedef struct poll_table_struct {
+ int queue;
+ void *priv;
+ void (*qproc)(void *, wait_queue_head_t *);
int error;
struct poll_table_page * table;
} poll_table;
@@ -27,9 +30,24 @@ static inline void poll_wait(struct file * filp, wait_queue_head_t * wait_addres
static inline void poll_initwait(poll_table* pt)
{
+ pt->queue = 1;
+ pt->qproc = NULL;
+ pt->priv = NULL;
pt->error = 0;
pt->table = NULL;
}
+
+static inline void poll_initwait_ex(poll_table* pt, int queue,
+ void (*qproc)(void *, wait_queue_head_t *),
+ void *priv)
+{
+ pt->queue = queue;
+ pt->qproc = qproc;
+ pt->priv = priv;
+ pt->error = 0;
+ pt->table = NULL;
+}
+
extern void poll_freewait(poll_table* pt);
diff --git a/include/net/sock.h b/include/net/sock.h
index 4a4094b93d07..d2790e2ca00a 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -52,9 +52,6 @@
#include <asm/atomic.h>
#include <net/dst.h>
#include <net/scm.h>
-#include <linux/fs.h>
-#include <linux/file.h>
-#include <linux/fcblist.h>
/*
* This structure really needs to be cleaned up.
@@ -769,13 +766,8 @@ static inline unsigned long sock_wspace(struct sock *sk)
static inline void sk_wake_async(struct sock *sk, int how, int band)
{
- if (sk->socket) {
- if (sk->socket->file)
- file_send_notify(sk->socket->file, ion_band_table[band - POLL_IN],
- poll_band_table[band - POLL_IN]);
- if (sk->socket->fasync_list)
- sock_wake_async(sk->socket, how, band);
- }
+ if (sk->socket && sk->socket->fasync_list)
+ sock_wake_async(sk->socket, how, band);
}
#define SOCK_MIN_SNDBUF 2048