From bedd1d4eadde9ab64f924c69eba716b015599e67 Mon Sep 17 00:00:00 2001 From: dimitri staessens Date: Thu, 12 Oct 2017 02:15:39 +0200 Subject: lib: Deprecate ouroboros_init and ourboros_fini This commit deprecates ouroboros_init and ouroboros_fini and adds them as a constructor or destructor, causing these function to be run automatically when a program that links to the library calls and exits main(). For this to fully work, the library had to be split so that we can avoid the irmd calling these functions (the IRMd has to create the shm structures on which these calls depend). The library is split in 3 parts: libouroboros-dev, libouroboros-irm and libouroboros-common. The latter is linked to the other two so that including libouroboros-dev or libouroboros-irm will also link libouroboros-common. --- doc/man/CMakeLists.txt | 2 -- doc/man/fccntl.3 | 2 +- doc/man/flow_alloc.3 | 5 ++-- doc/man/flow_read.3 | 2 +- doc/man/fqueue.3 | 2 +- doc/man/fset.3 | 2 +- doc/man/ouroboros_fini.3 | 1 - doc/man/ouroboros_init.3 | 69 ------------------------------------------------ 8 files changed, 6 insertions(+), 79 deletions(-) delete mode 100644 doc/man/ouroboros_fini.3 delete mode 100644 doc/man/ouroboros_init.3 (limited to 'doc/man') diff --git a/doc/man/CMakeLists.txt b/doc/man/CMakeLists.txt index ab56242d..ba72b14b 100644 --- a/doc/man/CMakeLists.txt +++ b/doc/man/CMakeLists.txt @@ -1,7 +1,5 @@ set(MAN_NAMES # Add man page sources here - ouroboros_init.3 - ouroboros_fini.3 flow_accept.3 flow_alloc.3 flow_dealloc.3 diff --git a/doc/man/fccntl.3 b/doc/man/fccntl.3 index ac35a7f8..eaa6a02e 100644 --- a/doc/man/fccntl.3 +++ b/doc/man/fccntl.3 @@ -14,7 +14,7 @@ fccntl \- control commands for flows and FRCT connections \fBint fccntl(int \fIfd\fB, int \fIcmd\fB, ...); -Compile and link with \fI-louroboros\fR. +Compile and link with \fI-louroboros-dev\fR. .SH DESCRIPTION diff --git a/doc/man/flow_alloc.3 b/doc/man/flow_alloc.3 index 662c46ec..cab8153e 100644 --- a/doc/man/flow_alloc.3 +++ b/doc/man/flow_alloc.3 @@ -22,7 +22,7 @@ const struct timespec * \fItimeo\fB); \fBint flow_dealloc(int \fIfd\fB);\fR -Compile and link with \fI-louroboros\fR. +Compile and link with \fI-louroboros-dev\fR. .SH DESCRIPTION @@ -109,8 +109,7 @@ _ .SH SEE ALSO -.BR ouroboros_init "(3), " ouroboros_fini "(3), " \ -flow_read "(3), " flow_write (3) +.BR flow_read "(3), " flow_write (3) .SH COLOPHON This page is part of the Ouroboros project, found at diff --git a/doc/man/flow_read.3 b/doc/man/flow_read.3 index 36a506a6..9e7842e5 100644 --- a/doc/man/flow_read.3 +++ b/doc/man/flow_read.3 @@ -16,7 +16,7 @@ flow_read, flow_write \- read and write from/to a flow \fBint flow_write(int \fIfd\fB, const void * \fIbuf\fB, size_t \fIcount\fB);\fR -Compile and link with \fI-louroboros\fR. +Compile and link with \fI-louroboros-dev\fR. .SH DESCRIPTION diff --git a/doc/man/fqueue.3 b/doc/man/fqueue.3 index cf8cef20..f932633d 100644 --- a/doc/man/fqueue.3 +++ b/doc/man/fqueue.3 @@ -22,7 +22,7 @@ on flows \fBint fevent(fset_t * \fIset\fB, fqueue_t * \fIfq\fB, const struct timespec * \fItimeo\fB); -Compile and link with \fI-louroboros\fR. +Compile and link with \fI-louroboros-dev\fR. .SH DESCRIPTION diff --git a/doc/man/fset.3 b/doc/man/fset.3 index b4f3a1b0..3b367e17 100644 --- a/doc/man/fset.3 +++ b/doc/man/fset.3 @@ -25,7 +25,7 @@ manipulation of a set of flow descriptors \fBbool fset_has(fset_t * \fIset\fB, int \fIfd\fB); -Compile and link with \fI-louroboros\fR. +Compile and link with \fI-louroboros-dev\fR. .SH DESCRIPTION diff --git a/doc/man/ouroboros_fini.3 b/doc/man/ouroboros_fini.3 deleted file mode 100644 index d525d287..00000000 --- a/doc/man/ouroboros_fini.3 +++ /dev/null @@ -1 +0,0 @@ -.so ouroboros_init.3 diff --git a/doc/man/ouroboros_init.3 b/doc/man/ouroboros_init.3 deleted file mode 100644 index c74bea5e..00000000 --- a/doc/man/ouroboros_init.3 +++ /dev/null @@ -1,69 +0,0 @@ -.\" Ouroboros man pages (C) 2017 -.\" Dimitri Staessens -.\" Sander Vrijders - -.TH OUROBOROS_INIT 3 2017-04-10 GNU "Ouroboros Programmer's Manual" - -.SH NAME - -ouroboros_init, ouroboros_fini \- initialize and finalize an -application for using Ouroboros - -.SH SYNOPSIS - -.B #include - -\fBint ouroboros_init(char * \fIapn\fB);\fR - -\fBvoid ouroboros_fini(void);\fR - -Compile and link with \fI-louroboros\fR. - -.SH DESCRIPTION - -The \fBouroboros_init\fR() call initializes an application process -instance for using the Ouroboros IPC infrastructure. If the -application is a server or peer, a \fBchar * \fIapn\fR has to be -provided indicating the application process that this instance belongs -to. This is usually argv[0]. A client application may pass NULL. The -\fBouroboros_fini\fR() call will release all resources allocated by -\fBouroboros_fini\fR(). - -\fBouroboros_init\fR() and \fBouroboros_fini\fR() should be called -only once in the application. - -.SH RETURN VALUE - -On success, \fBouroboros_init\fR() returns 0. On failure, a negative -value indicating the error will be returned. The -\fBouroboros_fini\fR() function has no return value. - -.SH ERRORS - -\fBouroboros_init\fR() can return the following errors: - -.B -EIRMD -Failed to contact an IRMd instance. - -.B -ENOMEM -Insufficient system resources to intialize the application. - -.SH ATTRIBUTES - -For an explanation of the terms used in this section, see -\fBattributes\fR(7). - -.TS -box, tab(&); -LB|LB|LB -L|L|L. -Interface & Attribute & Value -_ -\fBouroboros_init\fR() & Thread safety & MT-Safe -_ -\fBouroboros_fini\fR() & Thread safety & MT-Safe -.TE - -.SH COLOPHON -This page is part of the Ouroboros project, found at -https://bitbucket.org/ouroboros-rina/ouroboros -- cgit v1.2.3