mirror of
https://github.com/darlinghq/darling-libkqueue.git
synced 2024-11-23 11:49:50 +00:00
Fix compilation issues on Solaris 10 with GCC 4.5
git-svn-id: svn://svn.code.sf.net/p/libkqueue/code/trunk@518 fb4e3144-bc1c-4b72-a658-5bcd248dd7f7
This commit is contained in:
parent
5d11e7e930
commit
68e94a12eb
4
Makefile
4
Makefile
@ -31,12 +31,12 @@ $(PROGRAM).a:
|
||||
rm -f *.o
|
||||
$(CC) -c -I./include -I./src/common -DNDEBUG -DMAKE_STATIC=1 -static $(CFLAGS) $(SOURCES) $(LDADD)
|
||||
$(AR) rcs $(PROGRAM).a *.o
|
||||
strip --strip-unneeded $(PROGRAM).a
|
||||
$(STRIP) $(PROGRAM).a
|
||||
rm *.o
|
||||
|
||||
$(PROGRAM).so.$(ABI_VERSION): $(OBJS)
|
||||
$(CC) -o $@ -I./include -I./src/common -shared $(LDFLAGS) -DNDEBUG $(CFLAGS) $(SOURCES) $(LDADD)
|
||||
strip --strip-unneeded $(PROGRAM).so.$(ABI_VERSION)
|
||||
$(STRIP) $(PROGRAM).so.$(ABI_VERSION)
|
||||
$(LN) -sf $(PROGRAM).so.$(ABI_VERSION) $(PROGRAM).so.$(ABI_MAJOR)
|
||||
$(LN) -sf $(PROGRAM).so.$(ABI_VERSION) $(PROGRAM).so
|
||||
|
||||
|
13
configure
vendored
13
configure
vendored
@ -24,7 +24,7 @@ make_exports="program version target api distfile \
|
||||
cflags ldflags ldadd libdepends \
|
||||
sources objs deps mans headers extra_dist subdirs \
|
||||
abi_major abi_minor abi_version \
|
||||
cc cpp ld ln ar install diff"
|
||||
cc cpp ld ln ar install diff strip"
|
||||
|
||||
required_headers=
|
||||
optional_headers=
|
||||
@ -252,6 +252,16 @@ check_diff() {
|
||||
echo "found"
|
||||
}
|
||||
|
||||
check_strip() {
|
||||
printf "checking for a suitable strip(1) command.. "
|
||||
if [ "`uname -s`" = "SunOS" ] ; then
|
||||
finalize strip "/usr/sfw/bin/gstrip --strip-unneeded"
|
||||
else
|
||||
finalize strip "/usr/bin/strip --strip-unneeded"
|
||||
fi
|
||||
echo "found"
|
||||
}
|
||||
|
||||
subst_vars() {
|
||||
outfile=$1
|
||||
|
||||
@ -312,6 +322,7 @@ check_linker
|
||||
check_archiver
|
||||
check_install
|
||||
check_diff
|
||||
check_strip
|
||||
|
||||
finalize program "$program"
|
||||
finalize version "$version"
|
||||
|
@ -32,7 +32,7 @@ extern char *KQUEUE_DEBUG_IDENT;
|
||||
# include <sys/syscall.h>
|
||||
# define THREAD_ID ((pid_t) syscall(__NR_gettid))
|
||||
#elif defined(__sun)
|
||||
# define THREAD_ID (pthread_self())
|
||||
# define THREAD_ID ((int) pthread_self())
|
||||
#elif defined(_WIN32)
|
||||
# define THREAD_ID (int)(GetCurrentThreadId())
|
||||
#else
|
||||
|
@ -19,43 +19,19 @@
|
||||
const struct filter evfilt_vnode = EVFILT_NOTIMPL;
|
||||
const struct filter evfilt_proc = EVFILT_NOTIMPL;
|
||||
|
||||
static char * port_event_dump(port_event_t *evt);
|
||||
|
||||
/*
|
||||
* Per-thread port event buffer used to ferry data between
|
||||
* kevent_wait() and kevent_copyout().
|
||||
*/
|
||||
static port_event_t __thread evbuf[MAX_KEVENT];
|
||||
static __thread port_event_t evbuf[MAX_KEVENT];
|
||||
|
||||
int
|
||||
solaris_kqueue_init(struct kqueue *kq)
|
||||
{
|
||||
if ((kq->kq_id = port_create()) < 0) {
|
||||
dbg_perror("port_create(2)");
|
||||
return (-1);
|
||||
}
|
||||
dbg_printf("created event port; fd=%d", kq->kq_id);
|
||||
|
||||
if (filter_register_all(kq) < 0) {
|
||||
close(kq->kq_id);
|
||||
return (-1);
|
||||
}
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
void
|
||||
solaris_kqueue_free(struct kqueue *kq)
|
||||
{
|
||||
(void) close(kq->kq_id);
|
||||
dbg_printf("closed event port; fd=%d", kq->kq_id);
|
||||
}
|
||||
#ifndef NDEBUG
|
||||
|
||||
/* Dump a poll(2) events bitmask */
|
||||
static char *
|
||||
poll_events_dump(short events)
|
||||
{
|
||||
static char __thread buf[512];
|
||||
static __thread char buf[512];
|
||||
|
||||
#define _PL_DUMP(attrib) \
|
||||
if (events == attrib) \
|
||||
@ -81,7 +57,7 @@ poll_events_dump(short events)
|
||||
static char *
|
||||
port_event_dump(port_event_t *evt)
|
||||
{
|
||||
static char __thread buf[512];
|
||||
static __thread char buf[512];
|
||||
|
||||
if (evt == NULL) {
|
||||
snprintf(&buf[0], sizeof(buf), "NULL ?!?!\n");
|
||||
@ -110,10 +86,36 @@ out:
|
||||
return (&buf[0]);
|
||||
}
|
||||
|
||||
#endif /* !NDEBUG */
|
||||
|
||||
int
|
||||
solaris_kqueue_init(struct kqueue *kq)
|
||||
{
|
||||
if ((kq->kq_id = port_create()) < 0) {
|
||||
dbg_perror("port_create(2)");
|
||||
return (-1);
|
||||
}
|
||||
dbg_printf("created event port; fd=%d", kq->kq_id);
|
||||
|
||||
if (filter_register_all(kq) < 0) {
|
||||
close(kq->kq_id);
|
||||
return (-1);
|
||||
}
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
void
|
||||
solaris_kqueue_free(struct kqueue *kq)
|
||||
{
|
||||
(void) close(kq->kq_id);
|
||||
dbg_printf("closed event port; fd=%d", kq->kq_id);
|
||||
}
|
||||
|
||||
int
|
||||
solaris_kevent_wait(
|
||||
struct kqueue *kq,
|
||||
int nevents,
|
||||
int nevents UNUSED,
|
||||
const struct timespec *ts)
|
||||
|
||||
{
|
||||
@ -143,7 +145,7 @@ solaris_kevent_wait(
|
||||
|
||||
int
|
||||
solaris_kevent_copyout(struct kqueue *kq, int nready,
|
||||
struct kevent *eventlist, int nevents)
|
||||
struct kevent *eventlist, int nevents UNUSED)
|
||||
{
|
||||
port_event_t *evt;
|
||||
struct knote *kn;
|
||||
|
@ -108,7 +108,7 @@ evfilt_signal_knote_create(struct filter *filt, struct knote *kn)
|
||||
}
|
||||
|
||||
int
|
||||
evfilt_signal_knote_modify(struct filter *filt, struct knote *kn,
|
||||
evfilt_signal_knote_modify(struct filter *filt UNUSED, struct knote *kn,
|
||||
const struct kevent *kev)
|
||||
{
|
||||
kn->kev.flags = kev->flags | EV_CLEAR;
|
||||
@ -116,7 +116,7 @@ evfilt_signal_knote_modify(struct filter *filt, struct knote *kn,
|
||||
}
|
||||
|
||||
int
|
||||
evfilt_signal_knote_delete(struct filter *filt, struct knote *kn)
|
||||
evfilt_signal_knote_delete(struct filter *filt UNUSED, struct knote *kn)
|
||||
{
|
||||
return ignore_signal(kn->kev.ident);
|
||||
}
|
||||
@ -128,7 +128,7 @@ evfilt_signal_knote_enable(struct filter *filt, struct knote *kn)
|
||||
}
|
||||
|
||||
int
|
||||
evfilt_signal_knote_disable(struct filter *filt, struct knote *kn)
|
||||
evfilt_signal_knote_disable(struct filter *filt UNUSED, struct knote *kn)
|
||||
{
|
||||
return ignore_signal(kn->kev.ident);
|
||||
}
|
||||
|
@ -65,6 +65,9 @@ evfilt_socket_knote_modify(struct filter *filt, struct knote *kn,
|
||||
const struct kevent *kev)
|
||||
{
|
||||
dbg_puts("XXX-FIXME");
|
||||
(void)filt;
|
||||
(void)kn;
|
||||
(void)kev;
|
||||
return (-1); /* STUB */
|
||||
}
|
||||
|
||||
|
@ -34,7 +34,7 @@
|
||||
static char *
|
||||
itimerspec_dump(struct itimerspec *ts)
|
||||
{
|
||||
static char __thread buf[1024];
|
||||
static __thread char buf[1024];
|
||||
|
||||
snprintf(buf, sizeof(buf),
|
||||
"itimer: [ interval=%lu s %lu ns, next expire=%lu s %lu ns ]",
|
||||
@ -73,19 +73,19 @@ convert_msec_to_itimerspec(struct itimerspec *dst, int src, int oneshot)
|
||||
}
|
||||
|
||||
int
|
||||
evfilt_timer_init(struct filter *filt)
|
||||
evfilt_timer_init(struct filter *filt UNUSED)
|
||||
{
|
||||
return (0);
|
||||
}
|
||||
|
||||
void
|
||||
evfilt_timer_destroy(struct filter *filt)
|
||||
evfilt_timer_destroy(struct filter *filt UNUSED)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
int
|
||||
evfilt_timer_copyout(struct kevent *dst, struct knote *src, void *ptr)
|
||||
evfilt_timer_copyout(struct kevent *dst, struct knote *src, void *ptr UNUSED)
|
||||
{
|
||||
/* port_event_t *pe = (port_event_t *) ptr; */
|
||||
|
||||
@ -147,11 +147,14 @@ int
|
||||
evfilt_timer_knote_modify(struct filter *filt, struct knote *kn,
|
||||
const struct kevent *kev)
|
||||
{
|
||||
(void)filt;
|
||||
(void)kn;
|
||||
(void)kev;
|
||||
return (-1); /* STUB */
|
||||
}
|
||||
|
||||
int
|
||||
evfilt_timer_knote_delete(struct filter *filt, struct knote *kn)
|
||||
evfilt_timer_knote_delete(struct filter *filt UNUSED, struct knote *kn)
|
||||
{
|
||||
if (kn->kev.flags & EV_DISABLE)
|
||||
return (0);
|
||||
|
@ -17,7 +17,7 @@
|
||||
#include "private.h"
|
||||
|
||||
int
|
||||
evfilt_user_copyout(struct kevent *dst, struct knote *src, void *ptr)
|
||||
evfilt_user_copyout(struct kevent *dst, struct knote *src, void *ptr UNUSED)
|
||||
{
|
||||
//port_event_t *pe = (port_event_t *) ptr;
|
||||
|
||||
@ -49,7 +49,7 @@ evfilt_user_copyout(struct kevent *dst, struct knote *src, void *ptr)
|
||||
|
||||
|
||||
int
|
||||
evfilt_user_knote_create(struct filter *filt, struct knote *kn)
|
||||
evfilt_user_knote_create(struct filter *filt UNUSED, struct knote *kn UNUSED)
|
||||
{
|
||||
#if TODO
|
||||
u_int ffctrl;
|
||||
@ -104,13 +104,13 @@ evfilt_user_knote_modify(struct filter *filt, struct knote *kn,
|
||||
}
|
||||
|
||||
int
|
||||
evfilt_user_knote_delete(struct filter *filt, struct knote *kn)
|
||||
evfilt_user_knote_delete(struct filter *filt UNUSED, struct knote *kn UNUSED)
|
||||
{
|
||||
return (0);
|
||||
}
|
||||
|
||||
int
|
||||
evfilt_user_knote_enable(struct filter *filt, struct knote *kn)
|
||||
evfilt_user_knote_enable(struct filter *filt UNUSED, struct knote *kn UNUSED)
|
||||
{
|
||||
/* FIXME: what happens if NOTE_TRIGGER is in fflags?
|
||||
should the event fire? */
|
||||
@ -118,7 +118,7 @@ evfilt_user_knote_enable(struct filter *filt, struct knote *kn)
|
||||
}
|
||||
|
||||
int
|
||||
evfilt_user_knote_disable(struct filter *filt, struct knote *kn)
|
||||
evfilt_user_knote_disable(struct filter *filt UNUSED, struct knote *kn UNUSED)
|
||||
{
|
||||
return (0);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user