Группа :: Система/Основа
Пакет: xinetd
Главная Изменения Спек Патчи Загрузить Bugs and FR
Патч: xinetd-2.3.14-alt-remlock.patch
diff -uprk.orig xinetd-2.3.12.orig/xinetd/init.c xinetd-2.3.12/xinetd/init.c
--- xinetd-2.3.12.orig/xinetd/init.c 2003-08-25 14:17:26 +0400
+++ xinetd-2.3.12/xinetd/init.c 2003-08-25 14:17:36 +0400
@@ -375,6 +375,12 @@ void init_services( void )
if ( stayalive_option == 0 ) {
if ( ps.rws.available_services == 0 )
{
+ if ( remove_lock )
+ {
+ sleep( 5 );
+ unlink( remove_lock );
+ }
+
msg( LOG_CRIT, func, "no services. Exiting..." ) ;
if ( ps.ros.pid_file ) {
unlink(ps.ros.pid_file);
diff -uprk.orig xinetd-2.3.12.orig/xinetd/main.c xinetd-2.3.12/xinetd/main.c
--- xinetd-2.3.12.orig/xinetd/main.c 2003-08-25 14:17:26 +0400
+++ xinetd-2.3.12/xinetd/main.c 2003-08-25 14:17:36 +0400
@@ -25,6 +25,7 @@
#include "xtimer.h"
#include "sensor.h"
#include "xmdns.h"
+#include "options.h"
#ifdef __GNUC__
__attribute__ ((noreturn))
@@ -262,6 +263,9 @@ void quit_program(void)
unlink(ps.ros.pid_file);
}
+ if ( remove_lock )
+ unlink(remove_lock);
+
msg( LOG_WARNING, func, "Exiting..." ) ;
exit( 0 ) ;
}
diff -uprk.orig xinetd-2.3.12.orig/xinetd/options.c xinetd-2.3.12/xinetd/options.c
--- xinetd-2.3.12.orig/xinetd/options.c 2003-06-01 18:14:18 +0400
+++ xinetd-2.3.12/xinetd/options.c 2003-08-25 14:19:52 +0400
@@ -29,6 +29,7 @@ char * syslog_option_arg ;
int logprocs_option ;
unsigned logprocs_option_arg ;
int stayalive_option=0;
+char *remove_lock=NULL;
char *program_name ;
int inetd_compat = 0 ;
int dont_fork = 0;
@@ -85,6 +86,16 @@ int opt_recognize( int argc, char *argv[
usage () ;
ps.ros.pid_file = (char *)new_string( argv[arg] );
}
+ else if ( strcmp( &argv[ arg ][ 1 ], "remlock" ) == 0)
+ {
+ extern const char *__progname;
+ unsigned len = strlen( __progname );
+ const char cbuf[] = "/var/lock/subsys/";
+ char buf[ sizeof(cbuf) + len ];
+ memcpy( buf, cbuf, sizeof(cbuf) - 1 );
+ memcpy( buf + sizeof(cbuf) - 1, __progname, len + 1 );
+ remove_lock = (char *)strdup( buf );
+ }
else if ( strcmp( &argv[ arg ][ 1 ], "stayalive" )==0)
stayalive_option = 1;
else if ( strcmp( &argv[ arg ][ 1 ], "dontfork" )==0) {
diff -uprk.orig xinetd-2.3.12.orig/xinetd/options.h xinetd-2.3.12/xinetd/options.h
--- xinetd-2.3.12.orig/xinetd/options.h 2003-05-29 04:56:19 +0400
+++ xinetd-2.3.12/xinetd/options.h 2003-08-25 14:20:26 +0400
@@ -18,6 +18,7 @@ extern int logprocs_option;
extern unsigned logprocs_option_arg;
extern int stayalive_option;
extern char *program_name;
+extern char *remove_lock;
extern int dont_fork;
int opt_recognize(int argc,char *argv[]);
diff -uprk.orig xinetd-2.3.12.orig/xinetd/reconfig.c xinetd-2.3.12/xinetd/reconfig.c
--- xinetd-2.3.12.orig/xinetd/reconfig.c 2003-06-25 02:08:31 +0400
+++ xinetd-2.3.12/xinetd/reconfig.c 2003-08-25 14:17:36 +0400
@@ -162,6 +162,9 @@ void hard_reconfig( void )
if ( stayalive_option == 0 ) {
if ( ps.rws.available_services == 0 )
{
+ if( remove_lock )
+ unlink(remove_lock);
+
msg( LOG_CRIT, func, "No available services. Exiting" );
if ( ps.ros.pid_file ) {
unlink(ps.ros.pid_file);
diff -uprk.orig xinetd-2.3.12.orig/xinetd/xinetd.man xinetd-2.3.12/xinetd/xinetd.man
--- xinetd-2.3.12.orig/xinetd/xinetd.man 2003-05-30 19:10:57 +0400
+++ xinetd-2.3.12/xinetd/xinetd.man 2003-08-25 14:17:36 +0400
@@ -88,6 +88,9 @@ support being run from init or daemontoo
.BI \-stayalive
Tells xinetd to stay running even if no services are specified.
.TP
+.BI \-remlock
+Tells xinetd to remove lockfile (/var/lock/subsys/xinetd by default) on exit.
+.TP
.BI \-limit " proc_limit"
This option places a limit on the number of concurrently running processes
that can be started by