return false;
}
- if (fds[0].revents == POLLIN)
+ if (fds[0].revents & POLLIN)
{
ssize_t read_length;
char buffer[1024]= { 0 };
}
}
- if (fds[1].revents == POLLIN)
+ if (fds[1].revents & POLLIN)
{
+ stderr_fd.nonblock();
+
ssize_t read_length;
char buffer[1024]= { 0 };
while ((read_length= ::read(stderr_fd.fd()[0], buffer, sizeof(buffer))))
return _username;
}
+ bool wait_for_pidfile() const
+ {
+ Wait wait(pid(), 4);
+
+ return wait.successful();
+ }
+
pid_t get_pid(bool error_is_ok)
{
// Memcached is slow to start, so we need to do this
- if (pid_file().empty() == false)
+ if (error_is_ok and
+ wait_for_pidfile() == false)
{
- if (error_is_ok and
- wait_for_pidfile() == false)
- {
- Error << "Pidfile was not found:" << pid_file();
- return -1;
- }
+ Error << "Pidfile was not found:" << pid_file();
+ return -1;
}
pid_t local_pid;
bool ping()
{
+#if 0
// Memcached is slow to start, so we need to do this
if (pid_file().empty() == false)
{
if (wait_for_pidfile() == false)
{
- Error << "Pidfile was not found:" << pid_file();
+ Error << "Pidfile was not found:" << pid_file() << " :" << running();
return -1;
}
}
+#endif
memcached_return_t rc;
bool ret;
return (_pid > 1);
}
- bool wait_for_pidfile() const;
+ virtual bool wait_for_pidfile() const;
bool check_pid(pid_t pid_arg) const
{
}
break;
+ case 0:
+ Error << "Inside of gdb?";
+ break;
+
default:
Error << "Signal handling thread got unexpected signal " << strsignal(sig);
break;
const char *args[]= { "--fubar", 0 };
#if defined(TARGET_OS_OSX) && TARGET_OS_OSX
test_compare(Application::INVALID, true_app.run(args));
- test_compare(Application::FAILURE, true_app.wait());
#else
test_compare(Application::SUCCESS, true_app.run(args));
test_compare(Application::INVALID, true_app.wait());
#include <unistd.h>
#include <string>
+#include <signal.h>
#include <libtest/dream.h>
}
}
+ Wait(const pid_t &_pid_arg, uint32_t timeout= 6) :
+ _successful(false)
+ {
+ uint32_t waited;
+ uint32_t this_wait;
+ uint32_t retry;
+
+ for (waited= 0, retry= 1; ; retry++, waited+= this_wait)
+ {
+ if (kill(_pid_arg, 0) == 0)
+ {
+ _successful= true;
+ break;
+ }
+ else if (waited >= timeout)
+ {
+ break;
+ }
+
+ this_wait= retry * retry / 3 + 1;
+ libtest::dream(this_wait, 0);
+ }
+ }
+
bool successful() const
{
return _successful;
stop_assoc_maintenance_thread();
/* remove the PID file if we're a daemon */
+#if 0
if (do_daemonize)
remove_pidfile(pid_file);
+#endif
/* Clean up strdup() call for bind() address */
if (settings.inter)
free(settings.inter);
pahole-mem: tests/testapp
@$(PAHOLE_COMMAND) tests/testapp
-gdb-mem: tests/var tests/libmemcached-1.0/testapp
+gdb-mem: tests/libmemcached-1.0/testapp
@$(DEBUG_COMMAND) tests/libmemcached-1.0/testapp
gdb-sasl: tests/sasl