mirror of
https://github.com/gigablast/open-source-search-engine.git
synced 2024-10-04 12:17:35 +03:00
Merge branch 'master' into diffbot
This commit is contained in:
commit
e909b85638
4
Makefile
4
Makefile
@ -89,8 +89,8 @@ else
|
||||
# trying to use good ole' clone() again because it seems the errno location
|
||||
# thing is fixed by just ignoring it.
|
||||
#
|
||||
CPPFLAGS = -m32 -g -Wall -pipe -Wno-write-strings -Wstrict-aliasing=0 -Wno-uninitialized -static -Wno-unused-but-set-variable
|
||||
LIBS= -L. ./libz.a ./libssl.a ./libcrypto.a ./libiconv.a ./libm.a ./libstdc++.a
|
||||
CPPFLAGS = -m32 -g -Wall -pipe -Wno-write-strings -Wstrict-aliasing=0 -Wno-uninitialized -static -D_PTHREADS_ -Wno-unused-but-set-variable
|
||||
LIBS= -L. ./libz.a ./libssl.a ./libcrypto.a ./libiconv.a ./libm.a ./libstdc++.a -lpthread
|
||||
endif
|
||||
|
||||
# if you have seo.cpp link that in. This is not part of the open source
|
||||
|
16
Threads.cpp
16
Threads.cpp
@ -95,9 +95,9 @@ static long s_badPid = -1;
|
||||
|
||||
#ifndef PTHREADS
|
||||
|
||||
//static int s_errno ;
|
||||
//static int s_errnos [ MAX_PID + 1 ];
|
||||
/*
|
||||
static int s_errno ;
|
||||
static int s_errnos [ MAX_PID + 1 ];
|
||||
|
||||
// this was improvised from linuxthreads/errno.c
|
||||
//#define CURRENT_STACK_FRAME ({ char __csf; &__csf; })
|
||||
// WARNING: you MUST compile with -DREENTRANT for this to work
|
||||
@ -109,7 +109,7 @@ int *__errno_location (void) {
|
||||
s_badPid = pid;
|
||||
return &s_errno;
|
||||
}
|
||||
*/
|
||||
|
||||
#endif
|
||||
|
||||
// this also limit the maximum number of outstanding (live) threads
|
||||
@ -875,9 +875,6 @@ bool ThreadQueue::timedCleanUp ( long maxNiceness ) {
|
||||
#ifndef PTHREADS
|
||||
// MDW: i hafta take this out because the errno_location thing
|
||||
// is not working on the newer gcc
|
||||
/*
|
||||
i am just using straight out errno. it seems different
|
||||
for each thread now.
|
||||
if ( ! t->m_isDone && t->m_pid >= 0 &&
|
||||
s_errnos [t->m_pid] == 0x7fffffff ) {
|
||||
log("thread: Got abnormal thread termination. Seems "
|
||||
@ -885,7 +882,6 @@ bool ThreadQueue::timedCleanUp ( long maxNiceness ) {
|
||||
s_errnos[t->m_pid] = 0;
|
||||
goto again;
|
||||
}
|
||||
*/
|
||||
#endif
|
||||
// skip if not done yet
|
||||
if ( ! t->m_isDone ) continue;
|
||||
@ -1213,9 +1209,6 @@ bool ThreadQueue::cleanUp ( ThreadEntry *tt , long maxNiceness ) {
|
||||
#ifndef PTHREADS
|
||||
// MDW: i hafta take this out because the errno_location thing
|
||||
// is not working on the newer gcc
|
||||
/*
|
||||
i am just using straight out errno. it seems different
|
||||
for each thread now.
|
||||
if ( ! t->m_isDone && t->m_pid >= 0 &&
|
||||
s_errnos [t->m_pid] == 0x7fffffff ) {
|
||||
log("thread: Got abnormal thread termination. Seems "
|
||||
@ -1223,7 +1216,6 @@ bool ThreadQueue::cleanUp ( ThreadEntry *tt , long maxNiceness ) {
|
||||
s_errnos[t->m_pid] = 0;
|
||||
goto again;
|
||||
}
|
||||
*/
|
||||
#endif
|
||||
// skip if not done yet
|
||||
if ( ! t->m_isDone ) continue;
|
||||
|
66
errnotest.cpp
Normal file
66
errnotest.cpp
Normal file
@ -0,0 +1,66 @@
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/wait.h>
|
||||
#include <errno.h>
|
||||
#include <sched.h>
|
||||
#include <unistd.h>
|
||||
#include <assert.h>
|
||||
|
||||
static int s_called = 0;
|
||||
|
||||
#define MAX_PID 32767
|
||||
static int s_errno ;
|
||||
static int s_errnos [ MAX_PID + 1 ];
|
||||
|
||||
static long s_bad = 0;
|
||||
static long s_badPid = -1;
|
||||
|
||||
// WARNING: you MUST compile with -DREENTRANT for this to work
|
||||
int *__errno_location (void) {
|
||||
long pid = (long) getpid();
|
||||
s_called++;
|
||||
if ( pid <= (long)MAX_PID ) return &s_errnos[pid];
|
||||
s_bad++;
|
||||
s_badPid = pid;
|
||||
return &s_errno;
|
||||
}
|
||||
|
||||
//extern __thread int errno;
|
||||
|
||||
int g_errno = 0;
|
||||
|
||||
int startup ( void *state ) {
|
||||
char buf[5];
|
||||
// this sets errno, but does not seem to call our __errno_location
|
||||
// override, BUT does seem to not affect "errno" in main() either!
|
||||
// maybe this is the TLS support?
|
||||
int bytes = read(-9,buf,5);
|
||||
//errno = 7; // E2BIG;
|
||||
//assert ( errno && bytes == -1 );
|
||||
g_errno = errno;
|
||||
}
|
||||
|
||||
|
||||
int main() {
|
||||
errno = 10; // EINVAL;
|
||||
g_errno = 10;
|
||||
char stack[10000];
|
||||
pid_t pid = clone( startup ,
|
||||
stack + 10000 ,
|
||||
//CLONE_SETTLS |
|
||||
CLONE_VM | SIGCHLD,
|
||||
NULL );
|
||||
int status;
|
||||
waitpid ( pid , &status, 0 );
|
||||
|
||||
if ( s_called ) fprintf(stderr,"__errno_location() was called %i "
|
||||
"times\n",s_called);
|
||||
|
||||
if ( errno != 10 ) fprintf(stderr,"errno=%i (failed)\n",errno);
|
||||
else fprintf(stderr,"errno=%i (success)\n",errno);
|
||||
|
||||
if ( g_errno == 10 || g_errno == 0 )
|
||||
fprintf(stderr,"gerrno=%i (failed)\n",g_errno);
|
||||
else
|
||||
fprintf(stderr,"gerrno=%i (success)\n",g_errno);
|
||||
}
|
78
main.cpp
78
main.cpp
@ -3470,15 +3470,15 @@ int collcopy ( char *newHostsConf , char *coll , long collnum ) {
|
||||
// get the src host from the provided hosts.conf
|
||||
Host *h2 = &hdb.m_hosts[i];
|
||||
// print the copy
|
||||
//fprintf(stderr,"scp %s:%s*db*.dat* ",
|
||||
//fprintf(stderr,"rcp %s:%s*db*.dat* ",
|
||||
// iptoa( h->m_ip), h->m_dir );
|
||||
fprintf(stderr,"nohup ssh %s '",iptoa(h->m_ip));
|
||||
fprintf(stderr,"scp -pr ");
|
||||
fprintf(stderr,"rcp -pr ");
|
||||
fprintf(stderr,"%s:%scoll.%s.%li ",
|
||||
iptoa(h2->m_ip), h2->m_dir , coll, collnum );
|
||||
fprintf(stderr,"%s' &\n", h->m_dir );
|
||||
//fprintf(stderr," scp -p %s*.map* ", h->m_dir );
|
||||
//fprintf(stderr," scp -r %scoll.* ", h->m_dir );
|
||||
//fprintf(stderr," rcp -p %s*.map* ", h->m_dir );
|
||||
//fprintf(stderr," rcp -r %scoll.* ", h->m_dir );
|
||||
//fprintf(stderr,"%s:%s " ,iptoa(h2->m_ip), h2->m_dir );
|
||||
}
|
||||
return 1;
|
||||
@ -3720,10 +3720,10 @@ int scale ( char *newHostsConf , bool useShotgunIp) {
|
||||
// flag
|
||||
flag = 1;
|
||||
// print the copy
|
||||
//fprintf(stderr,"scp %s:%s*db*.dat* ",
|
||||
//fprintf(stderr,"rcp %s:%s*db*.dat* ",
|
||||
// iptoa( h->m_ip), h->m_dir );
|
||||
// if same ip then do a 'cp' not scp
|
||||
char *cmd = "scp -pr";
|
||||
// if same ip then do a 'cp' not rcp
|
||||
char *cmd = "rcp -pr";
|
||||
if ( h->m_ip == h2->m_ip ) cmd = "cp -pr";
|
||||
|
||||
fprintf(stderr,"%s %s*db*.dat* ", cmd, h->m_dir );
|
||||
@ -3740,7 +3740,7 @@ int scale ( char *newHostsConf , bool useShotgunIp) {
|
||||
|
||||
}
|
||||
|
||||
//fprintf(stderr," scp -p %s*.map* ", h->m_dir );
|
||||
//fprintf(stderr," rcp -p %s*.map* ", h->m_dir );
|
||||
fprintf(stderr," %s %scoll.* ", cmd, h->m_dir );
|
||||
|
||||
if ( h->m_ip == h2->m_ip )
|
||||
@ -4085,7 +4085,7 @@ int install ( install_flag_konst_t installFlag , long hostId , char *dir ,
|
||||
// don't copy to ourselves
|
||||
//if ( h2->m_hostId == h->m_hostId ) continue;
|
||||
sprintf(tmp,
|
||||
"scp -pr "
|
||||
"rcp -pr "
|
||||
"%sgb "
|
||||
//"%sgbfilter "
|
||||
"%shosts.conf "
|
||||
@ -4168,7 +4168,7 @@ int install ( install_flag_konst_t installFlag , long hostId , char *dir ,
|
||||
log(LOG_INIT,"admin: %s", tmp);
|
||||
system ( tmp );
|
||||
sprintf(tmp,
|
||||
"scp %sgb.conf %s:%sgb.conf",
|
||||
"rcp %sgb.conf %s:%sgb.conf",
|
||||
dir ,
|
||||
//h->m_hostId ,
|
||||
iptoa(h2->m_ip),
|
||||
@ -4181,7 +4181,7 @@ int install ( install_flag_konst_t installFlag , long hostId , char *dir ,
|
||||
// don't copy to ourselves
|
||||
//if ( h2->m_hostId == h->m_hostId ) continue;
|
||||
sprintf(tmp,
|
||||
"scp -pr "
|
||||
"rcp -pr "
|
||||
"%sgb "
|
||||
//"%sgbfilter "
|
||||
"%shosts.conf "
|
||||
@ -4229,7 +4229,7 @@ int install ( install_flag_konst_t installFlag , long hostId , char *dir ,
|
||||
log(LOG_INIT,"admin: %s", tmp);
|
||||
system ( tmp );
|
||||
sprintf(tmp,
|
||||
"scp %sgb.conf %s:%sgb.conf",
|
||||
"rcp %sgb.conf %s:%sgb.conf",
|
||||
dir ,
|
||||
//h->m_hostId ,
|
||||
//iptoa(h2->m_ip),
|
||||
@ -4243,7 +4243,7 @@ int install ( install_flag_konst_t installFlag , long hostId , char *dir ,
|
||||
// don't copy to ourselves
|
||||
//if ( h2->m_hostId == h->m_hostId ) continue;
|
||||
sprintf(tmp,
|
||||
"scp "
|
||||
"rcp "
|
||||
"%sgb.new "
|
||||
"%s:%s/gb.installed &",
|
||||
dir,
|
||||
@ -4256,7 +4256,7 @@ int install ( install_flag_konst_t installFlag , long hostId , char *dir ,
|
||||
// don't copy to ourselves
|
||||
//if ( h2->m_hostId == h->m_hostId ) continue;
|
||||
sprintf(tmp,
|
||||
"scp "
|
||||
"rcp "
|
||||
"%sgb.new "
|
||||
"%s:%s/tmpgb.installed &",
|
||||
dir,
|
||||
@ -4269,7 +4269,7 @@ int install ( install_flag_konst_t installFlag , long hostId , char *dir ,
|
||||
// don't copy to ourselves
|
||||
//if ( h2->m_hostId == h->m_hostId ) continue;
|
||||
sprintf(tmp,
|
||||
"scp %sgb.conf %s:%sgb.conf &",
|
||||
"rcp %sgb.conf %s:%sgb.conf &",
|
||||
dir ,
|
||||
//h->m_hostId ,
|
||||
iptoa(h2->m_ip),
|
||||
@ -4278,14 +4278,14 @@ int install ( install_flag_konst_t installFlag , long hostId , char *dir ,
|
||||
log(LOG_INIT,"admin: %s", tmp);
|
||||
system ( tmp );
|
||||
sprintf(tmp,
|
||||
"scp %shosts.conf %s:%shosts.conf &",
|
||||
"rcp %shosts.conf %s:%shosts.conf &",
|
||||
dir ,
|
||||
iptoa(h2->m_ip),
|
||||
h2->m_dir);
|
||||
log(LOG_INIT,"admin: %s", tmp);
|
||||
system ( tmp );
|
||||
sprintf(tmp,
|
||||
"scp %shosts2.conf %s:%shosts2.conf &",
|
||||
"rcp %shosts2.conf %s:%shosts2.conf &",
|
||||
dir ,
|
||||
iptoa(h2->m_ip),
|
||||
h2->m_dir);
|
||||
@ -4512,7 +4512,7 @@ int install ( install_flag_konst_t installFlag , long hostId , char *dir ,
|
||||
// don't copy to ourselves
|
||||
if ( h2->m_hostId == 0 ) continue;
|
||||
sprintf(tmp,
|
||||
"scp "
|
||||
"rcp "
|
||||
"%scatdb/content.rdf.u8 "
|
||||
"%s:%scatdb/content.rdf.u8",
|
||||
dir,
|
||||
@ -4521,7 +4521,7 @@ int install ( install_flag_konst_t installFlag , long hostId , char *dir ,
|
||||
log(LOG_INIT,"admin: %s", tmp);
|
||||
system ( tmp );
|
||||
sprintf(tmp,
|
||||
"scp "
|
||||
"rcp "
|
||||
"%scatdb/structure.rdf.u8 "
|
||||
"%s:%scatdb/structure.rdf.u8",
|
||||
dir,
|
||||
@ -4530,7 +4530,7 @@ int install ( install_flag_konst_t installFlag , long hostId , char *dir ,
|
||||
log(LOG_INIT,"admin: %s", tmp);
|
||||
system ( tmp );
|
||||
sprintf(tmp,
|
||||
"scp "
|
||||
"rcp "
|
||||
"%scatdb/gbdmoz.structure.dat "
|
||||
"%s:%scatdb/gbdmoz.structure.dat",
|
||||
dir,
|
||||
@ -4539,7 +4539,7 @@ int install ( install_flag_konst_t installFlag , long hostId , char *dir ,
|
||||
log(LOG_INIT,"admin: %s", tmp);
|
||||
system ( tmp );
|
||||
sprintf(tmp,
|
||||
"scp "
|
||||
"rcp "
|
||||
"%scatdb/gbdmoz.content.dat "
|
||||
"%s:%scatdb/gbdmoz.content.dat",
|
||||
dir,
|
||||
@ -4548,7 +4548,7 @@ int install ( install_flag_konst_t installFlag , long hostId , char *dir ,
|
||||
log(LOG_INIT,"admin: %s", tmp);
|
||||
//system ( tmp );
|
||||
//sprintf(tmp,
|
||||
// "scp "
|
||||
// "rcp "
|
||||
// "%scatdb/gbdmoz.content.dat.diff "
|
||||
// "%s:%scatdb/gbdmoz.content.dat.diff",
|
||||
// dir,
|
||||
@ -4562,7 +4562,7 @@ int install ( install_flag_konst_t installFlag , long hostId , char *dir ,
|
||||
// don't copy to ourselves
|
||||
if ( h2->m_hostId == 0 ) continue;
|
||||
sprintf(tmp,
|
||||
"scp "
|
||||
"rcp "
|
||||
"%scatdb/content.rdf.u8.new "
|
||||
"%s:%scatdb/content.rdf.u8.new",
|
||||
dir,
|
||||
@ -4571,7 +4571,7 @@ int install ( install_flag_konst_t installFlag , long hostId , char *dir ,
|
||||
log(LOG_INIT,"admin: %s", tmp);
|
||||
system ( tmp );
|
||||
sprintf(tmp,
|
||||
"scp "
|
||||
"rcp "
|
||||
"%scatdb/structure.rdf.u8.new "
|
||||
"%s:%scatdb/structure.rdf.u8.new",
|
||||
dir,
|
||||
@ -4580,7 +4580,7 @@ int install ( install_flag_konst_t installFlag , long hostId , char *dir ,
|
||||
log(LOG_INIT,"admin: %s", tmp);
|
||||
system ( tmp );
|
||||
sprintf(tmp,
|
||||
"scp "
|
||||
"rcp "
|
||||
"%scatdb/gbdmoz.structure.dat.new "
|
||||
"%s:%scatdb/gbdmoz.structure.dat.new",
|
||||
dir,
|
||||
@ -4589,7 +4589,7 @@ int install ( install_flag_konst_t installFlag , long hostId , char *dir ,
|
||||
log(LOG_INIT,"admin: %s", tmp);
|
||||
system ( tmp );
|
||||
sprintf(tmp,
|
||||
"scp "
|
||||
"rcp "
|
||||
"%scatdb/gbdmoz.content.dat.new "
|
||||
"%s:%scatdb/gbdmoz.content.dat.new",
|
||||
dir,
|
||||
@ -4598,7 +4598,7 @@ int install ( install_flag_konst_t installFlag , long hostId , char *dir ,
|
||||
log(LOG_INIT,"admin: %s", tmp);
|
||||
system ( tmp );
|
||||
sprintf(tmp,
|
||||
"scp "
|
||||
"rcp "
|
||||
"%scatdb/gbdmoz.content.dat.new.diff "
|
||||
"%s:%scatdb/gbdmoz.content.dat.new.diff",
|
||||
dir,
|
||||
@ -4641,7 +4641,7 @@ int install ( install_flag_konst_t installFlag , long hostId , char *dir ,
|
||||
// don't copy to ourselves
|
||||
//if ( h2->m_hostId == h->m_hostId ) continue;
|
||||
sprintf(tmp,
|
||||
"scp "
|
||||
"rcp "
|
||||
"%sgb.new "
|
||||
"%s:%s/gb.installed &",
|
||||
dir,
|
||||
@ -4677,7 +4677,7 @@ int install ( install_flag_konst_t installFlag , long hostId , char *dir ,
|
||||
// don't copy to ourselves
|
||||
//if ( h2->m_hostId == h->m_hostId ) continue;
|
||||
sprintf(tmp,
|
||||
"scp %sgb.conf %shosts.conf %shosts2.conf "
|
||||
"rcp %sgb.conf %shosts.conf %shosts2.conf "
|
||||
"%s:%s &",
|
||||
dir ,
|
||||
dir ,
|
||||
@ -4695,7 +4695,7 @@ int install ( install_flag_konst_t installFlag , long hostId , char *dir ,
|
||||
// don't copy to ourselves
|
||||
if ( h2->m_hostId == 0 ) continue;
|
||||
sprintf(tmp,
|
||||
"scp "
|
||||
"rcp "
|
||||
"%scatdb/content.rdf.u8 "
|
||||
"%s:%scatdb/content.rdf.u8",
|
||||
dir,
|
||||
@ -4704,7 +4704,7 @@ int install ( install_flag_konst_t installFlag , long hostId , char *dir ,
|
||||
log(LOG_INIT,"admin: %s", tmp);
|
||||
system ( tmp );
|
||||
sprintf(tmp,
|
||||
"scp "
|
||||
"rcp "
|
||||
"%scatdb/structure.rdf.u8 "
|
||||
"%s:%scatdb/structure.rdf.u8",
|
||||
dir,
|
||||
@ -4713,7 +4713,7 @@ int install ( install_flag_konst_t installFlag , long hostId , char *dir ,
|
||||
log(LOG_INIT,"admin: %s", tmp);
|
||||
system ( tmp );
|
||||
sprintf(tmp,
|
||||
"scp "
|
||||
"rcp "
|
||||
"%scatdb/gbdmoz.structure.dat "
|
||||
"%s:%scatdb/gbdmoz.structure.dat",
|
||||
dir,
|
||||
@ -4722,7 +4722,7 @@ int install ( install_flag_konst_t installFlag , long hostId , char *dir ,
|
||||
log(LOG_INIT,"admin: %s", tmp);
|
||||
system ( tmp );
|
||||
sprintf(tmp,
|
||||
"scp "
|
||||
"rcp "
|
||||
"%scatdb/gbdmoz.content.dat "
|
||||
"%s:%scatdb/gbdmoz.content.dat",
|
||||
dir,
|
||||
@ -4731,7 +4731,7 @@ int install ( install_flag_konst_t installFlag , long hostId , char *dir ,
|
||||
log(LOG_INIT,"admin: %s", tmp);
|
||||
//system ( tmp );
|
||||
//sprintf(tmp,
|
||||
// "scp "
|
||||
// "rcp "
|
||||
// "%scatdb/gbdmoz.content.dat.diff "
|
||||
// "%s:%scatdb/gbdmoz.content.dat.diff",
|
||||
// dir,
|
||||
@ -4746,7 +4746,7 @@ int install ( install_flag_konst_t installFlag , long hostId , char *dir ,
|
||||
// don't copy to ourselves
|
||||
if ( h2->m_hostId == 0 ) continue;
|
||||
sprintf(tmp,
|
||||
"scp "
|
||||
"rcp "
|
||||
"%scatdb/content.rdf.u8.new "
|
||||
"%s:%scatdb/content.rdf.u8.new",
|
||||
dir,
|
||||
@ -4755,7 +4755,7 @@ int install ( install_flag_konst_t installFlag , long hostId , char *dir ,
|
||||
log(LOG_INIT,"admin: %s", tmp);
|
||||
system ( tmp );
|
||||
sprintf(tmp,
|
||||
"scp "
|
||||
"rcp "
|
||||
"%scatdb/structure.rdf.u8.new "
|
||||
"%s:%scatdb/structure.rdf.u8.new",
|
||||
dir,
|
||||
@ -4764,7 +4764,7 @@ int install ( install_flag_konst_t installFlag , long hostId , char *dir ,
|
||||
log(LOG_INIT,"admin: %s", tmp);
|
||||
system ( tmp );
|
||||
sprintf(tmp,
|
||||
"scp "
|
||||
"rcp "
|
||||
"%scatdb/gbdmoz.structure.dat.new "
|
||||
"%s:%scatdb/gbdmoz.structure.dat.new",
|
||||
dir,
|
||||
@ -4773,7 +4773,7 @@ int install ( install_flag_konst_t installFlag , long hostId , char *dir ,
|
||||
log(LOG_INIT,"admin: %s", tmp);
|
||||
system ( tmp );
|
||||
sprintf(tmp,
|
||||
"scp "
|
||||
"rcp "
|
||||
"%scatdb/gbdmoz.content.dat.new "
|
||||
"%s:%scatdb/gbdmoz.content.dat.new",
|
||||
dir,
|
||||
@ -4782,7 +4782,7 @@ int install ( install_flag_konst_t installFlag , long hostId , char *dir ,
|
||||
log(LOG_INIT,"admin: %s", tmp);
|
||||
system ( tmp );
|
||||
sprintf(tmp,
|
||||
"scp "
|
||||
"rcp "
|
||||
"%scatdb/gbdmoz.content.dat.new.diff "
|
||||
"%s:%scatdb/gbdmoz.content.dat.new.diff",
|
||||
dir,
|
||||
|
Loading…
Reference in New Issue
Block a user