Applied patch from larsl to drop file desctiptors on server launch.
Applied Debian patch to fix memory errors on 64-bit archs (supposedly..). Applied Debian patch to kill /etc/services requirement. Fixed server auto launch to work without /etc/services (debian patch broke it). git-svn-id: svn://svn.savannah.nongnu.org/lash/trunk@42 1de19dc7-4e3f-0410-a61d-eddf686bf0b7
This commit is contained in:
parent
99b63e0915
commit
ee35dd9708
25
configure.ac
25
configure.ac
|
@ -176,31 +176,6 @@ else
|
||||||
AC_MSG_RESULT([no])
|
AC_MSG_RESULT([no])
|
||||||
fi
|
fi
|
||||||
|
|
||||||
###########################
|
|
||||||
### --disable-serv-inst ###
|
|
||||||
###########################
|
|
||||||
AC_MSG_CHECKING([whether to install service in /etc/services])
|
|
||||||
lash_serv_inst="yes"
|
|
||||||
AC_ARG_ENABLE(serv-inst,
|
|
||||||
[AS_HELP_STRING(--disable-serv-inst, disable installation of lash service in /etc/services)],[
|
|
||||||
case "$enableval" in
|
|
||||||
"yes")
|
|
||||||
;;
|
|
||||||
"no")
|
|
||||||
lash_serv_inst="no"
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
AC_MSG_ERROR([must use --enable-serv-inst(=yes/no) or --disable-serv-inst])
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
])
|
|
||||||
|
|
||||||
AM_CONDITIONAL(SERVICE_INSTALL, test x$lash_serv_inst = xyes)
|
|
||||||
if test x$lash_serv_inst = xyes; then
|
|
||||||
AC_MSG_RESULT([yes])
|
|
||||||
else
|
|
||||||
AC_MSG_RESULT([no])
|
|
||||||
fi
|
|
||||||
|
|
||||||
##########################
|
##########################
|
||||||
### --with-default-dir ###
|
### --with-default-dir ###
|
||||||
|
|
|
@ -198,13 +198,6 @@ for developers working on the LASH code itself.
|
||||||
to \$HOME under which the server will create new project directories.
|
to \$HOME under which the server will create new project directories.
|
||||||
Without this option, the value defaults to @file{audio-projects}.
|
Without this option, the value defaults to @file{audio-projects}.
|
||||||
|
|
||||||
@item --disable-serv-inst The LASH server and library look up port
|
|
||||||
addresses for the LASH service using standard system calls that
|
|
||||||
refer to the @file{/etc/services} database. If @file{/etc/services}
|
|
||||||
does not contain a valid entry, an error will result. By default, the
|
|
||||||
installation routine will install a service entry if one does not exist.
|
|
||||||
This flag disables that action.
|
|
||||||
|
|
||||||
@end table
|
@end table
|
||||||
|
|
||||||
@subsection Building
|
@subsection Building
|
||||||
|
|
|
@ -7,5 +7,6 @@ Name: LASH
|
||||||
Description: Audio session management
|
Description: Audio session management
|
||||||
Requires: jack alsa
|
Requires: jack alsa
|
||||||
Version: @PACKAGE_VERSION@
|
Version: @PACKAGE_VERSION@
|
||||||
Libs: -Wl,--rpath -Wl,${libdir} -L${libdir} -llash -lpthread -luuid
|
Libs: -llash
|
||||||
|
Libs.static: -lpthread -luuid
|
||||||
Cflags: -I${includedir}/lash-1.0
|
Cflags: -I${includedir}/lash-1.0
|
||||||
|
|
|
@ -50,7 +50,7 @@ void lash_args_set_port (lash_args_t * args, int port);
|
||||||
void lash_args_set_id (lash_args_t * args, uuid_t id);
|
void lash_args_set_id (lash_args_t * args, uuid_t id);
|
||||||
void lash_args_set_flags (lash_args_t * args, int flags);
|
void lash_args_set_flags (lash_args_t * args, int flags);
|
||||||
void lash_args_set_flag (lash_args_t * args, int flag);
|
void lash_args_set_flag (lash_args_t * args, int flag);
|
||||||
void lash_args_set_args (lash_args_t * args, int argc, const char * const * argv);
|
void lash_args_set_args (lash_args_t * args, int argc, const char *const * argv);
|
||||||
|
|
||||||
const char * lash_args_get_project (const lash_args_t * args);
|
const char * lash_args_get_project (const lash_args_t * args);
|
||||||
const char * lash_args_get_server (const lash_args_t * args);
|
const char * lash_args_get_server (const lash_args_t * args);
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
|
|
||||||
struct _lash_client
|
struct _lash_client
|
||||||
{
|
{
|
||||||
lash_args_t *args;
|
lash_args_t *args;
|
||||||
char *class;
|
char *class;
|
||||||
|
|
||||||
short server_connected;
|
short server_connected;
|
||||||
|
|
|
@ -27,6 +27,8 @@
|
||||||
|
|
||||||
# include <lash/lash.h>
|
# include <lash/lash.h>
|
||||||
|
|
||||||
|
#define LASH_PORT "14541"
|
||||||
|
|
||||||
# ifdef __cplusplus
|
# ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
# endif
|
# endif
|
||||||
|
|
|
@ -46,10 +46,3 @@ dtd_DATA = lash-project-1.0.dtd
|
||||||
|
|
||||||
EXTRA_DIST = $(dtd_DATA)
|
EXTRA_DIST = $(dtd_DATA)
|
||||||
|
|
||||||
if SERVICE_INSTALL
|
|
||||||
install-data-local:
|
|
||||||
if ! grep -q ^lash /etc/services; then \
|
|
||||||
echo -e "\nlash\t\t14541/tcp\t\t\t# LASH client/server protocol" >> /etc/services; \
|
|
||||||
fi
|
|
||||||
endif
|
|
||||||
|
|
||||||
|
|
|
@ -185,7 +185,7 @@ conn_mgr_start(conn_mgr_t * conn_mgr)
|
||||||
hints.ai_socktype = SOCK_STREAM;
|
hints.ai_socktype = SOCK_STREAM;
|
||||||
hints.ai_flags = AI_PASSIVE;
|
hints.ai_flags = AI_PASSIVE;
|
||||||
|
|
||||||
err = getaddrinfo(NULL, "lash", &hints, &addrs);
|
err = getaddrinfo(NULL, LASH_PORT, &hints, &addrs);
|
||||||
if (err) {
|
if (err) {
|
||||||
fprintf(stderr, "%s: could not look up service name: %s\n",
|
fprintf(stderr, "%s: could not look up service name: %s\n",
|
||||||
__FUNCTION__, gai_strerror(err));
|
__FUNCTION__, gai_strerror(err));
|
||||||
|
|
|
@ -81,7 +81,7 @@ lash_args_duplicate(const lash_args_t *const src)
|
||||||
result->flags = src->flags;
|
result->flags = src->flags;
|
||||||
result->argc = 0;
|
result->argc = 0;
|
||||||
result->argv = NULL;
|
result->argv = NULL;
|
||||||
if (result->argc > 0 && result->argv)
|
if (src->argc > 0 && src->argv)
|
||||||
lash_args_set_args(result, src->argc, src->argv);
|
lash_args_set_args(result, src->argc, src->argv);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
@ -150,7 +150,7 @@ lash_args_get_flags(const lash_args_t * args)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
lash_args_set_args(lash_args_t * args, int argc, const char *const *argv)
|
lash_args_set_args(lash_args_t * args, int argc, const char *const * argv)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
|
|
||||||
#include <lash/types.h>
|
#include <lash/types.h>
|
||||||
#include <lash/client.h>
|
#include <lash/client.h>
|
||||||
#include <lash/xmalloc.h>
|
#include <lash/list.h>
|
||||||
#include <lash/internal.h>
|
#include <lash/internal.h>
|
||||||
|
|
||||||
lash_client_t *
|
lash_client_t *
|
||||||
|
|
|
@ -135,7 +135,7 @@ lash_comm_connect_to_server(lash_client_t * client, const char *server,
|
||||||
lash_comm_event_t connect_event;
|
lash_comm_event_t connect_event;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
err = lash_open_socket(&client->socket, server, "lash");
|
err = lash_open_socket(&client->socket, server, service);
|
||||||
if (err) {
|
if (err) {
|
||||||
fprintf(stderr, "%s: could not create server connection\n",
|
fprintf(stderr, "%s: could not create server connection\n",
|
||||||
__FUNCTION__);
|
__FUNCTION__);
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#include <lash/config.h>
|
#include <lash/config.h>
|
||||||
#include <lash/xmalloc.h>
|
#include <lash/list.h>
|
||||||
#include <lash/internal.h>
|
#include <lash/internal.h>
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
#include <lash/types.h>
|
#include <lash/types.h>
|
||||||
#include <lash/internal.h>
|
#include <lash/internal.h>
|
||||||
#include <lash/xmalloc.h>
|
#include <lash/list.h>
|
||||||
#include <lash/event.h>
|
#include <lash/event.h>
|
||||||
|
|
||||||
lash_event_t *
|
lash_event_t *
|
||||||
|
|
|
@ -125,7 +125,7 @@ lash_extract_args(int *argc, char ***argv)
|
||||||
|
|
||||||
*argc = valid_count;
|
*argc = valid_count;
|
||||||
|
|
||||||
lash_args_set_args(args, *argc, (const char *const *)*argv);
|
lash_args_set_args(args, *argc, *argv);
|
||||||
|
|
||||||
return args;
|
return args;
|
||||||
}
|
}
|
||||||
|
@ -179,7 +179,7 @@ lash_init(const lash_args_t * args,
|
||||||
cstr = lash_args_get_server(args);
|
cstr = lash_args_get_server(args);
|
||||||
err = lash_comm_connect_to_server(client,
|
err = lash_comm_connect_to_server(client,
|
||||||
cstr ? cstr : "localhost",
|
cstr ? cstr : "localhost",
|
||||||
"lash", connect_params);
|
LASH_PORT, connect_params);
|
||||||
|
|
||||||
/* couldn't connect, try to start a new server */
|
/* couldn't connect, try to start a new server */
|
||||||
/* but not if this client has been started by a server, in which
|
/* but not if this client has been started by a server, in which
|
||||||
|
@ -196,6 +196,13 @@ lash_init(const lash_args_t * args,
|
||||||
|
|
||||||
/* child process will run this statement */
|
/* child process will run this statement */
|
||||||
if (err == 0) {
|
if (err == 0) {
|
||||||
|
|
||||||
|
/* need to close all open file descriptors except the std ones */
|
||||||
|
int max_fds = getdtablesize();
|
||||||
|
int fd;
|
||||||
|
for (fd = 3; fd < max_fds; ++fd)
|
||||||
|
close(fd);
|
||||||
|
|
||||||
switch (fork()) {
|
switch (fork()) {
|
||||||
|
|
||||||
/* grandchild process will run this block */
|
/* grandchild process will run this block */
|
||||||
|
@ -221,7 +228,7 @@ lash_init(const lash_args_t * args,
|
||||||
sleep(1);
|
sleep(1);
|
||||||
err = lash_comm_connect_to_server(client,
|
err = lash_comm_connect_to_server(client,
|
||||||
cstr ? cstr : "localhost",
|
cstr ? cstr : "localhost",
|
||||||
"lash", connect_params);
|
LASH_PORT, connect_params);
|
||||||
if (err == 0) {
|
if (err == 0) {
|
||||||
LASH_PRINT_DEBUG("successfully launched and connected to lashd");
|
LASH_PRINT_DEBUG("successfully launched and connected to lashd");
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -33,8 +33,7 @@ extern int h_errno;
|
||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
#include <lash/list.h>
|
||||||
#include <lash/xmalloc.h>
|
|
||||||
#include <lash/debug.h>
|
#include <lash/debug.h>
|
||||||
|
|
||||||
int
|
int
|
||||||
|
|
Loading…
Reference in New Issue