Hi, I have added some patches to get rid of compilation warnings that turn up on my Fedora 19 machine. I have also made an RPM spec file, which I intend to submit to Fedora and become a packager of nanomsg in Fedora, too. Both patches are submitted hereby under the MIT license. However, I just read http://en.wikipedia.org/wiki/MIT_License and it says the name "MIT license" is ambiguous. Is it okay in the RPM specfile that I used the MIT/X11 license name? Best regards, Zoltán Böszörményi
diff --git a/src/aio/poller_epoll.inc b/src/aio/poller_epoll.inc index 92d9590..de89958 100644 --- a/src/aio/poller_epoll.inc +++ b/src/aio/poller_epoll.inc @@ -30,7 +30,9 @@ int nn_poller_init (struct nn_poller *self) { +#ifndef EPOLL_CLOEXEC int rc; +#endif #ifdef EPOLL_CLOEXEC self->ep = epoll_create1 (EPOLL_CLOEXEC); diff --git a/src/aio/usock_posix.inc b/src/aio/usock_posix.inc index a9ab5be..6741dad 100644 --- a/src/aio/usock_posix.inc +++ b/src/aio/usock_posix.inc @@ -67,7 +67,9 @@ static void nn_usock_init_from_fd (struct nn_usock *self, int s); static int nn_usock_send_raw (struct nn_usock *self, struct msghdr *hdr); static int nn_usock_recv_raw (struct nn_usock *self, void *buf, size_t *len); +#ifdef NOT_USED static int nn_usock_geterr (struct nn_usock *self); +#endif static void nn_usock_handler (struct nn_fsm *self, int src, int type, void *srcptr); static void nn_usock_shutdown (struct nn_fsm *self, int src, int type, @@ -118,8 +120,6 @@ void nn_usock_init (struct nn_usock *self, int src, struct nn_fsm *owner) void nn_usock_term (struct nn_usock *self) { - int rc; - nn_assert (self->state == NN_USOCK_STATE_IDLE); if (self->in.batch) @@ -478,7 +478,6 @@ static int nn_internal_tasks (struct nn_usock *usock, int src, int type) static void nn_usock_shutdown (struct nn_fsm *self, int src, int type, void *srcptr) { - int rc; struct nn_usock *usock; usock = nn_cont (self, struct nn_usock, fsm); @@ -1033,6 +1032,7 @@ static int nn_usock_recv_raw (struct nn_usock *self, void *buf, size_t *len) return 0; } +#ifdef NOT_USED static int nn_usock_geterr (struct nn_usock *self) { int rc; @@ -1054,4 +1054,4 @@ static int nn_usock_geterr (struct nn_usock *self) nn_assert (optsz == sizeof (opt)); return opt; } - +#endif diff --git a/src/core/sock.c b/src/core/sock.c index 795367e..3e3a594 100644 --- a/src/core/sock.c +++ b/src/core/sock.c @@ -503,8 +503,10 @@ int nn_sock_send (struct nn_sock *self, struct nn_msg *msg, int flags) nn_ctx_enter (&self->ctx); /* Compute the deadline for SNDTIMEO timer. */ - if (self->sndtimeo < 0) + if (self->sndtimeo < 0) { + deadline = -1; timeout = -1; + } else { deadline = nn_clock_now (&self->clock) + self->sndtimeo; timeout = self->sndtimeo; @@ -562,13 +564,10 @@ int nn_sock_send (struct nn_sock *self, struct nn_msg *msg, int flags) int nn_sock_recv (struct nn_sock *self, struct nn_msg *msg, int flags) { int rc; - struct nn_sockbase *sockbase; uint64_t deadline; uint64_t now; int timeout; - sockbase = (struct nn_sockbase*) self; - /* Some sockets types cannot be used for receiving messages. */ if (nn_slow (self->socktype->flags & NN_SOCKTYPE_FLAG_NORECV)) return -ENOTSUP; @@ -576,8 +575,10 @@ int nn_sock_recv (struct nn_sock *self, struct nn_msg *msg, int flags) nn_ctx_enter (&self->ctx); /* Compute the deadline for RCVTIMEO timer. */ - if (self->rcvtimeo < 0) + if (self->rcvtimeo < 0) { + deadline = -1; timeout = -1; + } else { deadline = nn_clock_now (&self->clock) + self->rcvtimeo; timeout = self->rcvtimeo; diff --git a/src/transports/ipc/bipc.c b/src/transports/ipc/bipc.c index 68b004a..9f0fec0 100644 --- a/src/transports/ipc/bipc.c +++ b/src/transports/ipc/bipc.c @@ -197,7 +197,6 @@ static void nn_bipc_handler (struct nn_fsm *self, int src, int type, void *srcptr) { struct nn_bipc *bipc; - struct nn_list_item *it; struct nn_aipc *aipc; bipc = nn_cont (self, struct nn_bipc, fsm); diff --git a/src/transports/tcp/btcp.c b/src/transports/tcp/btcp.c index f457a38..7eec9a7 100644 --- a/src/transports/tcp/btcp.c +++ b/src/transports/tcp/btcp.c @@ -99,10 +99,8 @@ int nn_btcp_create (void *hint, struct nn_epbase **epbase) int rc; struct nn_btcp *self; const char *addr; - size_t addrlen; const char *end; const char *pos; - int port; struct sockaddr_storage ss; size_t sslen; int ipv4only; @@ -115,7 +113,6 @@ int nn_btcp_create (void *hint, struct nn_epbase **epbase) /* Initalise the epbase. */ nn_epbase_init (&self->epbase, &nn_btcp_epbase_vfptr, hint); addr = nn_epbase_getaddr (&self->epbase); - addrlen = strlen (addr); /* Parse the port. */ end = addr + strlen (addr); @@ -130,7 +127,6 @@ int nn_btcp_create (void *hint, struct nn_epbase **epbase) nn_epbase_term (&self->epbase); return -EINVAL; } - port = rc; /* Check whether IPv6 is to be used. */ ipv4onlylen = sizeof (ipv4only); diff --git a/src/transports/tcp/ctcp.c b/src/transports/tcp/ctcp.c index 582748b..2125dea 100644 --- a/src/transports/tcp/ctcp.c +++ b/src/transports/tcp/ctcp.c @@ -119,7 +119,6 @@ int nn_ctcp_create (void *hint, struct nn_epbase **epbase) const char *hostname; const char *colon; const char *end; - int port; struct sockaddr_storage ss; size_t sslen; int ipv4only; @@ -160,7 +159,6 @@ int nn_ctcp_create (void *hint, struct nn_epbase **epbase) nn_epbase_term (&self->epbase); return -EINVAL; } - port = rc; /* Check whether the host portion of the address is either a literal or a valid hostname. */ diff --git a/src/transports/utils/dns_getaddrinfo_a.inc b/src/transports/utils/dns_getaddrinfo_a.inc index 44da614..e54603e 100644 --- a/src/transports/utils/dns_getaddrinfo_a.inc +++ b/src/transports/utils/dns_getaddrinfo_a.inc @@ -197,7 +197,6 @@ static void nn_dns_shutdown (struct nn_fsm *self, int src, int type, static void nn_dns_handler (struct nn_fsm *self, int src, int type, void *srcptr) { - int rc; struct nn_dns *dns; dns = nn_cont (self, struct nn_dns, fsm);
diff --git a/.gitignore b/.gitignore index c443293..744d9a3 100644 --- a/.gitignore +++ b/.gitignore @@ -35,6 +35,7 @@ doc/asciidoc.conf doltcompile doltlibtool libnanomsg.pc +nanomsg.spec nanocat *.tar.gz *.zip diff --git a/configure.ac b/configure.ac index 94e5eb1..f46d123 100644 --- a/configure.ac +++ b/configure.ac @@ -44,10 +44,14 @@ AC_PROG_AWK NN_ABI_VERSION=m4_esyscmd([./abi_version.sh]) NN_PACKAGE_VERSION=m4_esyscmd([./package_version.sh]) +NN_BINARY_PACKAGE_VERSION=m4_esyscmd([./package_version.sh | cut -d '-' -f 1]) +NN_BINARY_PACKAGE_RELEASE=m4_esyscmd([./package_version.sh | cut -d '-' -f 2-]) NN_LIBTOOL_VERSION=m4_esyscmd([./abi_version.sh -libtool]) AC_SUBST(NN_ABI_VERSION) AC_SUBST(NN_PACKAGE_VERSION) +AC_SUBST(NN_BINARY_PACKAGE_VERSION) +AC_SUBST(NN_BINARY_PACKAGE_RELEASE) AC_SUBST(NN_LIBTOOL_VERSION) AC_MSG_NOTICE([nanomsg package version: $NN_PACKAGE_VERSION]) @@ -327,5 +331,5 @@ AC_CONFIG_MACRO_DIR([m4]) AC_OUTPUT([ Makefile libnanomsg.pc +nanomsg.spec ]) - diff --git a/nanomsg.spec.in b/nanomsg.spec.in new file mode 100644 index 0000000..2750d30 --- /dev/null +++ b/nanomsg.spec.in @@ -0,0 +1,112 @@ +Name: nanomsg +Version: @NN_BINARY_PACKAGE_VERSION@ +Release: @NN_BINARY_PACKAGE_RELEASE@%{?dist} +Summary: nanomsg is a socket library that provides several common communication patterns. + +Group: System Environment/Libraries +License: MIT/X11 +URL: http://nanomsg.org/index.html +Source0: http://download.nanomsg.org/nanomsg-%{version}-alpha.tar.gz +Patch1: nanomsg-0.2-warn-fixes-2.patch +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) +BuildRequires: asciidoc xmlto + +%description +nanomsg is a socket library that provides several common communication patterns. +It aims to make the networking layer fast, scalable, and easy to use. +Implemented in C, it works on a wide range of operating systems with no +further dependencies. + +The communication patterns, also called "scalability protocols", +are basic blocks for building distributed systems. By combining them +you can create a vast array of distributed applications. +The following scalability protocols are currently available: + + PAIR - simple one-to-one communication + BUS - simple many-to-many communication + REQREP - allows to build clusters of stateless services to process user requests + PUBSUB - distributes messages to large sets of interested subscribers + PIPELINE - aggregates messages from multiple sources and load balances them among many destinations + SURVEY - allows to query state of multiple applications in a single go + +Scalability protocols are layered on top of the transport layer in +the network stack. At the moment, the nanomsg library supports the +following transports mechanisms: + + INPROC - transport within a process (between threads, modules etc.) + IPC - transport between processes on a single machine + TCP - network transport via TCP + +The library exposes a BSD-socket-like C API to the applications. +It is licensed under MIT/X11 license. + +%package devel +Summary: Development files for %{name} +Group: Development/Libraries +Requires: %{name} = %{version}-%{release} +Requires: pkgconfig + +%description devel +The %{name}-devel package contains libraries and header files for +developing applications that use %{name}. + +%package static +Summary: Static library for %{name} +Group: Development/Libraries +Requires: %{name} = %{version}-%{release} + +%description static +The %{name}-static package contains the %{name} static libraries +for -static linking. You don't need it, unless you link statically, +which is highly discouraged. + + +%prep +%setup -q -n %{name}-%{version}-alpha +%patch1 -p1 -b .warnfixes + +%build +%configure --enable-doc +make %{?_smp_mflags} + + +%install +rm -rf $RPM_BUILD_ROOT +make install DESTDIR=$RPM_BUILD_ROOT +find $RPM_BUILD_ROOT -name '*.la' -exec rm -f {} ';' +rm -f $RPM_BUILD_ROOT%{_infodir}/dir + +%clean +rm -rf $RPM_BUILD_ROOT + + +%post -p /sbin/ldconfig + +%postun -p /sbin/ldconfig + + +%files +%defattr(-,root,root,-) +%doc AUTHORS ChangeLog COPYING README +%{_bindir}/nanocat +%{_bindir}/nn_* +%{_libdir}/*.so.* +%{_mandir}/man1/*.gz + +%files devel +%defattr(-,root,root,-) +%dir %{_docdir}/%{name} +%{_docdir}/%{name}/*.html +%{_libdir}/pkgconfig/*.pc +%dir %{_includedir}/%{name} +%{_includedir}/%{name}/*.h +%{_libdir}/*.so +%{_mandir}/man3/*.gz +%{_mandir}/man7/*.gz + +%files static +%{_libdir}/*.a + +%changelog +* Fri Sep 20 2013 Zoltán Böszörményi <zboszor@xxxxx> 0.2-alpha +- Created.