From 37a7ea8e90cc67762e237419f72195b83b9d1cc8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Paul=20K=C3=BChne?= Date: Fri, 11 Sep 2015 16:47:49 +0200 Subject: [PATCH 2/2] libvlc: remove daemon mode --- src/interface/interface.c | 10 ++-------- src/libvlc-module.c | 15 ++------------- src/libvlc.c | 48 ----------------------------------------------- 3 files changed, 4 insertions(+), 69 deletions(-) diff --git a/src/interface/interface.c b/src/interface/interface.c index 4bc709a..8321654 100644 --- a/src/interface/interface.c +++ b/src/interface/interface.c @@ -197,14 +197,8 @@ int libvlc_InternalAddIntf(libvlc_int_t *libvlc, const char *name) char *intf = var_InheritString(libvlc, "intf"); if (intf == NULL) /* "intf" has not been set */ { -#if !defined(_WIN32) && !defined(__OS2__) - char *pidfile = var_InheritString(libvlc, "pidfile"); - if (pidfile != NULL) - free(pidfile); - else -#endif - msg_Info(libvlc, _("Running vlc with the default interface. " - "Use 'cvlc' to use vlc without interface.")); + msg_Info(libvlc, _("Running vlc with the default interface. " + "Use 'cvlc' to use vlc without interface.")); } ret = intf_Create(playlist, intf); free(intf); diff --git a/src/libvlc-module.c b/src/libvlc-module.c index a13093d..1cdbdd5 100644 --- a/src/libvlc-module.c +++ b/src/libvlc-module.c @@ -1030,14 +1030,6 @@ static const char *const ppsz_prefres[] = { #define STATS_LONGTEXT N_( \ "Collect miscellaneous local statistics about the playing media.") -#define DAEMON_TEXT N_("Run as daemon process") -#define DAEMON_LONGTEXT N_( \ - "Runs VLC as a background daemon process.") - -#define PIDFILE_TEXT N_("Write process id to file") -#define PIDFILE_LONGTEXT N_( \ - "Writes process id into specified file.") - #define ONEINSTANCE_TEXT N_("Allow only one running instance") #if defined( _WIN32 ) || defined( __OS2__ ) #define ONEINSTANCE_LONGTEXT N_( \ @@ -2035,11 +2027,8 @@ vlc_module_begin () change_volatile () add_obsolete_string( "verbose-objects" ) /* since 2.1.0 */ #if !defined(_WIN32) && !defined(__OS2__) - add_bool( "daemon", 0, DAEMON_TEXT, DAEMON_LONGTEXT, true ) - change_short('d') - - add_string( "pidfile", NULL, PIDFILE_TEXT, PIDFILE_LONGTEXT, - false ) + add_obsolete_bool( "daemon" ) + add_obsolete_string( "pidfile" ) #endif #if defined (_WIN32) || defined (__APPLE__) diff --git a/src/libvlc.c b/src/libvlc.c index 34824da..20c1f87 100644 --- a/src/libvlc.c +++ b/src/libvlc.c @@ -199,42 +199,6 @@ int libvlc_InternalInit( libvlc_int_t *p_libvlc, int i_argc, return VLC_ENOMOD; } -#ifdef HAVE_DAEMON - /* Check for daemon mode */ - if( var_InheritBool( p_libvlc, "daemon" ) ) - { - if( daemon( 1, 0) != 0 ) - { - msg_Err( p_libvlc, "Unable to fork vlc to daemon mode" ); - vlc_LogDeinit (p_libvlc); - module_EndBank (true); - return VLC_ENOMEM; - } - - /* lets check if we need to write the pidfile */ - char *pidfile = var_InheritString( p_libvlc, "pidfile" ); - if( pidfile != NULL ) - { - FILE *stream = vlc_fopen( pidfile, "w" ); - if( stream != NULL ) - { - fprintf( stream, "%d", (int)getpid() ); - fclose( stream ); - msg_Dbg( p_libvlc, "written PID file %s", pidfile ); - } - else - msg_Err( p_libvlc, "cannot write PID file %s: %s", - pidfile, vlc_strerror_c(errno) ); - free( pidfile ); - } - } - else - { - var_Create( p_libvlc, "pidfile", VLC_VAR_STRING ); - var_SetString( p_libvlc, "pidfile", "" ); - } -#endif - /* FIXME: could be replaced by using Unix sockets */ #ifdef HAVE_DBUS @@ -511,18 +475,6 @@ void libvlc_InternalCleanup( libvlc_int_t *p_libvlc ) } #endif -#if !defined( _WIN32 ) && !defined( __OS2__ ) - char *pidfile = var_InheritString( p_libvlc, "pidfile" ); - if( pidfile != NULL ) - { - msg_Dbg( p_libvlc, "removing PID file %s", pidfile ); - if( unlink( pidfile ) ) - msg_Warn( p_libvlc, "cannot remove PID file %s: %s", - pidfile, vlc_strerror_c(errno) ); - free( pidfile ); - } -#endif - if (priv->parser != NULL) playlist_preparser_Delete(priv->parser); -- 2.5.1