~ubuntu-branches/ubuntu/trusty/haproxy/trusty-backports

« back to all changes in this revision

Viewing changes to include/common/epoll.h

  • Committer: Package Import Robot
  • Author(s): Felix Geyer
  • Date: 2014-07-25 23:03:34 UTC
  • mfrom: (17.1.5 sid)
  • Revision ID: package-import@ubuntu.com-20140725230334-5245g0dxvqalb0oo
Tags: 1.5.3-1~ubuntu14.04.1
No-change backport to trusty (LP: #1336628)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
  include/common/epoll.h
3
 
  epoll definitions for older libc.
4
 
 
5
 
  Copyright (C) 2000-2006 Willy Tarreau - w@1wt.eu
6
 
  
7
 
  This library is free software; you can redistribute it and/or
8
 
  modify it under the terms of the GNU Lesser General Public
9
 
  License as published by the Free Software Foundation, version 2.1
10
 
  exclusively.
11
 
 
12
 
  This library is distributed in the hope that it will be useful,
13
 
  but WITHOUT ANY WARRANTY; without even the implied warranty of
14
 
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15
 
  Lesser General Public License for more details.
16
 
 
17
 
  You should have received a copy of the GNU Lesser General Public
18
 
  License along with this library; if not, write to the Free Software
19
 
  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
20
 
*/
 
2
 * include/common/epoll.h
 
3
 * epoll definitions for older libc.
 
4
 *
 
5
 * Copyright (C) 2000-2012 Willy Tarreau - w@1wt.eu
 
6
 *
 
7
 * This library is free software; you can redistribute it and/or
 
8
 * modify it under the terms of the GNU Lesser General Public
 
9
 * License as published by the Free Software Foundation, version 2.1
 
10
 * exclusively.
 
11
 *
 
12
 * This library is distributed in the hope that it will be useful,
 
13
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
14
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
15
 * Lesser General Public License for more details.
 
16
 *
 
17
 * You should have received a copy of the GNU Lesser General Public
 
18
 * License along with this library; if not, write to the Free Software
 
19
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 
20
 */
21
21
 
22
22
/*
23
23
 * Those constants were found both in glibc and in the Linux kernel.
29
29
#ifndef _COMMON_EPOLL_H
30
30
#define _COMMON_EPOLL_H
31
31
 
 
32
#if defined (__linux__) && defined(ENABLE_EPOLL)
 
33
 
 
34
#ifndef USE_MY_EPOLL
 
35
#include <sys/epoll.h>
 
36
#else
 
37
 
 
38
#include <errno.h>
32
39
#include <sys/types.h>
33
40
#include <linux/unistd.h>
34
 
 
 
41
#include <sys/syscall.h>
35
42
#include <common/config.h>
 
43
#include <common/syscall.h>
36
44
 
37
45
/* epoll_ctl() commands */
38
46
#ifndef EPOLL_CTL_ADD
62
70
        } data;
63
71
};
64
72
 
65
 
 
66
 
#if defined(__powerpc__) || defined(__powerpc64__)
67
 
#define __NR_epoll_create 236
68
 
#define __NR_epoll_ctl    237
69
 
#define __NR_epoll_wait   238
70
 
#elif defined(__sparc__) || defined(__sparc64__)
71
 
#define __NR_epoll_create 193
72
 
#define __NR_epoll_ctl    194
73
 
#define __NR_epoll_wait   195
74
 
#elif defined(__x86_64__)
75
 
#define __NR_epoll_create 213
76
 
#define __NR_epoll_ctl    214
77
 
#define __NR_epoll_wait   215
78
 
#elif defined(__alpha__)
79
 
#define __NR_epoll_create 407
80
 
#define __NR_epoll_ctl    408
81
 
#define __NR_epoll_wait   409
82
 
#elif defined (__i386__)
83
 
#define __NR_epoll_create 254
84
 
#define __NR_epoll_ctl    255
85
 
#define __NR_epoll_wait   256
 
73
#if defined(CONFIG_HAP_LINUX_VSYSCALL) && defined(__linux__) && defined(__i386__)
 
74
/* Those are our self-defined functions */
 
75
extern int epoll_create(int size);
 
76
extern int epoll_ctl(int epfd, int op, int fd, struct epoll_event * event);
 
77
extern int epoll_wait(int epfd, struct epoll_event * events, int maxevents, int timeout);
86
78
#else
 
79
 
 
80
/* We'll define a syscall, so for this we need __NR_splice. It should have
 
81
 * been provided by syscall.h.
 
82
 */
 
83
#if !defined(__NR_epoll_ctl)
87
84
#warning unsupported architecture, guessing __NR_epoll_create=254 like x86...
88
85
#define __NR_epoll_create 254
89
86
#define __NR_epoll_ctl    255
90
87
#define __NR_epoll_wait   256
91
 
#endif
92
 
 
93
 
/* Those are our self-defined functions */
94
 
static int epoll_create(int size);
95
 
static int epoll_ctl(int epfd, int op, int fd, struct epoll_event * event);
96
 
static int epoll_wait(int epfd, struct epoll_event * events, int maxevents, int timeout);
 
88
#endif /* __NR_epoll_ctl */
 
89
 
 
90
static inline _syscall1 (int, epoll_create, int, size);
 
91
static inline _syscall4 (int, epoll_ctl, int, epfd, int, op, int, fd, struct epoll_event *, event);
 
92
static inline _syscall4 (int, epoll_wait, int, epfd, struct epoll_event *, events, int, maxevents, int, timeout);
 
93
#endif /* VSYSCALL */
 
94
 
 
95
#endif /* USE_MY_EPOLL */
 
96
 
 
97
#endif /* __linux__ && ENABLE_EPOLL */
97
98
 
98
99
#endif /* _COMMON_EPOLL_H */
99
100
 
100
 
 
101
101
/*
102
102
 * Local variables:
103
103
 *  c-indent-level: 8