Репозитории ALT
S: | 2.3.15-alt6 |
5.1: | 2.3.14-alt3 |
4.1: | 2.3.14-alt3 |
4.0: | 2.3.14-alt2 |
3.0: | 2.3.13-alt4 |
Группа :: Система/Основа
Пакет: xinetd
Главная Изменения Спек Патчи Sources Загрузить Gear Bugs and FR Repocop
Патч: xinetd-2.3.15-alt-remlock.patch
Скачать
Скачать
--- xinetd/xinetd/init.c
+++ xinetd/xinetd/init.c
@@ -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);
--- xinetd/xinetd/main.c
+++ xinetd/xinetd/main.c
@@ -25,6 +25,7 @@
#include "xtimer.h"
#include "sensor.h"
#include "xmdns.h"
+#include "options.h"
#ifdef __GNUC__
__attribute__ ((noreturn))
@@ -283,6 +284,9 @@ void quit_program(void)
unlink(ps.ros.pid_file);
}
+ if ( remove_lock )
+ unlink(remove_lock);
+
msg( LOG_WARNING, func, "Exiting..." ) ;
exit( 0 ) ;
}
--- xinetd/xinetd/options.c
+++ xinetd/xinetd/options.c
@@ -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;
@@ -89,6 +90,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) {
--- xinetd/xinetd/options.h
+++ xinetd/xinetd/options.h
@@ -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[]);
--- xinetd/xinetd/reconfig.c
+++ xinetd/xinetd/reconfig.c
@@ -179,6 +179,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);
--- xinetd/xinetd/xinetd.man
+++ xinetd/xinetd/xinetd.man
@@ -88,6 +88,9 @@ support being run from init or daemontools. This option automatically sets
.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