summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimo Sorce <ssorce@redhat.com>2009-06-07 14:10:15 -0400
committerSimo Sorce <idra@samba.org>2009-06-15 16:31:13 -0400
commitefccef09aec93180a06955b5e03f1ceb99dc39e8 (patch)
treeb9ab8101b66e240c3f222cc1e94df09524894b60
parente83f4b868b208724a732b45a0aa4f6ee8a08b115 (diff)
downloadsamba-efccef09aec93180a06955b5e03f1ceb99dc39e8.tar.gz
samba-efccef09aec93180a06955b5e03f1ceb99dc39e8.tar.bz2
samba-efccef09aec93180a06955b5e03f1ceb99dc39e8.zip
Add exports file and abi checker for tevent
This is a first attempt at exporting symbols only for public functions We also provide a rudimentary ABI checker that tries to check that function signatures are not changed by mistake. Given our use of macros this is not an API checker. It's all based on tevent.h contents and the gcc -aux-info option
-rw-r--r--lib/tevent/Makefile.in7
-rwxr-xr-xlib/tevent/abi_checks.sh31
-rw-r--r--lib/tevent/configure.ac1
-rw-r--r--lib/tevent/libtevent.m45
-rw-r--r--lib/tevent/rules.mk2
-rw-r--r--lib/tevent/tevent.exports59
-rw-r--r--lib/tevent/tevent.signatures54
7 files changed, 157 insertions, 2 deletions
diff --git a/lib/tevent/Makefile.in b/lib/tevent/Makefile.in
index 253b1e1d12..f3deb9df45 100644
--- a/lib/tevent/Makefile.in
+++ b/lib/tevent/Makefile.in
@@ -39,6 +39,10 @@ LIBS = $(TALLOC_LIBS) $(TEVENT_LIBS) @LIBS@
TEVENT_OBJ = @TEVENT_OBJ@ @LIBREPLACEOBJ@
+SONAMEFLAG = @SONAMEFLAG@
+VERSIONSCRIPT = @VERSIONSCRIPT@
+EXPORTSFILE = @EXPORTSFILE@
+
default: all
include $(teventdir)/tevent.mk
@@ -48,7 +52,7 @@ all:: showflags dirs $(PROGS) $(TEVENT_SOLIB) libtevent.a
install:: all
$(TEVENT_SOLIB): $(TEVENT_OBJ)
- $(SHLD) $(SHLD_FLAGS) $(LDFLAGS) $(LIBS) -o $@ $(TEVENT_OBJ) @SONAMEFLAG@$(TEVENT_SONAME)
+ $(SHLD) $(SHLD_FLAGS) $(LDFLAGS) $(LIBS) -o $@ $(TEVENT_OBJ) $(VERSIONSCRIPT) $(EXPORTSFILE) $(SONAMEFLAG)$(TEVENT_SONAME)
shared-build: all
${INSTALLCMD} -d $(sharedbuilddir)/lib
@@ -65,6 +69,7 @@ installcheck:: test install
clean::
rm -f *.o *.a */*.o
+ rm -fr abi
distclean:: clean
rm -f config.log config.status config.h config.cache
diff --git a/lib/tevent/abi_checks.sh b/lib/tevent/abi_checks.sh
new file mode 100755
index 0000000000..83082ad401
--- /dev/null
+++ b/lib/tevent/abi_checks.sh
@@ -0,0 +1,31 @@
+#!/bin/bash
+make clean
+
+mkdir abi
+ABI_CHECKS="-aux-info abi/\$@.X"
+make ABI_CHECK="$ABI_CHECKS"
+
+for i in abi/*.X; do cat $i | grep 'tevent\.h'; done | sort | uniq | awk -F "extern " '{ print $2 }' > abi/signatures
+
+cat > abi/exports << EOF
+{
+ global:
+EOF
+cat abi/signatures | awk -F '(' '{ print $1 }' | awk -F ' ' '{ print " "$NF";" }' | tr -d '*' | sort >> abi/exports
+cat >> abi/exports << EOF
+
+ local: *;
+};
+EOF
+
+rm -fr abi/*.X
+
+diff -u tevent.signatures abi/signatures
+if [ "$?" != "0" ]; then
+ echo "WARNING: Possible ABI Change!!"
+fi
+
+diff -u tevent.exports abi/exports
+if [ "$?" != "0" ]; then
+ echo "WARNING: Export file may be outdated!!"
+fi
diff --git a/lib/tevent/configure.ac b/lib/tevent/configure.ac
index 0d3f21d7d7..d40e02e15a 100644
--- a/lib/tevent/configure.ac
+++ b/lib/tevent/configure.ac
@@ -7,6 +7,7 @@ AC_LIBREPLACE_ALL_CHECKS
AC_LD_EXPORT_DYNAMIC
AC_LD_SONAMEFLAG
+AC_LD_VERSIONSCRIPT
AC_LD_PICFLAG
AC_LD_SHLIBEXT
AC_LIBREPLACE_SHLD
diff --git a/lib/tevent/libtevent.m4 b/lib/tevent/libtevent.m4
index 20730b17d6..4162ba30f9 100644
--- a/lib/tevent/libtevent.m4
+++ b/lib/tevent/libtevent.m4
@@ -38,3 +38,8 @@ if test x"$ac_cv_header_sys_epoll_h" = x"yes" -a x"$ac_cv_func_epoll_create" = x
AC_DEFINE(HAVE_EPOLL, 1, [Whether epoll available])
fi
+if test x"$VERSIONSCRIPT" != "x"; then
+ EXPORTSFILE=tevent.exports
+ AC_SUBST(EXPORTSFILE)
+fi
+
diff --git a/lib/tevent/rules.mk b/lib/tevent/rules.mk
index 28a2515b01..c197e930a3 100644
--- a/lib/tevent/rules.mk
+++ b/lib/tevent/rules.mk
@@ -12,7 +12,7 @@ showflags::
.c.o:
@echo Compiling $*.c
@mkdir -p `dirname $@`
- @$(CC) $(PICFLAG) $(CFLAGS) -c $< -o $@
+ @$(CC) $(PICFLAG) $(CFLAGS) $(ABI_CHECK) -c $< -o $@
distclean::
rm -f *~ */*~
diff --git a/lib/tevent/tevent.exports b/lib/tevent/tevent.exports
new file mode 100644
index 0000000000..7d55c17e5d
--- /dev/null
+++ b/lib/tevent/tevent.exports
@@ -0,0 +1,59 @@
+{
+ global:
+ _tevent_add_fd;
+ _tevent_add_signal;
+ _tevent_add_timer;
+ tevent_backend_list;
+ tevent_context_init;
+ tevent_context_init_byname;
+ _tevent_create_immediate;
+ tevent_fd_get_flags;
+ tevent_fd_set_auto_close;
+ tevent_fd_set_close_fn;
+ tevent_fd_set_flags;
+ tevent_loop_allow_nesting;
+ _tevent_loop_once;
+ tevent_loop_set_nesting_hook;
+ _tevent_loop_until;
+ _tevent_loop_wait;
+ tevent_queue_add;
+ _tevent_queue_create;
+ tevent_queue_length;
+ tevent_queue_start;
+ tevent_queue_stop;
+ _tevent_req_callback_data;
+ _tevent_req_create;
+ _tevent_req_data;
+ tevent_req_default_print;
+ _tevent_req_done;
+ _tevent_req_error;
+ tevent_req_is_error;
+ tevent_req_is_in_progress;
+ _tevent_req_nomem;
+ _tevent_req_notify_callback;
+ tevent_req_poll;
+ tevent_req_post;
+ tevent_req_print;
+ tevent_req_received;
+ tevent_req_set_callback;
+ tevent_req_set_endtime;
+ tevent_req_set_print_fn;
+ _tevent_schedule_immediate;
+ tevent_set_abort_fn;
+ tevent_set_debug;
+ tevent_set_debug_stderr;
+ tevent_set_default_backend;
+ tevent_signal_support;
+ tevent_timeval_add;
+ tevent_timeval_compare;
+ tevent_timeval_current;
+ tevent_timeval_current_ofs;
+ tevent_timeval_is_zero;
+ tevent_timeval_set;
+ tevent_timeval_until;
+ tevent_timeval_zero;
+ tevent_wakeup_recv;
+ tevent_wakeup_send;
+
+ local: *;
+};
diff --git a/lib/tevent/tevent.signatures b/lib/tevent/tevent.signatures
new file mode 100644
index 0000000000..fab5f64559
--- /dev/null
+++ b/lib/tevent/tevent.signatures
@@ -0,0 +1,54 @@
+struct tevent_signal *_tevent_add_signal (struct tevent_context *, TALLOC_CTX *, int, int, tevent_signal_handler_t, void *, const char *, const char *);
+int _tevent_loop_once (struct tevent_context *, const char *);
+int _tevent_loop_wait (struct tevent_context *, const char *);
+void tevent_fd_set_close_fn (struct tevent_fd *, tevent_fd_close_fn_t);
+void tevent_fd_set_auto_close (struct tevent_fd *);
+uint16_t tevent_fd_get_flags (struct tevent_fd *);
+void tevent_fd_set_flags (struct tevent_fd *, uint16_t);
+_Bool tevent_signal_support (struct tevent_context *);
+void tevent_set_abort_fn (void (*) (const char *));
+int tevent_set_debug (struct tevent_context *, void (*) (void *, enum tevent_debug_level, const char *, __va_list_tag *), void *);
+int tevent_set_debug_stderr (struct tevent_context *);
+void tevent_req_set_callback (struct tevent_req *, tevent_req_fn, void *);
+void *_tevent_req_callback_data (struct tevent_req *);
+void *_tevent_req_data (struct tevent_req *);
+void tevent_req_set_print_fn (struct tevent_req *, tevent_req_print_fn);
+char *tevent_req_default_print (struct tevent_req *, TALLOC_CTX *);
+char *tevent_req_print (TALLOC_CTX *, struct tevent_req *);
+struct tevent_req *_tevent_req_create (TALLOC_CTX *, void *, size_t, const char *, const char *);
+_Bool tevent_req_set_endtime (struct tevent_req *, struct tevent_context *, struct timeval);
+void _tevent_req_notify_callback (struct tevent_req *, const char *);
+void _tevent_req_done (struct tevent_req *, const char *);
+_Bool _tevent_req_error (struct tevent_req *, uint64_t, const char *);
+_Bool _tevent_req_nomem (const void *, struct tevent_req *, const char *);
+struct tevent_req *tevent_req_post (struct tevent_req *, struct tevent_context *);
+_Bool tevent_req_is_in_progress (struct tevent_req *);
+_Bool tevent_req_poll (struct tevent_req *, struct tevent_context *);
+_Bool tevent_req_is_error (struct tevent_req *, enum tevent_req_state *, uint64_t *);
+void tevent_req_received (struct tevent_req *);
+struct tevent_req *tevent_wakeup_send (TALLOC_CTX *, struct tevent_context *, struct timeval);
+_Bool tevent_wakeup_recv (struct tevent_req *);
+int tevent_timeval_compare (const struct timeval *, const struct timeval *);
+struct timeval tevent_timeval_zero (void);
+struct timeval tevent_timeval_current (void);
+struct timeval tevent_timeval_set (uint32_t, uint32_t);
+struct timeval tevent_timeval_until (const struct timeval *, const struct timeval *);
+_Bool tevent_timeval_is_zero (const struct timeval *);
+struct timeval tevent_timeval_add (const struct timeval *, uint32_t, uint32_t);
+struct timeval tevent_timeval_current_ofs (uint32_t, uint32_t);
+struct tevent_queue *_tevent_queue_create (TALLOC_CTX *, const char *, const char *);
+_Bool tevent_queue_add (struct tevent_queue *, struct tevent_context *, struct tevent_req *, tevent_queue_trigger_fn_t, void *);
+void tevent_queue_start (struct tevent_queue *);
+void tevent_queue_stop (struct tevent_queue *);
+size_t tevent_queue_length (struct tevent_queue *);
+void tevent_loop_allow_nesting (struct tevent_context *);
+void tevent_loop_set_nesting_hook (struct tevent_context *, tevent_nesting_hook, void *);
+int _tevent_loop_until (struct tevent_context *, _Bool (*) (void *), void *, const char *);
+struct tevent_context *tevent_context_init (TALLOC_CTX *);
+struct tevent_context *tevent_context_init_byname (TALLOC_CTX *, const char *);
+const char **tevent_backend_list (TALLOC_CTX *);
+void tevent_set_default_backend (const char *);
+struct tevent_fd *_tevent_add_fd (struct tevent_context *, TALLOC_CTX *, int, uint16_t, tevent_fd_handler_t, void *, const char *, const char *);
+struct tevent_timer *_tevent_add_timer (struct tevent_context *, TALLOC_CTX *, struct timeval, tevent_timer_handler_t, void *, const char *, const char *);
+struct tevent_immediate *_tevent_create_immediate (TALLOC_CTX *, const char *);
+void _tevent_schedule_immediate (struct tevent_immediate *, struct tevent_context *, tevent_immediate_handler_t, void *, const char *, const char *);