| 1 |
/* unlimited_select.h |
| 2 |
* Tweak the macros for accessing fd_set so that the select() syscall |
| 3 |
* won't be limited to a particular number of file descriptors. |
| 4 |
* |
| 5 |
* Copyright 2009-2012 Adiscon GmbH. |
| 6 |
* |
| 7 |
* This file is part of rsyslog. |
| 8 |
* |
| 9 |
* Licensed under the Apache License, Version 2.0 (the "License"); |
| 10 |
* you may not use this file except in compliance with the License. |
| 11 |
* You may obtain a copy of the License at |
| 12 |
* |
| 13 |
* http://www.apache.org/licenses/LICENSE-2.0 |
| 14 |
* -or- |
| 15 |
* see COPYING.ASL20 in the source distribution |
| 16 |
* |
| 17 |
* Unless required by applicable law or agreed to in writing, software |
| 18 |
* distributed under the License is distributed on an "AS IS" BASIS, |
| 19 |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 20 |
* See the License for the specific language governing permissions and |
| 21 |
* limitations under the License. |
| 22 |
*/ |
| 23 |
|
| 24 |
#ifndef UNLIMITED_SELECT_H_INCLUDED |
| 25 |
#define UNLIMITED_SELECT_H_INCLUDED |
| 26 |
|
| 27 |
#include <string.h> |
| 28 |
#include <stdlib.h> |
| 29 |
#include <sys/select.h> |
| 30 |
#include "glbl.h" |
| 31 |
|
| 32 |
#ifdef USE_UNLIMITED_SELECT |
| 33 |
#undef FD_ZERO |
| 34 |
#define FD_ZERO(set) memset((set), 0, glbl.GetFdSetSize()); |
| 35 |
#endif |
| 36 |
|
| 37 |
#ifdef USE_UNLIMITED_SELECT |
| 38 |
static inline void freeFdSet(fd_set *p) { |
| 39 |
free(p); |
| 40 |
} |
| 41 |
#else |
| 42 |
#define freeFdSet(x) |
| 43 |
#endif |
| 44 |
|
| 45 |
#endif /* #ifndef UNLIMITED_SELECT_H_INCLUDED */ |