mirror of
https://github.com/NLnetLabs/unbound.git
synced 2025-12-20 23:00:56 -05:00
manpage , fd-setsize for minievent.
git-svn-id: file:///svn/unbound/trunk@134 be551aaa-1e26-0410-a405-d3ace91eadb9
This commit is contained in:
parent
2534d6b120
commit
a36b64a9e7
4 changed files with 37 additions and 8 deletions
|
|
@ -1,3 +1,7 @@
|
||||||
|
21 February 2007: Wouter
|
||||||
|
- put -c option in man page.
|
||||||
|
- minievent fd array capped by FD_SETSIZE.
|
||||||
|
|
||||||
20 February 2007: Wouter
|
20 February 2007: Wouter
|
||||||
- Added locks code and pthread spinlock detection.
|
- Added locks code and pthread spinlock detection.
|
||||||
- can use no locks, or solaris native thread library.
|
- can use no locks, or solaris native thread library.
|
||||||
|
|
|
||||||
|
|
@ -41,6 +41,7 @@ unbound
|
||||||
.Sh SYNOPSIS
|
.Sh SYNOPSIS
|
||||||
.Nm unbound
|
.Nm unbound
|
||||||
.Op Fl h
|
.Op Fl h
|
||||||
|
.Op Fl c Ar cfgfile
|
||||||
.Op Fl p Ar port
|
.Op Fl p Ar port
|
||||||
.Op Fl f Ar ip
|
.Op Fl f Ar ip
|
||||||
.Op Fl z Ar port
|
.Op Fl z Ar port
|
||||||
|
|
@ -57,6 +58,11 @@ The available options are:
|
||||||
.It Fl h
|
.It Fl h
|
||||||
Show the version and commandline option help.
|
Show the version and commandline option help.
|
||||||
|
|
||||||
|
.It Fl c Ar cfgfile
|
||||||
|
Set the config file to read with settings for unbound. The syntax is
|
||||||
|
described in
|
||||||
|
.Xr unbound.conf 5 .
|
||||||
|
|
||||||
.It Fl p Ar port
|
.It Fl p Ar port
|
||||||
Start listening on the given port. Default is port 53(DNS).
|
Start listening on the given port. Default is port 53(DNS).
|
||||||
|
|
||||||
|
|
@ -71,7 +77,8 @@ Increase verbosity. If given multiple times, more information is logged.
|
||||||
|
|
||||||
.El
|
.El
|
||||||
.Sh SEE ALSO
|
.Sh SEE ALSO
|
||||||
.Xr resolv.conf 5
|
.Xr resolv.conf 5 ,
|
||||||
|
.Xr unbound.conf 5 .
|
||||||
|
|
||||||
.Sh AUTHORS
|
.Sh AUTHORS
|
||||||
.Ic Unbound
|
.Ic Unbound
|
||||||
|
|
|
||||||
|
|
@ -79,7 +79,12 @@ void *event_init(void)
|
||||||
event_base_free(base);
|
event_base_free(base);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
base->fds = (struct event**)calloc(MAX_FDS, sizeof(struct event*));
|
base->capfd = MAX_FDS;
|
||||||
|
#ifdef FD_SETSIZE
|
||||||
|
if((int)FD_SETSIZE < base->capfd)
|
||||||
|
base->capfd = (int)FD_SETSIZE;
|
||||||
|
#endif
|
||||||
|
base->fds = (struct event**)calloc(base->capfd, sizeof(struct event*));
|
||||||
if(!base->fds) {
|
if(!base->fds) {
|
||||||
event_base_free(base);
|
event_base_free(base);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
@ -239,7 +244,7 @@ int event_add(struct event* ev, struct timeval* tv)
|
||||||
{
|
{
|
||||||
if(ev->added)
|
if(ev->added)
|
||||||
event_del(ev);
|
event_del(ev);
|
||||||
if(ev->ev_fd != -1 && ev->ev_fd >= MAX_FDS)
|
if(ev->ev_fd != -1 && ev->ev_fd >= ev->ev_base->capfd)
|
||||||
return -1;
|
return -1;
|
||||||
if( (ev->ev_events&(EV_READ|EV_WRITE)) && ev->ev_fd != -1) {
|
if( (ev->ev_events&(EV_READ|EV_WRITE)) && ev->ev_fd != -1) {
|
||||||
ev->ev_base->fds[ev->ev_fd] = ev;
|
ev->ev_base->fds[ev->ev_fd] = ev;
|
||||||
|
|
@ -264,7 +269,7 @@ int event_add(struct event* ev, struct timeval* tv)
|
||||||
/** remove event, you may change it again */
|
/** remove event, you may change it again */
|
||||||
int event_del(struct event* ev)
|
int event_del(struct event* ev)
|
||||||
{
|
{
|
||||||
if(ev->ev_fd != -1 && ev->ev_fd >= MAX_FDS)
|
if(ev->ev_fd != -1 && ev->ev_fd >= ev->ev_base->capfd)
|
||||||
return -1;
|
return -1;
|
||||||
if(ev->ev_events&EV_TIMEOUT)
|
if(ev->ev_events&EV_TIMEOUT)
|
||||||
(void)rbtree_delete(ev->ev_base->times, &ev->node);
|
(void)rbtree_delete(ev->ev_base->times, &ev->node);
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,16 @@
|
||||||
* \file
|
* \file
|
||||||
* This file implements part of the event(3) libevent api.
|
* This file implements part of the event(3) libevent api.
|
||||||
* The back end is only select. Max number of fds is limited.
|
* The back end is only select. Max number of fds is limited.
|
||||||
|
* Max number of signals is limited, one handler per signal only.
|
||||||
|
* And one handler per fd.
|
||||||
|
*
|
||||||
|
* Although limited to select() and a max (1024) open fds, it
|
||||||
|
* is efficient:
|
||||||
|
* o dispatch call caches fd_sets to use.
|
||||||
|
* o handler calling takes time ~ to the number of fds.
|
||||||
|
* o timeouts are stored in a redblack tree, sorted, so take log(n).
|
||||||
|
* Timeouts are only accurate to the second (no subsecond accuracy).
|
||||||
|
* To avoid cpu hogging, fractional timeouts are rounded up to a whole second.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef MINI_EVENT_H
|
#ifndef MINI_EVENT_H
|
||||||
|
|
@ -76,6 +86,8 @@ struct event_base
|
||||||
struct event** fds;
|
struct event** fds;
|
||||||
/** max fd in use */
|
/** max fd in use */
|
||||||
int maxfd;
|
int maxfd;
|
||||||
|
/** capacity - size of the fds array */
|
||||||
|
int capfd;
|
||||||
/** fdset for read write */
|
/** fdset for read write */
|
||||||
fd_set reads, writes;
|
fd_set reads, writes;
|
||||||
/** array of 0 - maxsig of ptr to event for it */
|
/** array of 0 - maxsig of ptr to event for it */
|
||||||
|
|
@ -95,9 +107,9 @@ struct event {
|
||||||
|
|
||||||
/** event base it belongs to */
|
/** event base it belongs to */
|
||||||
struct event_base *ev_base;
|
struct event_base *ev_base;
|
||||||
/** fd to poll or -1 for timeouts */
|
/** fd to poll or -1 for timeouts. signal number for sigs. */
|
||||||
int ev_fd;
|
int ev_fd;
|
||||||
/** events this event is interested in */
|
/** what events this event is interested in, see EV_.. above. */
|
||||||
short ev_events;
|
short ev_events;
|
||||||
/** timeout value */
|
/** timeout value */
|
||||||
struct timeval ev_timeout;
|
struct timeval ev_timeout;
|
||||||
|
|
@ -123,7 +135,7 @@ int event_base_loopexit(struct event_base *, struct timeval *);
|
||||||
void event_base_free(struct event_base *);
|
void event_base_free(struct event_base *);
|
||||||
/** set content of event */
|
/** set content of event */
|
||||||
void event_set(struct event *, int, short, void (*)(int, short, void *), void *);
|
void event_set(struct event *, int, short, void (*)(int, short, void *), void *);
|
||||||
/** add event to a base */
|
/** add event to a base. You *must* call this for every event. */
|
||||||
int event_base_set(struct event_base *, struct event *);
|
int event_base_set(struct event_base *, struct event *);
|
||||||
/** add event to make it active. You may not change it with event_set anymore */
|
/** add event to make it active. You may not change it with event_set anymore */
|
||||||
int event_add(struct event *, struct timeval *);
|
int event_add(struct event *, struct timeval *);
|
||||||
|
|
@ -133,7 +145,8 @@ int event_del(struct event *);
|
||||||
#define evtimer_add(ev, tv) event_add(ev, tv)
|
#define evtimer_add(ev, tv) event_add(ev, tv)
|
||||||
#define evtimer_del(ev) event_del(ev)
|
#define evtimer_del(ev) event_del(ev)
|
||||||
|
|
||||||
/* uses different implementation. Cannot mix fd/timeouts and signals. */
|
/* uses different implementation. Cannot mix fd/timeouts and signals inside
|
||||||
|
* the same struct event. create several event structs for that. */
|
||||||
/** install signal handler */
|
/** install signal handler */
|
||||||
int signal_add(struct event *, struct timeval *);
|
int signal_add(struct event *, struct timeval *);
|
||||||
/** set signal event contents */
|
/** set signal event contents */
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue