0002-libvlc-remove-daemon-mode.patch 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. From 37a7ea8e90cc67762e237419f72195b83b9d1cc8 Mon Sep 17 00:00:00 2001
  2. From: =?UTF-8?q?Felix=20Paul=20K=C3=BChne?= <fkuehne@videolan.org>
  3. Date: Fri, 11 Sep 2015 16:47:49 +0200
  4. Subject: [PATCH 2/2] libvlc: remove daemon mode
  5. ---
  6. src/interface/interface.c | 10 ++--------
  7. src/libvlc-module.c | 15 ++-------------
  8. src/libvlc.c | 48 -----------------------------------------------
  9. 3 files changed, 4 insertions(+), 69 deletions(-)
  10. diff --git a/src/interface/interface.c b/src/interface/interface.c
  11. index 4bc709a..8321654 100644
  12. --- a/src/interface/interface.c
  13. +++ b/src/interface/interface.c
  14. @@ -197,14 +197,8 @@ int libvlc_InternalAddIntf(libvlc_int_t *libvlc, const char *name)
  15. char *intf = var_InheritString(libvlc, "intf");
  16. if (intf == NULL) /* "intf" has not been set */
  17. {
  18. -#if !defined(_WIN32) && !defined(__OS2__)
  19. - char *pidfile = var_InheritString(libvlc, "pidfile");
  20. - if (pidfile != NULL)
  21. - free(pidfile);
  22. - else
  23. -#endif
  24. - msg_Info(libvlc, _("Running vlc with the default interface. "
  25. - "Use 'cvlc' to use vlc without interface."));
  26. + msg_Info(libvlc, _("Running vlc with the default interface. "
  27. + "Use 'cvlc' to use vlc without interface."));
  28. }
  29. ret = intf_Create(playlist, intf);
  30. free(intf);
  31. diff --git a/src/libvlc-module.c b/src/libvlc-module.c
  32. index a13093d..1cdbdd5 100644
  33. --- a/src/libvlc-module.c
  34. +++ b/src/libvlc-module.c
  35. @@ -1030,14 +1030,6 @@ static const char *const ppsz_prefres[] = {
  36. #define STATS_LONGTEXT N_( \
  37. "Collect miscellaneous local statistics about the playing media.")
  38. -#define DAEMON_TEXT N_("Run as daemon process")
  39. -#define DAEMON_LONGTEXT N_( \
  40. - "Runs VLC as a background daemon process.")
  41. -
  42. -#define PIDFILE_TEXT N_("Write process id to file")
  43. -#define PIDFILE_LONGTEXT N_( \
  44. - "Writes process id into specified file.")
  45. -
  46. #define ONEINSTANCE_TEXT N_("Allow only one running instance")
  47. #if defined( _WIN32 ) || defined( __OS2__ )
  48. #define ONEINSTANCE_LONGTEXT N_( \
  49. @@ -2035,11 +2027,8 @@ vlc_module_begin ()
  50. change_volatile ()
  51. add_obsolete_string( "verbose-objects" ) /* since 2.1.0 */
  52. #if !defined(_WIN32) && !defined(__OS2__)
  53. - add_bool( "daemon", 0, DAEMON_TEXT, DAEMON_LONGTEXT, true )
  54. - change_short('d')
  55. -
  56. - add_string( "pidfile", NULL, PIDFILE_TEXT, PIDFILE_LONGTEXT,
  57. - false )
  58. + add_obsolete_bool( "daemon" )
  59. + add_obsolete_string( "pidfile" )
  60. #endif
  61. #if defined (_WIN32) || defined (__APPLE__)
  62. diff --git a/src/libvlc.c b/src/libvlc.c
  63. index 34824da..20c1f87 100644
  64. --- a/src/libvlc.c
  65. +++ b/src/libvlc.c
  66. @@ -199,42 +199,6 @@ int libvlc_InternalInit( libvlc_int_t *p_libvlc, int i_argc,
  67. return VLC_ENOMOD;
  68. }
  69. -#ifdef HAVE_DAEMON
  70. - /* Check for daemon mode */
  71. - if( var_InheritBool( p_libvlc, "daemon" ) )
  72. - {
  73. - if( daemon( 1, 0) != 0 )
  74. - {
  75. - msg_Err( p_libvlc, "Unable to fork vlc to daemon mode" );
  76. - vlc_LogDeinit (p_libvlc);
  77. - module_EndBank (true);
  78. - return VLC_ENOMEM;
  79. - }
  80. -
  81. - /* lets check if we need to write the pidfile */
  82. - char *pidfile = var_InheritString( p_libvlc, "pidfile" );
  83. - if( pidfile != NULL )
  84. - {
  85. - FILE *stream = vlc_fopen( pidfile, "w" );
  86. - if( stream != NULL )
  87. - {
  88. - fprintf( stream, "%d", (int)getpid() );
  89. - fclose( stream );
  90. - msg_Dbg( p_libvlc, "written PID file %s", pidfile );
  91. - }
  92. - else
  93. - msg_Err( p_libvlc, "cannot write PID file %s: %s",
  94. - pidfile, vlc_strerror_c(errno) );
  95. - free( pidfile );
  96. - }
  97. - }
  98. - else
  99. - {
  100. - var_Create( p_libvlc, "pidfile", VLC_VAR_STRING );
  101. - var_SetString( p_libvlc, "pidfile", "" );
  102. - }
  103. -#endif
  104. -
  105. /* FIXME: could be replaced by using Unix sockets */
  106. #ifdef HAVE_DBUS
  107. @@ -511,18 +475,6 @@ void libvlc_InternalCleanup( libvlc_int_t *p_libvlc )
  108. }
  109. #endif
  110. -#if !defined( _WIN32 ) && !defined( __OS2__ )
  111. - char *pidfile = var_InheritString( p_libvlc, "pidfile" );
  112. - if( pidfile != NULL )
  113. - {
  114. - msg_Dbg( p_libvlc, "removing PID file %s", pidfile );
  115. - if( unlink( pidfile ) )
  116. - msg_Warn( p_libvlc, "cannot remove PID file %s: %s",
  117. - pidfile, vlc_strerror_c(errno) );
  118. - free( pidfile );
  119. - }
  120. -#endif
  121. -
  122. if (priv->parser != NULL)
  123. playlist_preparser_Delete(priv->parser);
  124. --
  125. 2.5.1