mirror of
https://github.com/gigablast/open-source-search-engine.git
synced 2024-10-04 20:27:43 +03:00
Merge branch 'testing' into diffbot-testing
Conflicts: Makefile
This commit is contained in:
commit
bc6c6b3ab7
@ -28,7 +28,10 @@ ssize_t gbpwrite(int fd, const void *buf, size_t count, off_t offset);
|
||||
//#define MAX_PART_FILES 100
|
||||
|
||||
// use this state class for doing non-blocking reads/writes
|
||||
#ifdef ASYNCIO
|
||||
#include <aio.h> // TODO: use kaio, uses only 4 threads
|
||||
#endif
|
||||
|
||||
class FileState {
|
||||
public:
|
||||
// this is where we go after the thread has exited
|
||||
|
@ -1171,9 +1171,10 @@ int CountryCode::fillRegexTable(void) {
|
||||
log( "init: Country regex: %d: Unknown character class name.", x);
|
||||
break;
|
||||
|
||||
case REG_EEND:
|
||||
log( "init: Country regex: %d: Non specific error.", x);
|
||||
break;
|
||||
// cygwin doesn't like this one
|
||||
// case REG_EEND:
|
||||
// log( "init: Country regex: %d: Non specific error.", x);
|
||||
// break;
|
||||
|
||||
case REG_EESCAPE:
|
||||
log( "init: Country regex: %d: Trailing backslash.", x);
|
||||
@ -1187,9 +1188,10 @@ int CountryCode::fillRegexTable(void) {
|
||||
log( "init: Country regex: %d: Invalid use of the range operator.", x);
|
||||
break;
|
||||
|
||||
case REG_ESIZE:
|
||||
log( "init: Country regex: %d: Compiled regular expression requires a pattern buffer larger than 64Kb.", x);
|
||||
break;
|
||||
// cygwin doesn't like this one
|
||||
// case REG_ESIZE:
|
||||
// log( "init: Country regex: %d: Compiled regular expression requires a pattern buffer larger than 64Kb.", x);
|
||||
// break;
|
||||
|
||||
case REG_ESPACE:
|
||||
log( "init: Country regex: %d: The regex routines ran out of memory.", x);
|
||||
|
@ -10,8 +10,10 @@
|
||||
// types.h uses key_t type that shmget uses
|
||||
#undef key_t
|
||||
|
||||
#ifdef GBUSESHM
|
||||
#include <sys/ipc.h> // shmget()
|
||||
#include <sys/shm.h> // shmget()
|
||||
#endif
|
||||
|
||||
#define OFF_SIZE 0
|
||||
#define OFF_SKIP 4
|
||||
@ -36,8 +38,10 @@ DiskPageCache::~DiskPageCache() {
|
||||
reset();
|
||||
}
|
||||
|
||||
#ifdef GBUSESHM
|
||||
static char *s_mem = NULL;
|
||||
static int s_shmid = -1;
|
||||
#endif
|
||||
|
||||
void DiskPageCache::reset() {
|
||||
if ( m_numPageSets > 0 )
|
||||
@ -60,6 +64,7 @@ void DiskPageCache::reset() {
|
||||
long size = m_maxAvailMemOffs * sizeof(long);
|
||||
mfree ( m_availMemOff , size , "DiskPageCache" );
|
||||
}
|
||||
#ifdef GBUSESHM
|
||||
// free current one, if exists
|
||||
if ( s_shmid >= 0 && s_mem ) {
|
||||
if ( shmdt ( s_mem ) == -1 )
|
||||
@ -76,6 +81,7 @@ void DiskPageCache::reset() {
|
||||
else
|
||||
log("db: shmctl freed shmid=%li",(long)shmid);
|
||||
}
|
||||
#endif
|
||||
m_numPageSets = 0;
|
||||
m_nextMemOff = 0;
|
||||
m_upperMemOff = 0;
|
||||
@ -166,6 +172,8 @@ bool DiskPageCache::init ( const char *dbname ,
|
||||
long max = 33554432/2;
|
||||
// make sure it is "pageSize" aligned so we don't split pages
|
||||
m_maxAllocSize = (max / m_spageSize) * m_spageSize;
|
||||
|
||||
#ifdef GBUSESHM
|
||||
// set it up
|
||||
if ( m_useSHM ) {
|
||||
// we can only use like 30MB shared mem pieces
|
||||
@ -204,6 +212,7 @@ bool DiskPageCache::init ( const char *dbname ,
|
||||
// get more
|
||||
if ( need > 0 ) goto shmloop;
|
||||
}
|
||||
#endif
|
||||
|
||||
// a malloc tag, must be LESS THAN 16 bytes including the NULL
|
||||
char *p = m_memTag;
|
||||
@ -1110,6 +1119,7 @@ bool DiskPageCache::verify ( BigFile *f ) {
|
||||
void DiskPageCache::writeToCache( long bigOff, long smallOff, void *inBuf,
|
||||
long size ){
|
||||
|
||||
#ifdef GBUSESHM
|
||||
if ( m_useSHM ) {
|
||||
// what page are we on?
|
||||
long page = ( bigOff + smallOff ) / m_maxAllocSize;
|
||||
@ -1159,6 +1169,7 @@ void DiskPageCache::writeToCache( long bigOff, long smallOff, void *inBuf,
|
||||
memcpy ( mem + poff , inBuf , size );
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
if ( m_useRAMDisk ){
|
||||
long numBytesWritten = pwrite( m_ramfd, inBuf, size,
|
||||
@ -1175,6 +1186,7 @@ void DiskPageCache::writeToCache( long bigOff, long smallOff, void *inBuf,
|
||||
|
||||
void DiskPageCache::readFromCache( void *outBuf, long bigOff, long smallOff,
|
||||
long size ){
|
||||
#ifdef GBUSESHM
|
||||
if ( m_useSHM ) {
|
||||
// what page are we on?
|
||||
long page = ( bigOff + smallOff ) / m_maxAllocSize;
|
||||
@ -1222,6 +1234,7 @@ void DiskPageCache::readFromCache( void *outBuf, long bigOff, long smallOff,
|
||||
memcpy ( outBuf , mem + poff , size );
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
if ( m_useRAMDisk ) {
|
||||
long numBytesRead = pread( m_ramfd, outBuf, size,
|
||||
@ -1272,6 +1285,7 @@ void freeAllSharedMem ( long max ) {
|
||||
//shmctl ( 0 , SHM_STAT , &buf );
|
||||
//int shmctl(int shmid, int cmd, struct shmid_ds *buf);
|
||||
|
||||
#ifdef GBUSESHM
|
||||
// types.h uses key_t type that shmget uses
|
||||
// try to nuke it all
|
||||
for ( long i = 0 ; i < max ; i++ ) {
|
||||
@ -1284,6 +1298,7 @@ void freeAllSharedMem ( long max ) {
|
||||
else
|
||||
log("db: Removed shmid %li",i);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
// types.h uses key_t type that shmget uses
|
||||
|
5
File.cpp
5
File.cpp
@ -84,7 +84,10 @@ File::~File ( ) {
|
||||
void File::set ( char *dir , char *filename ) {
|
||||
if ( ! dir ) { set ( filename ); return; }
|
||||
char buf[1024];
|
||||
sprintf ( buf , "%s/%s" , dir , filename );
|
||||
if ( dir[gbstrlen(dir)-1] == '/' )
|
||||
snprintf ( buf , 1020, "%s%s" , dir , filename );
|
||||
else
|
||||
snprintf ( buf , 1020, "%s/%s" , dir , filename );
|
||||
set ( buf );
|
||||
}
|
||||
|
||||
|
@ -2127,7 +2127,8 @@ bool Hostdb::syncHost ( long syncHostId, bool useSecondaryIps ) {
|
||||
"host. Aborting." );
|
||||
}
|
||||
|
||||
int my_system_r ( char *cmd , long timeout );
|
||||
// MDW: take out for now
|
||||
//int my_system_r ( char *cmd , long timeout );
|
||||
int startUp ( void *cmd );
|
||||
|
||||
void Hostdb::syncStart_r ( bool amThread ) {
|
||||
@ -2192,6 +2193,8 @@ void Hostdb::syncStart_r ( bool amThread ) {
|
||||
m_syncHost->m_dir );
|
||||
|
||||
log ( LOG_INFO, "init: %s", cmd );
|
||||
/*
|
||||
MDW: take out for now
|
||||
int err = my_system_r ( cmd, 3600*24 );
|
||||
if ( err != 0 ) {
|
||||
log ( "conf: Call to system(\"%s\") had error %s.", cmd ,
|
||||
@ -2200,6 +2203,7 @@ void Hostdb::syncStart_r ( bool amThread ) {
|
||||
m_syncHost = NULL;
|
||||
return;
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
void Hostdb::syncDone ( ) {
|
||||
|
8
Loop.cpp
8
Loop.cpp
@ -1633,6 +1633,12 @@ void sigHandlerRT ( int x , siginfo_t *info , void *v ) {
|
||||
|
||||
// come here when we get a GB_SIGRTMIN+X signal
|
||||
void sigHandler_r ( int x , siginfo_t *info , void *v ) {
|
||||
|
||||
// cygwin lacks the si_fd and si_band members
|
||||
#ifdef CYGWIN
|
||||
g_loop.doPoll();
|
||||
#else
|
||||
|
||||
// extract the file descriptor that needs attention
|
||||
int fd = info->si_fd;
|
||||
// debug note
|
||||
@ -1735,6 +1741,8 @@ void sigHandler_r ( int x , siginfo_t *info , void *v ) {
|
||||
g_errno = ESOCKETCLOSED;
|
||||
g_loop.callCallbacks_ass ( false , fd );
|
||||
}
|
||||
// end ifdef CYGWIN
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
307
Makefile
307
Makefile
@ -64,7 +64,7 @@ OBJS = UdpSlot.o Rebalance.o \
|
||||
|
||||
CHECKFORMATSTRING = -D_CHECK_FORMAT_STRING_
|
||||
|
||||
DEFS = -D_REENTRANT_ $(CHECKFORMATSTRING) -I. -Ibits
|
||||
DEFS = -D_REENTRANT_ $(CHECKFORMATSTRING) -I.
|
||||
|
||||
HOST=$(shell hostname)
|
||||
|
||||
@ -92,6 +92,10 @@ else
|
||||
#
|
||||
CPPFLAGS = -m32 -g -Wall -pipe -Wno-write-strings -Wstrict-aliasing=0 -Wno-uninitialized -static -DPTHREADS -Wno-unused-but-set-variable
|
||||
LIBS= -L. ./libz.a ./libssl.a ./libcrypto.a ./libiconv.a ./libm.a ./libstdc++.a -lpthread
|
||||
# use this for compiling on CYGWIN: (only for 32bit cygwin right now and
|
||||
# you have to install the packages that have these libs.
|
||||
#LIBS= -lz -lm -lpthread -lssl -lcrypto -iconv -lz
|
||||
|
||||
endif
|
||||
|
||||
# if you have seo.cpp link that in. This is not part of the open source
|
||||
@ -118,10 +122,10 @@ g8: gb
|
||||
scp gb g8:/p/gb.new
|
||||
ssh g8 'cd /p/ ; ./gb stop ; ./gb installgb ; sleep 4 ; ./gb start'
|
||||
|
||||
utils: addtest blaster dump hashtest makeclusterdb makespiderdb membustest monitor seektest urlinfo treetest dnstest dmozparse gbtitletest
|
||||
utils: addtest blaster2 dump hashtest makeclusterdb makespiderdb membustest monitor seektest urlinfo treetest dnstest dmozparse gbtitletest
|
||||
|
||||
gb: $(OBJS) main.o $(LIBFILES)
|
||||
$(CC) $(DEFS) $(CPPFLAGS) -o $@ main.o $(OBJS) $(LIBS)
|
||||
$(CC) $(DEFS) $(DEFS2) $(CPPFLAGS) -o $@ main.o $(OBJS) $(LIBS)
|
||||
|
||||
|
||||
#iana_charset.cpp: parse_iana_charsets.pl character-sets supported_charsets.txt
|
||||
@ -134,23 +138,23 @@ run_parser: test_parser
|
||||
./test_parser ~/turkish.html
|
||||
|
||||
test_parser: $(OBJS) test_parser.o Makefile
|
||||
g++ $(DEFS) $(CPPFLAGS) -o $@ test_parser.o $(OBJS) $(LIBS)
|
||||
g++ $(DEFS) $(DEFS2) $(CPPFLAGS) -o $@ test_parser.o $(OBJS) $(LIBS)
|
||||
test_parser2: $(OBJS) test_parser2.o Makefile
|
||||
g++ $(DEFS) $(CPPFLAGS) -o $@ test_parser2.o $(OBJS) $(LIBS)
|
||||
g++ $(DEFS) $(DEFS2) $(CPPFLAGS) -o $@ test_parser2.o $(OBJS) $(LIBS)
|
||||
|
||||
test_hash: test_hash.o $(OBJS)
|
||||
g++ $(DEFS) $(CPPFLAGS) -o $@ test_hash.o $(OBJS) $(LIBS)
|
||||
g++ $(DEFS) $(DEFS2) $(CPPFLAGS) -o $@ test_hash.o $(OBJS) $(LIBS)
|
||||
test_norm: $(OBJS) test_norm.o
|
||||
g++ $(DEFS) $(CPPFLAGS) -o $@ test_norm.o $(OBJS) $(LIBS)
|
||||
g++ $(DEFS) $(DEFS2) $(CPPFLAGS) -o $@ test_norm.o $(OBJS) $(LIBS)
|
||||
test_convert: $(OBJS) test_convert.o
|
||||
g++ $(DEFS) $(CPPFLAGS) -o $@ test_convert.o $(OBJS) $(LIBS)
|
||||
g++ $(DEFS) $(DEFS2) $(CPPFLAGS) -o $@ test_convert.o $(OBJS) $(LIBS)
|
||||
|
||||
supported_charsets: $(OBJS) supported_charsets.o supported_charsets.txt
|
||||
g++ $(DEFS) $(CPPFLAGS) -o $@ supported_charsets.o $(OBJS) $(LIBS)
|
||||
g++ $(DEFS) $(DEFS2) $(CPPFLAGS) -o $@ supported_charsets.o $(OBJS) $(LIBS)
|
||||
gbchksum: gbchksum.o
|
||||
g++ -g -Wall -o $@ gbchksum.o
|
||||
create_ucd_tables: $(OBJS) create_ucd_tables.o
|
||||
g++ $(DEFS) $(CPPFLAGS) -o $@ create_ucd_tables.o $(OBJS) $(LIBS)
|
||||
g++ $(DEFS) $(DEFS2) $(CPPFLAGS) -o $@ create_ucd_tables.o $(OBJS) $(LIBS)
|
||||
|
||||
ucd.o: ucd.cpp ucd.h
|
||||
|
||||
@ -159,19 +163,19 @@ ucd.cpp: parse_ucd.pl
|
||||
|
||||
|
||||
ipconfig: ipconfig.o
|
||||
$(CC) $(DEFS) $(CPPFLAGS) -o $@ $@.o -lc
|
||||
blaster: $(OBJS) blaster.o
|
||||
$(CC) $(DEFS) $(CPPFLAGS) -o $@ $@.o $(OBJS) $(LIBS)
|
||||
$(CC) $(DEFS) $(DEFS2) $(CPPFLAGS) -o $@ $@.o -lc
|
||||
blaster2: $(OBJS) blaster2.o
|
||||
$(CC) $(DEFS) $(DEFS2) $(CPPFLAGS) -o $@ $@.o $(OBJS) $(LIBS)
|
||||
udptest: $(OBJS) udptest.o
|
||||
$(CC) $(DEFS) $(CPPFLAGS) -o $@ $@.o $(OBJS) $(LIBS)
|
||||
$(CC) $(DEFS) $(DEFS2) $(CPPFLAGS) -o $@ $@.o $(OBJS) $(LIBS)
|
||||
dnstest: $(OBJS) dnstest.o
|
||||
$(CC) $(DEFS) $(CPPFLAGS) -o $@ $@.o $(OBJS) $(LIBS)
|
||||
$(CC) $(DEFS) $(DEFS2) $(CPPFLAGS) -o $@ $@.o $(OBJS) $(LIBS)
|
||||
thunder: thunder.o
|
||||
$(CC) $(DEFS) $(CPPFLAGS) -static -o $@ $@.o
|
||||
$(CC) $(DEFS) $(DEFS2) $(CPPFLAGS) -static -o $@ $@.o
|
||||
threadtest: threadtest.o
|
||||
$(CC) $(DEFS) $(CPPFLAGS) -o $@ $@.o -lpthread
|
||||
$(CC) $(DEFS) $(DEFS2) $(CPPFLAGS) -o $@ $@.o -lpthread
|
||||
memtest: memtest.o
|
||||
$(CC) $(DEFS) $(CPPFLAGS) -o $@ $@.o
|
||||
$(CC) $(DEFS) $(DEFS2) $(CPPFLAGS) -o $@ $@.o
|
||||
hashtest: hashtest.cpp
|
||||
$(CC) -O3 -o hashtest hashtest.cpp
|
||||
hashtest0: hashtest
|
||||
@ -179,16 +183,16 @@ hashtest0: hashtest
|
||||
membustest: membustest.cpp
|
||||
$(CC) -O0 -o membustest membustest.cpp -static -lc
|
||||
mergetest: $(OBJS) mergetest.o
|
||||
$(CC) $(DEFS) $(CPPFLAGS) -o $@ $@.o $(OBJS) $(LIBS)
|
||||
$(CC) $(DEFS) $(DEFS2) $(CPPFLAGS) -o $@ $@.o $(OBJS) $(LIBS)
|
||||
addtest: $(OBJS) addtest.o
|
||||
$(CC) $(DEFS) $(CPPFLAGS) -o $@ $@.o $(OBJS) $(LIBS)
|
||||
$(CC) $(DEFS) $(DEFS2) $(CPPFLAGS) -o $@ $@.o $(OBJS) $(LIBS)
|
||||
addtest0: $(OBJS) addtest
|
||||
bzip2 -fk addtest
|
||||
scp addtest.bz2 gb0:/a/
|
||||
seektest: seektest.cpp
|
||||
$(CC) -o seektest seektest.cpp -lpthread
|
||||
treetest: $(OBJ) treetest.o
|
||||
$(CC) $(DEFS) -O2 $(CPPFLAGS) -o $@ $@.o $(OBJS) $(LIBS)
|
||||
$(CC) $(DEFS) $(DEFS2) -O2 $(CPPFLAGS) -o $@ $@.o $(OBJS) $(LIBS)
|
||||
treetest0: treetest
|
||||
bzip2 -fk treetest
|
||||
scp treetest.bz2 gb0:/a/
|
||||
@ -198,308 +202,301 @@ nicetest: nicetest.o
|
||||
|
||||
|
||||
monitor: $(OBJS) monitor.o
|
||||
$(CC) $(DEFS) $(CPPFLAGS) -o $@ monitor.o $(OBJS) $(LIBS)
|
||||
$(CC) $(DEFS) $(DEFS2) $(CPPFLAGS) -o $@ monitor.o $(OBJS) $(LIBS)
|
||||
reindex: $(OBJS) reindex.o
|
||||
$(CC) $(DEFS) $(CPPFLAGS) -o $@ $@.o $(OBJS) $(LIBS)
|
||||
$(CC) $(DEFS) $(DEFS2) $(CPPFLAGS) -o $@ $@.o $(OBJS) $(LIBS)
|
||||
convert: $(OBJS) convert.o
|
||||
$(CC) $(DEFS) $(CPPFLAGS) -o $@ $@.o $(OBJS) $(LIBS)
|
||||
$(CC) $(DEFS) $(DEFS2) $(CPPFLAGS) -o $@ $@.o $(OBJS) $(LIBS)
|
||||
maketestindex: $(OBJS) maketestindex.o
|
||||
$(CC) $(DEFS) $(CPPFLAGS) -o $@ $@.o $(OBJS) $(LIBS)
|
||||
$(CC) $(DEFS) $(DEFS2) $(CPPFLAGS) -o $@ $@.o $(OBJS) $(LIBS)
|
||||
makespiderdb: $(OBJS) makespiderdb.o
|
||||
$(CC) $(DEFS) $(CPPFLAGS) -o $@ $@.o $(OBJS) $(LIBS)
|
||||
$(CC) $(DEFS) $(DEFS2) $(CPPFLAGS) -o $@ $@.o $(OBJS) $(LIBS)
|
||||
makespiderdb0: makespiderdb
|
||||
bzip2 -fk makespiderdb
|
||||
scp makespiderdb.bz2 gb0:/a/
|
||||
makeclusterdb: $(OBJS) makeclusterdb.o
|
||||
$(CC) $(DEFS) $(CPPFLAGS) -o $@ $@.o $(OBJS) $(LIBS)
|
||||
$(CC) $(DEFS) $(DEFS2) $(CPPFLAGS) -o $@ $@.o $(OBJS) $(LIBS)
|
||||
makeclusterdb0: makeclusterdb
|
||||
bzip2 -fk makeclusterdb
|
||||
scp makeclusterdb.bz2 gb0:/a/
|
||||
ssh gb0 'cd /a/ ; rm makeclusterdb ; bunzip2 makeclusterdb.bz2'
|
||||
makefix: $(OBJS) makefix.o
|
||||
$(CC) $(DEFS) $(CPPFLAGS) -o $@ $@.o $(OBJS) $(LIBS)
|
||||
$(CC) $(DEFS) $(DEFS2) $(CPPFLAGS) -o $@ $@.o $(OBJS) $(LIBS)
|
||||
makefix0: makefix
|
||||
bzip2 -fk makefix
|
||||
scp makefix.bz2 gb0:/a/
|
||||
urlinfo: $(OBJS) urlinfo.o
|
||||
$(CC) $(DEFS) $(CPPFLAGS) -o $@ $(OBJS) urlinfo.o $(LIBS)
|
||||
$(CC) $(DEFS) $(DEFS2) $(CPPFLAGS) -o $@ $(OBJS) urlinfo.o $(LIBS)
|
||||
|
||||
dmozparse: $(OBJS) dmozparse.o
|
||||
$(CC) $(DEFS) $(CPPFLAGS) -o $@ $@.o $(OBJS) $(LIBS)
|
||||
$(CC) $(DEFS) $(DEFS2) $(CPPFLAGS) -o $@ $@.o $(OBJS) $(LIBS)
|
||||
gbfilter: gbfilter.cpp
|
||||
g++ -g -o gbfilter gbfilter.cpp -static -lc
|
||||
gbtitletest: gbtitletest.o
|
||||
$(CC) $(DEFS) $(CPPFLAGS) -o $@ $@.o $(OBJS) $(LIBS)
|
||||
|
||||
$(CC) $(DEFS) $(DEFS2) $(CPPFLAGS) -o $@ $@.o $(OBJS) $(LIBS)
|
||||
|
||||
|
||||
# comment this out for faster deb package building
|
||||
clean:
|
||||
-rm -f *.o gb *.bz2 blaster udptest memtest hashtest membustest mergetest seektest addtest monitor reindex convert maketestindex makespiderdb makeclusterdb urlinfo gbfilter dnstest thunder dmozparse gbtitletest gmon.* GBVersion.cpp quarantine core core.*
|
||||
-rm -f *.o gb *.bz2 blaster2 udptest memtest hashtest membustest mergetest seektest addtest monitor reindex convert maketestindex makespiderdb makeclusterdb urlinfo gbfilter dnstest thunder dmozparse gbtitletest gmon.* GBVersion.cpp quarantine core core.*
|
||||
|
||||
.PHONY: GBVersion.cpp
|
||||
|
||||
convert.o:
|
||||
$(CC) $(DEFS) $(CPPFLAGS) -O2 -c $*.cpp
|
||||
$(CC) $(DEFS) $(DEFS2) $(CPPFLAGS) -O2 -c $*.cpp
|
||||
|
||||
StopWords.o:
|
||||
$(CC) $(DEFS) $(CPPFLAGS) -O2 -c $*.cpp
|
||||
$(CC) $(DEFS) $(DEFS2) $(CPPFLAGS) -O2 -c $*.cpp
|
||||
|
||||
Places.o:
|
||||
$(CC) $(DEFS) $(CPPFLAGS) -O2 -c $*.cpp
|
||||
$(CC) $(DEFS) $(DEFS2) $(CPPFLAGS) -O2 -c $*.cpp
|
||||
|
||||
Loop.o:
|
||||
$(CC) $(DEFS) $(CPPFLAGS) -O2 -c $*.cpp
|
||||
$(CC) $(DEFS) $(DEFS2) $(CPPFLAGS) -O2 -c $*.cpp
|
||||
|
||||
hash.o:
|
||||
$(CC) $(DEFS) $(CPPFLAGS) -O2 -c $*.cpp
|
||||
$(CC) $(DEFS) $(DEFS2) $(CPPFLAGS) -O2 -c $*.cpp
|
||||
|
||||
fctypes.o:
|
||||
$(CC) $(DEFS) $(CPPFLAGS) -O2 -c $*.cpp
|
||||
$(CC) $(DEFS) $(DEFS2) $(CPPFLAGS) -O2 -c $*.cpp
|
||||
|
||||
IndexList.o:
|
||||
$(CC) $(DEFS) $(CPPFLAGS) -O2 -c $*.cpp
|
||||
$(CC) $(DEFS) $(DEFS2) $(CPPFLAGS) -O2 -c $*.cpp
|
||||
|
||||
Matches.o:
|
||||
$(CC) $(DEFS) $(CPPFLAGS) -O2 -c $*.cpp
|
||||
$(CC) $(DEFS) $(DEFS2) $(CPPFLAGS) -O2 -c $*.cpp
|
||||
|
||||
Highlight.o:
|
||||
$(CC) $(DEFS) $(CPPFLAGS) -O2 -c $*.cpp
|
||||
$(CC) $(DEFS) $(DEFS2) $(CPPFLAGS) -O2 -c $*.cpp
|
||||
|
||||
matches2.o:
|
||||
$(CC) $(DEFS) $(CPPFLAGS) -O2 -c $*.cpp
|
||||
$(CC) $(DEFS) $(DEFS2) $(CPPFLAGS) -O2 -c $*.cpp
|
||||
|
||||
linkspam.o:
|
||||
$(CC) $(DEFS) $(CPPFLAGS) -O2 -c $*.cpp
|
||||
$(CC) $(DEFS) $(DEFS2) $(CPPFLAGS) -O2 -c $*.cpp
|
||||
|
||||
Matchers.o:
|
||||
$(CC) $(DEFS) $(CPPFLAGS) -O2 -c $*.cpp
|
||||
$(CC) $(DEFS) $(DEFS2) $(CPPFLAGS) -O2 -c $*.cpp
|
||||
|
||||
HtmlParser.o:
|
||||
$(CC) $(DEFS) $(CPPFLAGS) -O2 -c $*.cpp
|
||||
$(CC) $(DEFS) $(DEFS2) $(CPPFLAGS) -O2 -c $*.cpp
|
||||
|
||||
|
||||
# Url::set() seems to take too much time
|
||||
Url.o:
|
||||
$(CC) $(DEFS) $(CPPFLAGS) -O2 -c $*.cpp
|
||||
$(CC) $(DEFS) $(DEFS2) $(CPPFLAGS) -O2 -c $*.cpp
|
||||
|
||||
# Sitedb has that slow matching code
|
||||
Sitedb.o:
|
||||
$(CC) $(DEFS) $(CPPFLAGS) -O2 -c $*.cpp
|
||||
$(CC) $(DEFS) $(DEFS2) $(CPPFLAGS) -O2 -c $*.cpp
|
||||
|
||||
Catdb.o:
|
||||
$(CC) $(DEFS) $(CPPFLAGS) -O2 -c $*.cpp
|
||||
$(CC) $(DEFS) $(DEFS2) $(CPPFLAGS) -O2 -c $*.cpp
|
||||
|
||||
# when making a new file, add the recs to the map fast
|
||||
RdbMap.o:
|
||||
$(CC) $(DEFS) $(CPPFLAGS) -O2 -c $*.cpp
|
||||
$(CC) $(DEFS) $(DEFS2) $(CPPFLAGS) -O2 -c $*.cpp
|
||||
|
||||
# this was getting corruption, was it cuz we used -O2 compiler option?
|
||||
# RdbTree.o:
|
||||
# $(CC) $(DEFS) $(CPPFLAGS) -O3 -c $*.cpp
|
||||
# $(CC) $(DEFS) $(DEFS2) $(CPPFLAGS) -O3 -c $*.cpp
|
||||
|
||||
RdbBuckets.o:
|
||||
$(CC) $(DEFS) $(CPPFLAGS) -O3 -c $*.cpp
|
||||
$(CC) $(DEFS) $(DEFS2) $(CPPFLAGS) -O3 -c $*.cpp
|
||||
|
||||
Linkdb.o:
|
||||
$(CC) $(DEFS) $(CPPFLAGS) -O3 -c $*.cpp
|
||||
$(CC) $(DEFS) $(DEFS2) $(CPPFLAGS) -O3 -c $*.cpp
|
||||
|
||||
XmlDoc.o:
|
||||
$(CC) $(DEFS) $(CPPFLAGS) -O3 -c $*.cpp
|
||||
$(CC) $(DEFS) $(DEFS2) $(CPPFLAGS) -O3 -c $*.cpp
|
||||
|
||||
# final gigabit generation in here:
|
||||
Msg40.o:
|
||||
$(CC) $(DEFS) $(CPPFLAGS) -O3 -c $*.cpp
|
||||
$(CC) $(DEFS) $(DEFS2) $(CPPFLAGS) -O3 -c $*.cpp
|
||||
|
||||
seo.o:
|
||||
$(CC) $(DEFS) $(CPPFLAGS) -O3 -c $*.cpp
|
||||
$(CC) $(DEFS) $(DEFS2) $(CPPFLAGS) -O3 -c $*.cpp
|
||||
|
||||
TopTree.o:
|
||||
$(CC) $(DEFS) $(CPPFLAGS) -O3 -c $*.cpp
|
||||
$(CC) $(DEFS) $(DEFS2) $(CPPFLAGS) -O3 -c $*.cpp
|
||||
|
||||
UdpServer.o:
|
||||
$(CC) $(DEFS) $(CPPFLAGS) -O2 -c $*.cpp
|
||||
$(CC) $(DEFS) $(DEFS2) $(CPPFLAGS) -O2 -c $*.cpp
|
||||
|
||||
RdbList.o:
|
||||
$(CC) $(DEFS) $(CPPFLAGS) -O2 -c $*.cpp
|
||||
$(CC) $(DEFS) $(DEFS2) $(CPPFLAGS) -O2 -c $*.cpp
|
||||
|
||||
Rdb.o:
|
||||
$(CC) $(DEFS) $(CPPFLAGS) -O2 -c $*.cpp
|
||||
$(CC) $(DEFS) $(DEFS2) $(CPPFLAGS) -O2 -c $*.cpp
|
||||
|
||||
# take this out. seems to not trigger merges when percent of
|
||||
# negative titlerecs is over 40.
|
||||
#RdbBase.o:
|
||||
# $(CC) $(DEFS) $(CPPFLAGS) -O2 -c $*.cpp
|
||||
RdbBase.o:
|
||||
$(CC) $(DEFS) $(DEFS2) $(CPPFLAGS) -O2 -c $*.cpp
|
||||
|
||||
# RdbCache.cpp gets "corrupted" with -O2... like RdbTree.cpp
|
||||
#RdbCache.o:
|
||||
# $(CC) $(DEFS) $(CPPFLAGS) -O2 -c $*.cpp
|
||||
# $(CC) $(DEFS) $(DEFS2) $(CPPFLAGS) -O2 -c $*.cpp
|
||||
|
||||
# fast dictionary generation and spelling recommendations
|
||||
#Speller.o:
|
||||
# $(CC) $(DEFS) $(CPPFLAGS) -O2 -c $*.cpp
|
||||
# $(CC) $(DEFS) $(DEFS2) $(CPPFLAGS) -O2 -c $*.cpp
|
||||
|
||||
# O2 seems slightly faster than O2 on this for some reason
|
||||
# O2 is almost twice as fast as no O
|
||||
IndexTable.o:
|
||||
$(CC) $(DEFS) $(CPPFLAGS) -O2 -c $*.cpp
|
||||
$(CC) $(DEFS) $(DEFS2) $(CPPFLAGS) -O2 -c $*.cpp
|
||||
|
||||
IndexTable2.o:
|
||||
$(CC) $(DEFS) $(CPPFLAGS) -O2 -c $*.cpp
|
||||
$(CC) $(DEFS) $(DEFS2) $(CPPFLAGS) -O2 -c $*.cpp
|
||||
|
||||
Posdb.o:
|
||||
$(CC) $(DEFS) $(CPPFLAGS) -O2 -c $*.cpp
|
||||
$(CC) $(DEFS) $(DEFS2) $(CPPFLAGS) -O2 -c $*.cpp
|
||||
|
||||
# Query::setBitScores() needs this optimization
|
||||
#Query.o:
|
||||
# $(CC) $(DEFS) $(CPPFLAGS) -O2 -c $*.cpp
|
||||
# $(CC) $(DEFS) $(DEFS2) $(CPPFLAGS) -O2 -c $*.cpp
|
||||
|
||||
# Msg3's should calculate the page ranges fast
|
||||
#Msg3.o:
|
||||
# $(CC) $(DEFS) $(CPPFLAGS) -O2 -c $*.cpp
|
||||
# $(CC) $(DEFS) $(DEFS2) $(CPPFLAGS) -O2 -c $*.cpp
|
||||
|
||||
# fast parsing
|
||||
Xml.o:
|
||||
$(CC) $(DEFS) $(CPPFLAGS) -O2 -c $*.cpp
|
||||
$(CC) $(DEFS) $(DEFS2) $(CPPFLAGS) -O2 -c $*.cpp
|
||||
XmlNode.o:
|
||||
$(CC) $(DEFS) $(CPPFLAGS) -O2 -c $*.cpp
|
||||
$(CC) $(DEFS) $(DEFS2) $(CPPFLAGS) -O2 -c $*.cpp
|
||||
Words.o:
|
||||
$(CC) $(DEFS) $(CPPFLAGS) -O2 -c $*.cpp
|
||||
$(CC) $(DEFS) $(DEFS2) $(CPPFLAGS) -O2 -c $*.cpp
|
||||
Unicode.o:
|
||||
$(CC) $(DEFS) $(CPPFLAGS) -O2 -c $*.cpp
|
||||
$(CC) $(DEFS) $(DEFS2) $(CPPFLAGS) -O2 -c $*.cpp
|
||||
UCWordIterator.o:
|
||||
$(CC) $(DEFS) $(CPPFLAGS) -O2 -c $*.cpp
|
||||
$(CC) $(DEFS) $(DEFS2) $(CPPFLAGS) -O2 -c $*.cpp
|
||||
UCPropTable.o:
|
||||
$(CC) $(DEFS) $(CPPFLAGS) -O2 -c $*.cpp
|
||||
$(CC) $(DEFS) $(DEFS2) $(CPPFLAGS) -O2 -c $*.cpp
|
||||
UnicodeProperties.o:
|
||||
$(CC) $(DEFS) $(CPPFLAGS) -O2 -c $*.cpp
|
||||
$(CC) $(DEFS) $(DEFS2) $(CPPFLAGS) -O2 -c $*.cpp
|
||||
UCNormalizer.o:
|
||||
$(CC) $(DEFS) $(CPPFLAGS) -O2 -c $*.cpp
|
||||
$(CC) $(DEFS) $(DEFS2) $(CPPFLAGS) -O2 -c $*.cpp
|
||||
Pos.o:
|
||||
$(CC) $(DEFS) $(CPPFLAGS) -O2 -c $*.cpp
|
||||
$(CC) $(DEFS) $(DEFS2) $(CPPFLAGS) -O2 -c $*.cpp
|
||||
Pops.o:
|
||||
$(CC) $(DEFS) $(CPPFLAGS) -O2 -c $*.cpp
|
||||
$(CC) $(DEFS) $(DEFS2) $(CPPFLAGS) -O2 -c $*.cpp
|
||||
Bits.o:
|
||||
$(CC) $(DEFS) $(CPPFLAGS) -O2 -c $*.cpp
|
||||
$(CC) $(DEFS) $(DEFS2) $(CPPFLAGS) -O2 -c $*.cpp
|
||||
Scores.o:
|
||||
$(CC) $(DEFS) $(CPPFLAGS) -O2 -c $*.cpp
|
||||
$(CC) $(DEFS) $(DEFS2) $(CPPFLAGS) -O2 -c $*.cpp
|
||||
Sections.o:
|
||||
$(CC) $(DEFS) $(CPPFLAGS) -O2 -c $*.cpp
|
||||
$(CC) $(DEFS) $(DEFS2) $(CPPFLAGS) -O2 -c $*.cpp
|
||||
Weights.o:
|
||||
$(CC) $(DEFS) $(CPPFLAGS) -O2 -c $*.cpp
|
||||
$(CC) $(DEFS) $(DEFS2) $(CPPFLAGS) -O2 -c $*.cpp
|
||||
neighborhood.o:
|
||||
$(CC) $(DEFS) $(CPPFLAGS) -O2 -c $*.cpp
|
||||
$(CC) $(DEFS) $(DEFS2) $(CPPFLAGS) -O2 -c $*.cpp
|
||||
TermTable.o:
|
||||
$(CC) $(DEFS) $(CPPFLAGS) -O2 -c $*.cpp
|
||||
$(CC) $(DEFS) $(DEFS2) $(CPPFLAGS) -O2 -c $*.cpp
|
||||
#Summary.o:
|
||||
# $(CC) $(DEFS) $(CPPFLAGS) -O2 -c $*.cpp
|
||||
# $(CC) $(DEFS) $(DEFS2) $(CPPFLAGS) -O2 -c $*.cpp
|
||||
Title.o:
|
||||
$(CC) $(DEFS) $(CPPFLAGS) -O2 -c $*.cpp
|
||||
$(CC) $(DEFS) $(DEFS2) $(CPPFLAGS) -O2 -c $*.cpp
|
||||
|
||||
# fast relate topics generation
|
||||
Msg24.o:
|
||||
$(CC) $(DEFS) $(CPPFLAGS) -O2 -c $*.cpp
|
||||
$(CC) $(DEFS) $(DEFS2) $(CPPFLAGS) -O2 -c $*.cpp
|
||||
|
||||
Msg1a.o:
|
||||
$(CC) $(DEFS) $(CPPFLAGS) -O2 -c $*.cpp
|
||||
$(CC) $(DEFS) $(DEFS2) $(CPPFLAGS) -O2 -c $*.cpp
|
||||
|
||||
Msg1b.o:
|
||||
$(CC) $(DEFS) $(CPPFLAGS) -O2 -c $*.cpp
|
||||
$(CC) $(DEFS) $(DEFS2) $(CPPFLAGS) -O2 -c $*.cpp
|
||||
|
||||
SafeBuf.o:
|
||||
$(CC) $(DEFS) $(CPPFLAGS) -O3 -c $*.cpp
|
||||
$(CC) $(DEFS) $(DEFS2) $(CPPFLAGS) -O3 -c $*.cpp
|
||||
|
||||
Msg1c.o:
|
||||
$(CC) $(DEFS) $(CPPFLAGS) -c $*.cpp
|
||||
$(CC) $(DEFS) $(DEFS2) $(CPPFLAGS) -c $*.cpp
|
||||
|
||||
Msg1d.o:
|
||||
$(CC) $(DEFS) $(CPPFLAGS) -c $*.cpp
|
||||
$(CC) $(DEFS) $(DEFS2) $(CPPFLAGS) -c $*.cpp
|
||||
|
||||
AutoBan.o:
|
||||
$(CC) $(DEFS) $(CPPFLAGS) -O2 -c $*.cpp
|
||||
$(CC) $(DEFS) $(DEFS2) $(CPPFLAGS) -O2 -c $*.cpp
|
||||
|
||||
Profiler.o:
|
||||
$(CC) $(DEFS) $(CPPFLAGS) -O2 -c $*.cpp
|
||||
$(CC) $(DEFS) $(DEFS2) $(CPPFLAGS) -O2 -c $*.cpp
|
||||
|
||||
HtmlCarver.o:
|
||||
$(CC) $(DEFS) $(CPPFLAGS) -O2 -c $*.cpp
|
||||
$(CC) $(DEFS) $(DEFS2) $(CPPFLAGS) -O2 -c $*.cpp
|
||||
|
||||
HashTableT.o:
|
||||
$(CC) $(DEFS) $(CPPFLAGS) -O2 -c $*.cpp
|
||||
$(CC) $(DEFS) $(DEFS2) $(CPPFLAGS) -O2 -c $*.cpp
|
||||
|
||||
Timedb.o:
|
||||
$(CC) $(DEFS) $(CPPFLAGS) -O2 -c $*.cpp
|
||||
$(CC) $(DEFS) $(DEFS2) $(CPPFLAGS) -O2 -c $*.cpp
|
||||
|
||||
HashTableX.o:
|
||||
$(CC) $(DEFS) $(CPPFLAGS) -O2 -c $*.cpp
|
||||
$(CC) $(DEFS) $(DEFS2) $(CPPFLAGS) -O2 -c $*.cpp
|
||||
|
||||
SpiderCache.o:
|
||||
$(CC) $(DEFS) $(CPPFLAGS) -O2 -c $*.cpp
|
||||
$(CC) $(DEFS) $(DEFS2) $(CPPFLAGS) -O2 -c $*.cpp
|
||||
|
||||
DateParse.o:
|
||||
$(CC) $(DEFS) $(CPPFLAGS) -O2 -c $*.cpp
|
||||
$(CC) $(DEFS) $(DEFS2) $(CPPFLAGS) -O2 -c $*.cpp
|
||||
|
||||
#DateParse2.o:
|
||||
# $(CC) $(DEFS) $(CPPFLAGS) -O2 -c $*.cpp
|
||||
# $(CC) $(DEFS) $(DEFS2) $(CPPFLAGS) -O2 -c $*.cpp
|
||||
|
||||
test_parser2.o:
|
||||
$(CC) $(DEFS) $(CPPFLAGS) -O2 -c $*.cpp
|
||||
$(CC) $(DEFS) $(DEFS2) $(CPPFLAGS) -O2 -c $*.cpp
|
||||
|
||||
Language.o:
|
||||
$(CC) $(DEFS) $(CPPFLAGS) -O3 -c $*.cpp
|
||||
$(CC) $(DEFS) $(DEFS2) $(CPPFLAGS) -O3 -c $*.cpp
|
||||
|
||||
WordsWindow.o:
|
||||
$(CC) $(DEFS) $(CPPFLAGS) -O2 -c $*.cpp
|
||||
$(CC) $(DEFS) $(DEFS2) $(CPPFLAGS) -O2 -c $*.cpp
|
||||
|
||||
AppendingWordsWindow.o:
|
||||
$(CC) $(DEFS) $(CPPFLAGS) -O2 -c $*.cpp
|
||||
$(CC) $(DEFS) $(DEFS2) $(CPPFLAGS) -O2 -c $*.cpp
|
||||
|
||||
PostQueryRerank.o:
|
||||
$(CC) $(DEFS) $(CPPFLAGS) -O2 -c $*.cpp
|
||||
$(CC) $(DEFS) $(DEFS2) $(CPPFLAGS) -O2 -c $*.cpp
|
||||
|
||||
sort.o:
|
||||
$(CC) $(DEFS) $(CPPFLAGS) -O3 -c $*.cpp
|
||||
$(CC) $(DEFS) $(DEFS2) $(CPPFLAGS) -O3 -c $*.cpp
|
||||
|
||||
# SiteBonus.o:
|
||||
# $(CC) $(DEFS) $(CPPFLAGS) -O3 -c $*.cpp
|
||||
# $(CC) $(DEFS) $(DEFS2) $(CPPFLAGS) -O3 -c $*.cpp
|
||||
Msg6a.o:
|
||||
$(CC) $(DEFS) $(CPPFLAGS) -O3 -c $*.cpp
|
||||
$(CC) $(DEFS) $(DEFS2) $(CPPFLAGS) -O3 -c $*.cpp
|
||||
|
||||
# Stupid gcc-2.95 stabs debug can't handle such a big file.
|
||||
geo_ip_table.o: geo_ip_table.cpp geo_ip_table.h
|
||||
$(CC) $(DEFS) -m32 -Wall -pipe -c $*.cpp
|
||||
$(CC) $(DEFS) $(DEFS2) -m32 -Wall -pipe -c $*.cpp
|
||||
|
||||
# move this tarball into ~/rpmbuild/?????
|
||||
# then run rpmbuild -ba gb-1.0.spec to build the rpms
|
||||
# rpm -ivh gb-1.0-... to install the pkg
|
||||
tarball-testing:
|
||||
# git archive --format=tar master | gzip > gb.tar
|
||||
git archive --format=tar --prefix=gb-1.0/ testing > gb-1.0.tar
|
||||
|
||||
master-rpm:
|
||||
# git archive --format=tar master | gzip > gb.tar
|
||||
git archive --format=tar --prefix=gb-1.0/ master > gb-1.0.tar
|
||||
mv gb-1.0.tar /home/mwells/rpmbuild/SOURCES/
|
||||
rpmbuild -ba gb-1.0.spec
|
||||
scp /home/mwells/rpmbuild/RPMS/x86_64/gb-*rpm www.gigablast.com:/w/html/
|
||||
# dpkg-buildpackage calls 'make binary' to create the files for the deb pkg
|
||||
# which must all be stored in ./debian/gb/
|
||||
|
||||
install:
|
||||
# gigablast will copy over the necessary files. it has a list of the
|
||||
# necessary files and that list changes over time so it is better to let gb
|
||||
# deal with it.
|
||||
mkdir -p /var/gigablast/data0/
|
||||
./gb copyfiles /var/gigablast/data0/
|
||||
mkdir -p $(DESTDIR)/var/gigablast/data0/
|
||||
mkdir -p $(DESTDIR)/usr/bin/
|
||||
mkdir -p $(DESTDIR)/etc/init.d/
|
||||
mkdir -p $(DESTDIR)/etc/init/
|
||||
mkdir -p $(DESTDIR)/lib/init/
|
||||
./gb copyfiles $(DESTDIR)/var/gigablast/data0/
|
||||
# if user types 'gb' it will use the binary in /var/gigablast/data0/gb
|
||||
rm -f /usr/bin/gb
|
||||
ln -s /var/gigablast/data0/gb /usr/bin/gb
|
||||
rm -f $(DESTDIR)/usr/bin/gb
|
||||
ln -s /var/gigablast/data0/gb $(DESTDIR)/usr/bin/gb
|
||||
# if machine restarts...
|
||||
# the new way that does not use run-levels anymore
|
||||
rm -f /etc/init.d/gb
|
||||
ln -s /lib/init/upstart-job /etc/init.d/gb
|
||||
rm -f $(DESTDIR)/etc/init.d/gb
|
||||
ln -s /lib/init/upstart-job $(DESTDIR)/etc/init.d/gb
|
||||
# initctl upstart-job conf file (gb stop|start|reload)
|
||||
cp init.gb.conf /etc/init/gb.conf
|
||||
cp init.gb.conf $(DESTDIR)/etc/init/gb.conf
|
||||
|
||||
.cpp.o:
|
||||
$(CC) $(DEFS) $(CPPFLAGS) -c $*.cpp
|
||||
$(CC) $(DEFS) $(DEFS2) $(CPPFLAGS) -c $*.cpp
|
||||
|
||||
#.cpp: $(OBJS)
|
||||
# $(CC) $(DEFS) $(CPPFLAGS) -o $@ $@.o $(OBJS) $(LIBS)
|
||||
@ -522,3 +519,49 @@ depend:
|
||||
|
||||
-include Make.depend
|
||||
|
||||
# REDHAT PACKAGE SECTION BEGIN
|
||||
|
||||
# try building the .deb and then running 'alien --to-rpm gb_1.0-1_i386.deb'
|
||||
# to build the .rpm
|
||||
|
||||
# move this tarball into ~/rpmbuild/?????
|
||||
# then run rpmbuild -ba gb-1.0.spec to build the rpms
|
||||
# rpm -ivh gb-1.0-... to install the pkg
|
||||
testing-rpm:
|
||||
git archive --format=tar --prefix=gb-1.0/ testing > gb-1.0.tar
|
||||
mv gb-1.0.tar /home/mwells/rpmbuild/SOURCES/
|
||||
rpmbuild -bb gb-1.0.spec
|
||||
scp /home/mwells/rpmbuild/RPMS/x86_64/gb-*rpm www.gigablast.com:/w/html/
|
||||
|
||||
master-rpm:
|
||||
git archive --format=tar --prefix=gb-1.0/ master > gb-1.0.tar
|
||||
mv gb-1.0.tar /home/mwells/rpmbuild/SOURCES/
|
||||
rpmbuild -bb gb-1.0.spec
|
||||
scp /home/mwells/rpmbuild/RPMS/x86_64/gb-*rpm www.gigablast.com:/w/html/
|
||||
|
||||
# REDHAT PACKAGE SECTION END
|
||||
|
||||
# DEBIAN PACKAGE SECTION BEGIN
|
||||
|
||||
testing-deb:
|
||||
git archive --format=tar --prefix=gb-1.0/ testing > ../gb_1.0.orig.tar
|
||||
rm -rf debian
|
||||
# change "-p gb_1.0" to "-p gb_1.1" to update version for example
|
||||
dh_make -e gigablast@mail.com -p gb_1.0 -f ../gb_1.0.orig.tar
|
||||
# zero this out, it is just filed with the .txt files erroneously and it'll
|
||||
# try to automatiicaly install in /usr/docs/
|
||||
rm debian/docs
|
||||
touch debian/docs
|
||||
# try to use our own rules so we can override dh_shlibdeps and others
|
||||
cp gb.deb.rules debian/rules
|
||||
# fix dh_shlibdeps from bitching about dependencies on shared libs
|
||||
# YOU HAVE TO RUN THIS before you run 'make'
|
||||
# export LD_LIBRARY_PATH=./debian/gb/var/gigablast/data0
|
||||
# build the package now
|
||||
dpkg-buildpackage -nc -ai386 -ti386 -b -uc -rfakeroot
|
||||
# upload to main gigablast server
|
||||
# scp ../gb*.deb www.gigablast.com:/w/html/
|
||||
|
||||
# DEBIAN PACKAGE SECTION END
|
||||
|
||||
|
||||
|
50
Mem.cpp
50
Mem.cpp
@ -1948,8 +1948,8 @@ long Mem::findPtr ( void *target ) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
//#include <limits.h> /* for PAGESIZE */
|
||||
#define PAGESIZE ((unsigned long)(8*1024))
|
||||
//#include <limits.h> /* for MEMPAGESIZE */
|
||||
#define MEMPAGESIZE ((unsigned long)(8*1024))
|
||||
|
||||
void *getElecMem ( long size ) {
|
||||
// a page above OR a page below
|
||||
@ -1958,14 +1958,14 @@ void *getElecMem ( long size ) {
|
||||
#ifdef _CHECKUNDERFLOW_
|
||||
// how much to alloc
|
||||
// . assume sysmalloc returs one byte above a page, so we need
|
||||
// PAGESIZE-1 bytes to move p up to page boundary, another
|
||||
// PAGESIZE bytes for protected page, then the actual mem,
|
||||
// THEN possibly another PAGESIZE-1 bytes to hit the next page
|
||||
// MEMPAGESIZE-1 bytes to move p up to page boundary, another
|
||||
// MEMPAGESIZE bytes for protected page, then the actual mem,
|
||||
// THEN possibly another MEMPAGESIZE-1 bytes to hit the next page
|
||||
// boundary for protecting the "freed" mem below, but can get
|
||||
// by with (PAGESIZE-(size%PAGESIZE)) more
|
||||
long need = size + 8 + PAGESIZE + PAGESIZE ;
|
||||
// by with (MEMPAGESIZE-(size%MEMPAGESIZE)) more
|
||||
long need = size + 8 + MEMPAGESIZE + MEMPAGESIZE ;
|
||||
// want to end on a page boundary too!
|
||||
need += (PAGESIZE-(size%PAGESIZE));
|
||||
need += (MEMPAGESIZE-(size%MEMPAGESIZE));
|
||||
// get that
|
||||
char *realMem = (char *)sysmalloc ( need );
|
||||
if ( ! realMem ) return NULL;
|
||||
@ -1976,32 +1976,32 @@ void *getElecMem ( long size ) {
|
||||
// parser
|
||||
char *p = realMem;
|
||||
// align p DOWN to nearest 8k boundary
|
||||
long remainder = (uint32_t)realMem % PAGESIZE;
|
||||
long remainder = (uint32_t)realMem % MEMPAGESIZE;
|
||||
// complement
|
||||
remainder = PAGESIZE - remainder;
|
||||
remainder = MEMPAGESIZE - remainder;
|
||||
// and add to ptr to be aligned on 8k boundary
|
||||
p += remainder;
|
||||
// save that
|
||||
char *protMem = p;
|
||||
// skip that
|
||||
p += PAGESIZE;
|
||||
p += MEMPAGESIZE;
|
||||
// save this
|
||||
char *returnMem = p;
|
||||
// store the ptrs
|
||||
*(char **)(returnMem- 4) = realMem;
|
||||
*(char **)(returnMem- 8) = realMemEnd;
|
||||
// protect that after we wrote our ptr
|
||||
if ( mprotect ( protMem , PAGESIZE , PROT_NONE) < 0 )
|
||||
if ( mprotect ( protMem , MEMPAGESIZE , PROT_NONE) < 0 )
|
||||
log("mem: mprotect failed: %s",mstrerror(errno));
|
||||
// advance over user data
|
||||
p += size;
|
||||
// now when we free this it should all be protected, so make sure
|
||||
// we have enough room on top
|
||||
long leftover = PAGESIZE - ((uint32_t)p % PAGESIZE);
|
||||
long leftover = MEMPAGESIZE - ((uint32_t)p % MEMPAGESIZE);
|
||||
// skip that
|
||||
p += leftover;
|
||||
// inefficient?
|
||||
if ( realMemEnd - p > (long)PAGESIZE ) { char *xx=NULL;*xx=0;}
|
||||
if ( realMemEnd - p > (long)MEMPAGESIZE ) { char *xx=NULL;*xx=0;}
|
||||
// ensure we do not breach
|
||||
if ( p > realMemEnd ) { char *xx=NULL;*xx=0; }
|
||||
// test it, this should core
|
||||
@ -2010,7 +2010,7 @@ void *getElecMem ( long size ) {
|
||||
return returnMem;
|
||||
#else
|
||||
// how much to alloc
|
||||
long need = size + 8 + PAGESIZE + PAGESIZE + PAGESIZE;
|
||||
long need = size + 8 + MEMPAGESIZE + MEMPAGESIZE + MEMPAGESIZE;
|
||||
// get that
|
||||
char *realMem = (char *)sysmalloc ( need );
|
||||
if ( ! realMem ) return NULL;
|
||||
@ -2021,15 +2021,15 @@ void *getElecMem ( long size ) {
|
||||
// get the end of it
|
||||
char *end = realMemEnd;
|
||||
// back down from what we need
|
||||
end -= PAGESIZE;
|
||||
end -= MEMPAGESIZE;
|
||||
// get remainder from that
|
||||
long remainder = (uint32_t)end % PAGESIZE;
|
||||
long remainder = (uint32_t)end % MEMPAGESIZE;
|
||||
// back down to that
|
||||
char *protMem = end - remainder;
|
||||
// get return mem
|
||||
char *returnMem = protMem - size;
|
||||
// back beyond that
|
||||
long leftover = (uint32_t)returnMem % PAGESIZE;
|
||||
long leftover = (uint32_t)returnMem % MEMPAGESIZE;
|
||||
// back up
|
||||
char *p = returnMem - leftover;
|
||||
// we are now on a page boundary, so we can protect this mem
|
||||
@ -2041,7 +2041,7 @@ void *getElecMem ( long size ) {
|
||||
// sanity
|
||||
if ( returnMem - 8 < realMem ) { char *xx=NULL;*xx=0; }
|
||||
// protect that after we wrote our ptr
|
||||
if ( mprotect ( protMem , PAGESIZE , PROT_NONE) < 0 )
|
||||
if ( mprotect ( protMem , MEMPAGESIZE , PROT_NONE) < 0 )
|
||||
log("mem: mprotect failed: %s",mstrerror(errno));
|
||||
// test it, this should core
|
||||
//protmem[0] = 32;
|
||||
@ -2087,13 +2087,13 @@ void freeElecMem ( void *fakeMem ) {
|
||||
long fakeSize = s_sizes[h];
|
||||
|
||||
#ifdef _CHECKUNDERFLOW_
|
||||
char *oldProtMem = cp - PAGESIZE;
|
||||
char *oldProtMem = cp - MEMPAGESIZE;
|
||||
#else
|
||||
char *oldProtMem = cp + fakeSize;
|
||||
#endif
|
||||
|
||||
// unprotect it
|
||||
if ( mprotect ( oldProtMem , PAGESIZE, PROT_READ|PROT_WRITE) < 0 )
|
||||
if ( mprotect ( oldProtMem , MEMPAGESIZE, PROT_READ|PROT_WRITE) < 0 )
|
||||
log("mem: munprotect failed: %s",mstrerror(errno));
|
||||
|
||||
// now original memptr is right before "p" and we can
|
||||
@ -2106,13 +2106,13 @@ void freeElecMem ( void *fakeMem ) {
|
||||
memset ( realMem , 0x99 , realMemEnd - realMem );
|
||||
|
||||
// ok, back up to page boundary before us
|
||||
char *protMem = realMem + (PAGESIZE -
|
||||
(((unsigned long)realMem) % PAGESIZE));
|
||||
char *protMem = realMem + (MEMPAGESIZE -
|
||||
(((unsigned long)realMem) % MEMPAGESIZE));
|
||||
// get end point
|
||||
char *protEnd = realMemEnd - ((unsigned long)realMemEnd % PAGESIZE);
|
||||
char *protEnd = realMemEnd - ((unsigned long)realMemEnd % MEMPAGESIZE);
|
||||
// sanity
|
||||
if ( protMem < realMem ) { char *xx=NULL;*xx=0; }
|
||||
if ( protMem - realMem > (long)PAGESIZE ) { char *xx=NULL;*xx=0; }
|
||||
if ( protMem - realMem > (long)MEMPAGESIZE ) { char *xx=NULL;*xx=0; }
|
||||
// before adding it into the ring, protect it
|
||||
if ( mprotect ( protMem , protEnd-protMem, PROT_NONE) < 0 )
|
||||
log("mem: mprotect2 failed: %s",mstrerror(errno));
|
||||
|
@ -14,6 +14,7 @@
|
||||
// * http://diffbot.com/dev/docs/ (Crawlbot API tab, and others)
|
||||
// * http://diffbot.com/dev/crawl/
|
||||
|
||||
#include "Errno.h"
|
||||
#include "PageCrawlBot.h"
|
||||
#include "TcpServer.h"
|
||||
#include "HttpRequest.h"
|
||||
|
@ -263,9 +263,15 @@ static WebPage s_pages[] = {
|
||||
// "get queries a url matches",
|
||||
// sendPageMatchingQueries , 2 } ,
|
||||
|
||||
#ifndef CYGWIN
|
||||
{ PAGE_SEO, "seo",0,"seo" , 0 , 0 ,
|
||||
"SEO info",
|
||||
sendPageSEO , 2 } ,
|
||||
#else
|
||||
{ PAGE_SEO, "seo",0,"seo" , 0 , 0 ,
|
||||
"SEO info",
|
||||
sendPageResults , 0 } ,
|
||||
#endif
|
||||
|
||||
{ PAGE_ACCESS , "admin/access" , 0 , "access" , 1 , 1 , // usepost
|
||||
//USER_ADMIN | USER_MASTER ,
|
||||
|
@ -1,6 +1,13 @@
|
||||
#include "gb-include.h"
|
||||
|
||||
#ifdef CYGWIN
|
||||
// use a stub
|
||||
long klogctl( int, char *,int ) { return 0; }
|
||||
#else
|
||||
// otherwise, use the real one
|
||||
#include <sys/klog.h> // for klogctl
|
||||
#endif
|
||||
|
||||
#include "PingServer.h"
|
||||
#include "UdpServer.h"
|
||||
//#include "Sync.h"
|
||||
|
18
Profiler.cpp
18
Profiler.cpp
@ -1,3 +1,19 @@
|
||||
#ifdef CYGWIN
|
||||
|
||||
#include "Profiler.h"
|
||||
Profiler::Profiler(){return;}
|
||||
Profiler::~Profiler(){return;}
|
||||
bool Profiler::reset(){return true;}
|
||||
bool Profiler::init(){return true;}
|
||||
char *Profiler::getFnName(unsigned long address,long *nameLen){return NULL;}
|
||||
void Profiler::stopRealTimeProfiler(const bool keepData){return;}
|
||||
void Profiler::cleanup(){return;}
|
||||
bool Profiler:: readSymbolTable(){return true;}
|
||||
bool sendPageProfiler ( class TcpSocket *s,class HttpRequest *r){return true;}
|
||||
Profiler g_profiler;
|
||||
|
||||
#else
|
||||
|
||||
#include <execinfo.h>
|
||||
#include <assert.h>
|
||||
#include "gb-include.h"
|
||||
@ -7,6 +23,7 @@
|
||||
#include "Users.h"
|
||||
Profiler g_profiler;
|
||||
|
||||
|
||||
static int decend_cmpUll ( const void *h1 , const void *h2 );
|
||||
static int decend_cmpF ( const void *h1 , const void *h2 );
|
||||
unsigned long *indexTable;
|
||||
@ -1750,3 +1767,4 @@ Profiler::getNewFrameTrace(const uint32_t addr) {
|
||||
return m_frameTraces[m_numUsedFrameTraces++].set(addr);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -399,8 +399,8 @@ long SafeBuf::dumpToFile(char *filename ) {
|
||||
if ( fd < 0 ) {
|
||||
// valgrind
|
||||
if ( errno == EINTR ) goto retry22;
|
||||
log("safebuf: Failed to open %s for writing: ",
|
||||
filename);
|
||||
log("safebuf: Failed to open %s for writing: %s",
|
||||
filename,mstrerror(errno));
|
||||
return -1;
|
||||
}
|
||||
//logf(LOG_DEBUG, "test: safebuf %li bytes written to %s",m_length,
|
||||
|
22
Syncdb.cpp
22
Syncdb.cpp
@ -1277,7 +1277,7 @@ void *syncStartWrapper_r ( void *state , ThreadEntry *te ) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int my_system_r ( char *cmd , long timeout );
|
||||
//int my_system_r ( char *cmd , long timeout );
|
||||
int startUp ( void *cmd );
|
||||
|
||||
void Syncdb::syncStart_r ( bool amThread ) {
|
||||
@ -1339,7 +1339,8 @@ void Syncdb::syncStart_r ( bool amThread ) {
|
||||
sprintf ( cmd , "rcp %s %s:%scoll.%s.%li/'",
|
||||
map->getFilename(),ips,dir,coll,collnum);
|
||||
log ( LOG_INFO, "sync: %s", cmd );
|
||||
if ( ( err = my_system_r ( cmd, 3600*24 ) ) ) goto hadError;
|
||||
// MDW: take out for now
|
||||
//if ( ( err = my_system_r ( cmd, 3600*24 ) ) ) goto hadError;
|
||||
|
||||
// get the file
|
||||
BigFile *f = base->m_files[k];
|
||||
@ -1354,7 +1355,8 @@ void Syncdb::syncStart_r ( bool amThread ) {
|
||||
p->m_filename,ips,dir,coll,collnum);
|
||||
// excecute
|
||||
log ( LOG_INFO, "sync: %s", cmd );
|
||||
if ( ( err = my_system_r ( cmd, 3600*24 ) ) ) goto hadError;
|
||||
// MDW: take out for now
|
||||
//if ( ( err = my_system_r ( cmd, 3600*24 ) ) ) goto hadError;
|
||||
|
||||
}
|
||||
}
|
||||
@ -1376,7 +1378,8 @@ void Syncdb::syncStart_r ( bool amThread ) {
|
||||
);
|
||||
// excecute
|
||||
log ( LOG_INFO, "sync: %s", cmd );
|
||||
if ( ( err = my_system_r ( cmd, 3600*24 ) ) ) goto hadError;
|
||||
// MDW: take out for now
|
||||
//if ( ( err = my_system_r ( cmd, 3600*24 ) ) ) goto hadError;
|
||||
|
||||
|
||||
// loop over the files in Process.cpp
|
||||
@ -1387,26 +1390,29 @@ void Syncdb::syncStart_r ( bool amThread ) {
|
||||
mydir,g_files[i],ips,dir);
|
||||
// excecute
|
||||
log ( LOG_INFO, "sync: %s", cmd );
|
||||
if ( ( err = my_system_r ( cmd, 3600*24 ) ) ) goto hadError;
|
||||
// MDW: take out for now
|
||||
//if ( ( err = my_system_r ( cmd, 3600*24 ) ) ) goto hadError;
|
||||
}
|
||||
|
||||
// new guy is NOT in sync
|
||||
sprintf ( cmd , "ssh %s 'echo 0 > %sinsync.dat", ips,dir);
|
||||
// excecute
|
||||
log ( LOG_INFO, "sync: %s", cmd );
|
||||
if ( ( err = my_system_r ( cmd, 3600*24 ) ) ) goto hadError;
|
||||
// MDW: take out for now
|
||||
//if ( ( err = my_system_r ( cmd, 3600*24 ) ) ) goto hadError;
|
||||
|
||||
// saved files
|
||||
sprintf ( cmd , "rcp %s*-saved.dat %s:%sinsync.dat",
|
||||
mydir,ips,dir);
|
||||
// excecute
|
||||
log ( LOG_INFO, "sync: %s", cmd );
|
||||
if ( ( err = my_system_r ( cmd, 3600*24 ) ) ) goto hadError;
|
||||
// MDW: take out for now
|
||||
//if ( ( err = my_system_r ( cmd, 3600*24 ) ) ) goto hadError;
|
||||
|
||||
// completed!
|
||||
return;
|
||||
|
||||
hadError:
|
||||
// hadError:
|
||||
log ( "sync: Call to system(\"%s\") had error %s.",cmd,strerror(err));
|
||||
g_hostdb.m_syncHost->m_doingSync = 0;
|
||||
g_hostdb.m_syncHost = NULL;
|
||||
|
@ -935,7 +935,7 @@ TcpSocket *TcpServer::wrapSocket ( int sd , long niceness , bool isIncoming ) {
|
||||
// (Msg3b) that take like an hour.
|
||||
s->m_timeout = 1000*60*1000;
|
||||
// a temp thang
|
||||
int parm;
|
||||
//int parm;
|
||||
// . TODO: make sure this sd will NEVER exist!!
|
||||
// . throw our TcpSocket into the array
|
||||
// . this returns -1 on error, otherwise >= 0 of the node #
|
||||
@ -947,6 +947,8 @@ TcpSocket *TcpServer::wrapSocket ( int sd , long niceness , bool isIncoming ) {
|
||||
// . we should also set TCP_CORK
|
||||
// . NOTE: we must unset this when we've written out the last bytes
|
||||
// to the send buffer
|
||||
/*
|
||||
cygwin doesn't recognize TCP_CORK
|
||||
retry:
|
||||
parm = 1;
|
||||
if ( setsockopt ( sd , SOL_TCP , TCP_CORK , &parm , sizeof(int)) < 0) {
|
||||
@ -958,6 +960,7 @@ TcpSocket *TcpServer::wrapSocket ( int sd , long niceness , bool isIncoming ) {
|
||||
mstrerror(g_errno));
|
||||
goto hadError;
|
||||
}
|
||||
*/
|
||||
// try this to fix bug of not sending all data to browser
|
||||
//struct linger ggg;
|
||||
//ggg.l_onoff = 1; // non-zero to linger on close
|
||||
@ -1598,6 +1601,7 @@ long TcpServer::writeSocket ( TcpSocket *s ) {
|
||||
// . uncork sd so write buf gets flushed
|
||||
// . return false and set g_errno on error
|
||||
// . sd should be destroyed
|
||||
/* cygwin doesn't recognize tcp_cork
|
||||
int parm = 0;
|
||||
retry11:
|
||||
if ( setsockopt (s->m_sd,SOL_TCP,TCP_CORK,&parm,sizeof(int)) < 0) {
|
||||
@ -1609,6 +1613,7 @@ long TcpServer::writeSocket ( TcpSocket *s ) {
|
||||
strerror(g_errno));
|
||||
return -1;
|
||||
}
|
||||
*/
|
||||
// if we completed sending a REQUEST then change state to
|
||||
// "reading" and return true
|
||||
if ( s->isSendingRequest() ) {
|
||||
@ -2080,7 +2085,7 @@ void acceptSocketWrapper ( int sd , void *state ) {
|
||||
TcpSocket *TcpServer::acceptSocket ( ) {
|
||||
// get the new socket descriptor, "newsd"
|
||||
struct sockaddr_in name;
|
||||
unsigned int nameLen = sizeof(sockaddr);
|
||||
socklen_t nameLen = sizeof(sockaddr);
|
||||
retry12:
|
||||
int newsd = accept ( m_sock , (sockaddr *)&name , &nameLen );
|
||||
// valgrind
|
||||
|
10
Threads.cpp
10
Threads.cpp
@ -116,13 +116,13 @@ int *__errno_location (void) {
|
||||
#define MAX_STACKS 20
|
||||
|
||||
// stack must be page aligned for mprotect
|
||||
#define PAGESIZE 8192
|
||||
#define THRPAGESIZE 8192
|
||||
|
||||
// how much of stack to use as guard space
|
||||
#define GUARDSIZE (32*1024)
|
||||
|
||||
// . crashed in saving with 800k, so try 1M
|
||||
// . must be multiple of PAGESIZE
|
||||
// . must be multiple of THRPAGESIZE
|
||||
#define STACK_SIZE ((512+256) * 1024)
|
||||
|
||||
// jeta was having some problems, but i don't think they were related to
|
||||
@ -181,7 +181,7 @@ Threads::Threads ( ) {
|
||||
void Threads::setPid ( ) {
|
||||
// set s_pid to the main process id
|
||||
#ifdef PTHREADS
|
||||
s_pid = pthread_self();
|
||||
s_pid = (pid_t)pthread_self();
|
||||
//log(LOG_INFO,
|
||||
// "threads: main process THREAD id = %lu",(long unsigned)s_pid);
|
||||
pthread_t tid = pthread_self();
|
||||
@ -343,7 +343,7 @@ bool Threads::init ( ) {
|
||||
// limit to stack we got
|
||||
if ( maxThreads > MAX_STACKS ) maxThreads = MAX_STACKS;
|
||||
// allocate the stack space
|
||||
s_stackAllocSize = STACK_SIZE * maxThreads + PAGESIZE ;
|
||||
s_stackAllocSize = STACK_SIZE * maxThreads + THRPAGESIZE ;
|
||||
// clear stack to help check for overwrites
|
||||
s_stackAlloc = (char *) mcalloc ( s_stackAllocSize , "ThreadStack" );
|
||||
if ( ! s_stackAlloc )
|
||||
@ -352,7 +352,7 @@ bool Threads::init ( ) {
|
||||
log(LOG_INIT,"thread: Using %li bytes for %li thread stacks.",
|
||||
s_stackAllocSize,maxThreads);
|
||||
// align
|
||||
s_stack = (char *)(((int) s_stackAlloc + PAGESIZE-1) & ~(PAGESIZE-1));
|
||||
s_stack = (char *)(((int)s_stackAlloc+THRPAGESIZE-1)&~(THRPAGESIZE-1));
|
||||
// new size
|
||||
s_stackSize = s_stackAllocSize - (s_stack - s_stackAlloc);
|
||||
// protect the whole stack while not in use
|
||||
|
@ -1178,7 +1178,7 @@ long UdpServer::readSock_ass ( UdpSlot **slotPtr , long long now ) {
|
||||
// now peek at the first few bytes of the dgram to get some info
|
||||
char peek[32];
|
||||
sockaddr_in from;
|
||||
unsigned fromLen = sizeof ( struct sockaddr );
|
||||
socklen_t fromLen = sizeof ( struct sockaddr );
|
||||
// how many bytes should we peek at to get basic info about the msg
|
||||
long maxPeekSize = m_proto->getMaxPeekSize();
|
||||
// watch out for overflow
|
||||
|
@ -1,7 +1,7 @@
|
||||
#undef _XOPEN_SOURCE
|
||||
#define _XOPEN_SOURCE 500
|
||||
#include "gb-include.h"
|
||||
#include "strings.h"
|
||||
//#include "strings.h"
|
||||
|
||||
#include "Wiktionary.h"
|
||||
|
||||
@ -284,7 +284,8 @@ bool Wiktionary::load() {
|
||||
h = hash64 ( tail1 , 1000 , h );
|
||||
h = hash64 ( tail2 , 1000 , h );
|
||||
long long nn = -662959013613045013LL;//-6197041242898026762LL;
|
||||
if ( h != nn ) {
|
||||
long long nn2 = -2511412928924361809;
|
||||
if ( h != nn && h != nn2 ) {
|
||||
log("gb: %s or %s checksum is not approved for "
|
||||
"live service (%lli != %lli)", ff3, ff4,
|
||||
h,nn);
|
||||
|
17
XmlDoc.cpp
17
XmlDoc.cpp
@ -16024,7 +16024,7 @@ void *filterStartWrapper_r ( void *state , ThreadEntry *te ) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int my_system_r ( char *cmd , long timeout ) ;
|
||||
//int my_system_r ( char *cmd , long timeout ) ;
|
||||
|
||||
// sets m_errno on error
|
||||
void XmlDoc::filterStart_r ( bool amThread ) {
|
||||
@ -16200,13 +16200,15 @@ void XmlDoc::filterStart_r ( bool amThread ) {
|
||||
//m_filteredContentAllocSize = 0;
|
||||
}
|
||||
|
||||
pid_t g_pid = -1;
|
||||
long g_ticker = 0;
|
||||
long g_filterTimeout = -1;
|
||||
|
||||
/*
|
||||
static int startUp ( void *cmd ) ;
|
||||
#include <sys/types.h> // waitpid()
|
||||
#include <sys/wait.h> // waitpid()
|
||||
#include <sched.h> // clone()
|
||||
pid_t g_pid = -1;
|
||||
long g_ticker = 0;
|
||||
long g_filterTimeout = -1;
|
||||
|
||||
static char cloneStack[250000];
|
||||
|
||||
@ -16263,7 +16265,6 @@ int my_system_r ( char *cmd , long timeout ) {
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
int startUp ( void *cmd ) {
|
||||
char *argv[4];
|
||||
argv[0] = "sh";
|
||||
@ -16281,6 +16282,7 @@ int startUp ( void *cmd ) {
|
||||
//exit(127);
|
||||
return 1;
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
|
||||
@ -30204,9 +30206,12 @@ int gbcompress ( unsigned char *dest ,
|
||||
method, windowBits,
|
||||
memLevel, strategy);
|
||||
if (err != Z_OK) return err;
|
||||
|
||||
|
||||
// cygwin uses the system libz.a which is not hacked for our quickpoll
|
||||
#ifndef CYGWIN
|
||||
// tell deflat() to call quickpoll
|
||||
setQuickPoll ( (char *)&g_loop.m_needsToQuickPoll , deflateQuickPoll );
|
||||
#endif
|
||||
|
||||
err = deflate(&stream, Z_FINISH);
|
||||
if (err != Z_STREAM_END) {
|
||||
|
@ -1,47 +0,0 @@
|
||||
// Low-level type for atomic operations -*- C++ -*-
|
||||
|
||||
// Copyright (C) 2004-2013 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// Under Section 7 of GPL version 3, you are granted additional
|
||||
// permissions described in the GCC Runtime Library Exception, version
|
||||
// 3.1, as published by the Free Software Foundation.
|
||||
|
||||
// You should have received a copy of the GNU General Public License and
|
||||
// a copy of the GCC Runtime Library Exception along with this program;
|
||||
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
/** @file atomic_word.h
|
||||
* This file is a GNU extension to the Standard C++ Library.
|
||||
*/
|
||||
|
||||
#ifndef _GLIBCXX_ATOMIC_WORD_H
|
||||
#define _GLIBCXX_ATOMIC_WORD_H 1
|
||||
|
||||
typedef int _Atomic_word;
|
||||
|
||||
// Define these two macros using the appropriate memory barrier for the target.
|
||||
// The commented out versions below are the defaults.
|
||||
// See ia64/atomic_word.h for an alternative approach.
|
||||
|
||||
// This one prevents loads from being hoisted across the barrier;
|
||||
// in other words, this is a Load-Load acquire barrier.
|
||||
// This is necessary iff TARGET_RELAXED_ORDERING is defined in tm.h.
|
||||
// #define _GLIBCXX_READ_MEM_BARRIER __asm __volatile ("":::"memory")
|
||||
|
||||
// This one prevents stores from being sunk across the barrier; in other
|
||||
// words, a Store-Store release barrier.
|
||||
// #define _GLIBCXX_WRITE_MEM_BARRIER __asm __volatile ("":::"memory")
|
||||
|
||||
#endif
|
@ -1,110 +0,0 @@
|
||||
// Wrapper of C-language FILE struct -*- C++ -*-
|
||||
|
||||
// Copyright (C) 2000-2013 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// Under Section 7 of GPL version 3, you are granted additional
|
||||
// permissions described in the GCC Runtime Library Exception, version
|
||||
// 3.1, as published by the Free Software Foundation.
|
||||
|
||||
// You should have received a copy of the GNU General Public License and
|
||||
// a copy of the GCC Runtime Library Exception along with this program;
|
||||
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
//
|
||||
// ISO C++ 14882: 27.8 File-based streams
|
||||
//
|
||||
|
||||
/** @file bits/basic_file.h
|
||||
* This is an internal header file, included by other library headers.
|
||||
* Do not attempt to use it directly. @headername{ios}
|
||||
*/
|
||||
|
||||
#ifndef _GLIBCXX_BASIC_FILE_STDIO_H
|
||||
#define _GLIBCXX_BASIC_FILE_STDIO_H 1
|
||||
|
||||
#pragma GCC system_header
|
||||
|
||||
#include <bits/c++config.h>
|
||||
#include <bits/c++io.h> // for __c_lock and __c_file
|
||||
#include <ios>
|
||||
|
||||
namespace std _GLIBCXX_VISIBILITY(default)
|
||||
{
|
||||
_GLIBCXX_BEGIN_NAMESPACE_VERSION
|
||||
|
||||
// Generic declaration.
|
||||
template<typename _CharT>
|
||||
class __basic_file;
|
||||
|
||||
// Specialization.
|
||||
template<>
|
||||
class __basic_file<char>
|
||||
{
|
||||
// Underlying data source/sink.
|
||||
__c_file* _M_cfile;
|
||||
|
||||
// True iff we opened _M_cfile, and thus must close it ourselves.
|
||||
bool _M_cfile_created;
|
||||
|
||||
public:
|
||||
__basic_file(__c_lock* __lock = 0) throw ();
|
||||
|
||||
__basic_file*
|
||||
open(const char* __name, ios_base::openmode __mode, int __prot = 0664);
|
||||
|
||||
__basic_file*
|
||||
sys_open(__c_file* __file, ios_base::openmode);
|
||||
|
||||
__basic_file*
|
||||
sys_open(int __fd, ios_base::openmode __mode) throw ();
|
||||
|
||||
__basic_file*
|
||||
close();
|
||||
|
||||
_GLIBCXX_PURE bool
|
||||
is_open() const throw ();
|
||||
|
||||
_GLIBCXX_PURE int
|
||||
fd() throw ();
|
||||
|
||||
_GLIBCXX_PURE __c_file*
|
||||
file() throw ();
|
||||
|
||||
~__basic_file();
|
||||
|
||||
streamsize
|
||||
xsputn(const char* __s, streamsize __n);
|
||||
|
||||
streamsize
|
||||
xsputn_2(const char* __s1, streamsize __n1,
|
||||
const char* __s2, streamsize __n2);
|
||||
|
||||
streamsize
|
||||
xsgetn(char* __s, streamsize __n);
|
||||
|
||||
streamoff
|
||||
seekoff(streamoff __off, ios_base::seekdir __way) throw ();
|
||||
|
||||
int
|
||||
sync();
|
||||
|
||||
streamsize
|
||||
showmanyc();
|
||||
};
|
||||
|
||||
_GLIBCXX_END_NAMESPACE_VERSION
|
||||
} // namespace
|
||||
|
||||
#endif
|
@ -1,55 +0,0 @@
|
||||
// Base to std::allocator -*- C++ -*-
|
||||
|
||||
// Copyright (C) 2004-2013 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// Under Section 7 of GPL version 3, you are granted additional
|
||||
// permissions described in the GCC Runtime Library Exception, version
|
||||
// 3.1, as published by the Free Software Foundation.
|
||||
|
||||
// You should have received a copy of the GNU General Public License and
|
||||
// a copy of the GCC Runtime Library Exception along with this program;
|
||||
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
/** @file bits/c++allocator.h
|
||||
* This is an internal header file, included by other library headers.
|
||||
* Do not attempt to use it directly. @headername{memory}
|
||||
*/
|
||||
|
||||
#ifndef _GLIBCXX_CXX_ALLOCATOR_H
|
||||
#define _GLIBCXX_CXX_ALLOCATOR_H 1
|
||||
|
||||
#include <ext/new_allocator.h>
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
namespace std
|
||||
{
|
||||
/**
|
||||
* @brief An alias to the base class for std::allocator.
|
||||
* @ingroup allocators
|
||||
*
|
||||
* Used to set the std::allocator base class to
|
||||
* __gnu_cxx::new_allocator.
|
||||
*
|
||||
* @tparam _Tp Type of allocated object.
|
||||
*/
|
||||
template<typename _Tp>
|
||||
using __allocator_base = __gnu_cxx::new_allocator<_Tp>;
|
||||
}
|
||||
#else
|
||||
// Define new_allocator as the base class to std::allocator.
|
||||
# define __allocator_base __gnu_cxx::new_allocator
|
||||
#endif
|
||||
|
||||
#endif
|
1666
bits/c++config.h
1666
bits/c++config.h
File diff suppressed because it is too large
Load Diff
50
bits/c++io.h
50
bits/c++io.h
@ -1,50 +0,0 @@
|
||||
// Underlying io library details -*- C++ -*-
|
||||
|
||||
// Copyright (C) 2000-2013 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// Under Section 7 of GPL version 3, you are granted additional
|
||||
// permissions described in the GCC Runtime Library Exception, version
|
||||
// 3.1, as published by the Free Software Foundation.
|
||||
|
||||
// You should have received a copy of the GNU General Public License and
|
||||
// a copy of the GCC Runtime Library Exception along with this program;
|
||||
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
/** @file bits/c++io.h
|
||||
* This is an internal header file, included by other library headers.
|
||||
* Do not attempt to use it directly. @headername{ios}
|
||||
*/
|
||||
|
||||
// c_io_stdio.h - Defines for using "C" stdio.h
|
||||
|
||||
#ifndef _GLIBCXX_CXX_IO_H
|
||||
#define _GLIBCXX_CXX_IO_H 1
|
||||
|
||||
#include <cstdio>
|
||||
#include <bits/gthr.h>
|
||||
|
||||
namespace std _GLIBCXX_VISIBILITY(default)
|
||||
{
|
||||
_GLIBCXX_BEGIN_NAMESPACE_VERSION
|
||||
|
||||
typedef __gthread_mutex_t __c_lock;
|
||||
|
||||
// for basic_file.h
|
||||
typedef FILE __c_file;
|
||||
|
||||
_GLIBCXX_END_NAMESPACE_VERSION
|
||||
} // namespace
|
||||
|
||||
#endif
|
114
bits/c++locale.h
114
bits/c++locale.h
@ -1,114 +0,0 @@
|
||||
// Wrapper for underlying C-language localization -*- C++ -*-
|
||||
|
||||
// Copyright (C) 2001-2013 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// Under Section 7 of GPL version 3, you are granted additional
|
||||
// permissions described in the GCC Runtime Library Exception, version
|
||||
// 3.1, as published by the Free Software Foundation.
|
||||
|
||||
// You should have received a copy of the GNU General Public License and
|
||||
// a copy of the GCC Runtime Library Exception along with this program;
|
||||
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
/** @file bits/c++locale.h
|
||||
* This is an internal header file, included by other library headers.
|
||||
* Do not attempt to use it directly. @headername{locale}
|
||||
*/
|
||||
|
||||
//
|
||||
// ISO C++ 14882: 22.8 Standard locale categories.
|
||||
//
|
||||
|
||||
// Written by Benjamin Kosnik <bkoz@redhat.com>
|
||||
|
||||
#ifndef _GLIBCXX_CXX_LOCALE_H
|
||||
#define _GLIBCXX_CXX_LOCALE_H 1
|
||||
|
||||
#pragma GCC system_header
|
||||
|
||||
#include <clocale>
|
||||
|
||||
#define _GLIBCXX_C_LOCALE_GNU 1
|
||||
|
||||
#define _GLIBCXX_NUM_CATEGORIES 6
|
||||
|
||||
#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2)
|
||||
namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
|
||||
{
|
||||
_GLIBCXX_BEGIN_NAMESPACE_VERSION
|
||||
|
||||
extern "C" __typeof(uselocale) __uselocale;
|
||||
|
||||
_GLIBCXX_END_NAMESPACE_VERSION
|
||||
} // namespace
|
||||
#endif
|
||||
|
||||
namespace std _GLIBCXX_VISIBILITY(default)
|
||||
{
|
||||
_GLIBCXX_BEGIN_NAMESPACE_VERSION
|
||||
|
||||
typedef __locale_t __c_locale;
|
||||
|
||||
// Convert numeric value of type double and long double to string and
|
||||
// return length of string. If vsnprintf is available use it, otherwise
|
||||
// fall back to the unsafe vsprintf which, in general, can be dangerous
|
||||
// and should be avoided.
|
||||
inline int
|
||||
__convert_from_v(const __c_locale& __cloc __attribute__ ((__unused__)),
|
||||
char* __out,
|
||||
const int __size __attribute__ ((__unused__)),
|
||||
const char* __fmt, ...)
|
||||
{
|
||||
#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2)
|
||||
__c_locale __old = __gnu_cxx::__uselocale(__cloc);
|
||||
#else
|
||||
char* __old = std::setlocale(LC_NUMERIC, 0);
|
||||
char* __sav = 0;
|
||||
if (__builtin_strcmp(__old, "C"))
|
||||
{
|
||||
const size_t __len = __builtin_strlen(__old) + 1;
|
||||
__sav = new char[__len];
|
||||
__builtin_memcpy(__sav, __old, __len);
|
||||
std::setlocale(LC_NUMERIC, "C");
|
||||
}
|
||||
#endif
|
||||
|
||||
__builtin_va_list __args;
|
||||
__builtin_va_start(__args, __fmt);
|
||||
|
||||
#ifdef _GLIBCXX_USE_C99
|
||||
const int __ret = __builtin_vsnprintf(__out, __size, __fmt, __args);
|
||||
#else
|
||||
const int __ret = __builtin_vsprintf(__out, __fmt, __args);
|
||||
#endif
|
||||
|
||||
__builtin_va_end(__args);
|
||||
|
||||
#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2)
|
||||
__gnu_cxx::__uselocale(__old);
|
||||
#else
|
||||
if (__sav)
|
||||
{
|
||||
std::setlocale(LC_NUMERIC, __sav);
|
||||
delete [] __sav;
|
||||
}
|
||||
#endif
|
||||
return __ret;
|
||||
}
|
||||
|
||||
_GLIBCXX_END_NAMESPACE_VERSION
|
||||
} // namespace
|
||||
|
||||
#endif
|
@ -1,33 +0,0 @@
|
||||
// Specific definitions for generic platforms -*- C++ -*-
|
||||
|
||||
// Copyright (C) 2005-2013 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// Under Section 7 of GPL version 3, you are granted additional
|
||||
// permissions described in the GCC Runtime Library Exception, version
|
||||
// 3.1, as published by the Free Software Foundation.
|
||||
|
||||
// You should have received a copy of the GNU General Public License and
|
||||
// a copy of the GCC Runtime Library Exception along with this program;
|
||||
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
/** @file bits/cpu_defines.h
|
||||
* This is an internal header file, included by other library headers.
|
||||
* Do not attempt to use it directly. @headername{iosfwd}
|
||||
*/
|
||||
|
||||
#ifndef _GLIBCXX_CPU_DEFINES
|
||||
#define _GLIBCXX_CPU_DEFINES 1
|
||||
|
||||
#endif
|
@ -1,63 +0,0 @@
|
||||
// Locale support -*- C++ -*-
|
||||
|
||||
// Copyright (C) 1997-2013 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// Under Section 7 of GPL version 3, you are granted additional
|
||||
// permissions described in the GCC Runtime Library Exception, version
|
||||
// 3.1, as published by the Free Software Foundation.
|
||||
|
||||
// You should have received a copy of the GNU General Public License and
|
||||
// a copy of the GCC Runtime Library Exception along with this program;
|
||||
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
/** @file bits/ctype_base.h
|
||||
* This is an internal header file, included by other library headers.
|
||||
* Do not attempt to use it directly. @headername{locale}
|
||||
*/
|
||||
|
||||
//
|
||||
// ISO C++ 14882: 22.1 Locales
|
||||
//
|
||||
|
||||
// Information as gleaned from /usr/include/ctype.h
|
||||
|
||||
namespace std _GLIBCXX_VISIBILITY(default)
|
||||
{
|
||||
_GLIBCXX_BEGIN_NAMESPACE_VERSION
|
||||
|
||||
/// @brief Base class for ctype.
|
||||
struct ctype_base
|
||||
{
|
||||
// Non-standard typedefs.
|
||||
typedef const int* __to_type;
|
||||
|
||||
// NB: Offsets into ctype<char>::_M_table force a particular size
|
||||
// on the mask type. Because of this, we don't use an enum.
|
||||
typedef unsigned short mask;
|
||||
static const mask upper = _ISupper;
|
||||
static const mask lower = _ISlower;
|
||||
static const mask alpha = _ISalpha;
|
||||
static const mask digit = _ISdigit;
|
||||
static const mask xdigit = _ISxdigit;
|
||||
static const mask space = _ISspace;
|
||||
static const mask print = _ISprint;
|
||||
static const mask graph = _ISalpha | _ISdigit | _ISpunct;
|
||||
static const mask cntrl = _IScntrl;
|
||||
static const mask punct = _ISpunct;
|
||||
static const mask alnum = _ISalpha | _ISdigit;
|
||||
};
|
||||
|
||||
_GLIBCXX_END_NAMESPACE_VERSION
|
||||
} // namespace
|
@ -1,76 +0,0 @@
|
||||
// Locale support -*- C++ -*-
|
||||
|
||||
// Copyright (C) 2000-2013 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// Under Section 7 of GPL version 3, you are granted additional
|
||||
// permissions described in the GCC Runtime Library Exception, version
|
||||
// 3.1, as published by the Free Software Foundation.
|
||||
|
||||
// You should have received a copy of the GNU General Public License and
|
||||
// a copy of the GCC Runtime Library Exception along with this program;
|
||||
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
/** @file bits/ctype_inline.h
|
||||
* This is an internal header file, included by other library headers.
|
||||
* Do not attempt to use it directly. @headername{locale}
|
||||
*/
|
||||
|
||||
//
|
||||
// ISO C++ 14882: 22.1 Locales
|
||||
//
|
||||
|
||||
// ctype bits to be inlined go here. Non-inlinable (ie virtual do_*)
|
||||
// functions go in ctype.cc
|
||||
|
||||
namespace std _GLIBCXX_VISIBILITY(default)
|
||||
{
|
||||
_GLIBCXX_BEGIN_NAMESPACE_VERSION
|
||||
|
||||
bool
|
||||
ctype<char>::
|
||||
is(mask __m, char __c) const
|
||||
{ return _M_table[static_cast<unsigned char>(__c)] & __m; }
|
||||
|
||||
const char*
|
||||
ctype<char>::
|
||||
is(const char* __low, const char* __high, mask* __vec) const
|
||||
{
|
||||
while (__low < __high)
|
||||
*__vec++ = _M_table[static_cast<unsigned char>(*__low++)];
|
||||
return __high;
|
||||
}
|
||||
|
||||
const char*
|
||||
ctype<char>::
|
||||
scan_is(mask __m, const char* __low, const char* __high) const
|
||||
{
|
||||
while (__low < __high
|
||||
&& !(_M_table[static_cast<unsigned char>(*__low)] & __m))
|
||||
++__low;
|
||||
return __low;
|
||||
}
|
||||
|
||||
const char*
|
||||
ctype<char>::
|
||||
scan_not(mask __m, const char* __low, const char* __high) const
|
||||
{
|
||||
while (__low < __high
|
||||
&& (_M_table[static_cast<unsigned char>(*__low)] & __m) != 0)
|
||||
++__low;
|
||||
return __low;
|
||||
}
|
||||
|
||||
_GLIBCXX_END_NAMESPACE_VERSION
|
||||
} // namespace
|
@ -1,59 +0,0 @@
|
||||
// Control various target specific ABI tweaks. Generic version.
|
||||
|
||||
// Copyright (C) 2004-2013 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// Under Section 7 of GPL version 3, you are granted additional
|
||||
// permissions described in the GCC Runtime Library Exception, version
|
||||
// 3.1, as published by the Free Software Foundation.
|
||||
|
||||
// You should have received a copy of the GNU General Public License and
|
||||
// a copy of the GCC Runtime Library Exception along with this program;
|
||||
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
/** @file bits/cxxabi_tweaks.h
|
||||
* This is an internal header file, included by other library headers.
|
||||
* Do not attempt to use it directly. @headername{cxxabi.h}
|
||||
*/
|
||||
|
||||
#ifndef _CXXABI_TWEAKS_H
|
||||
#define _CXXABI_TWEAKS_H 1
|
||||
|
||||
#ifdef __cplusplus
|
||||
namespace __cxxabiv1
|
||||
{
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
// The generic ABI uses the first byte of a 64-bit guard variable.
|
||||
#define _GLIBCXX_GUARD_TEST(x) (*(char *) (x) != 0)
|
||||
#define _GLIBCXX_GUARD_SET(x) *(char *) (x) = 1
|
||||
#define _GLIBCXX_GUARD_BIT __guard_test_bit (0, 1)
|
||||
#define _GLIBCXX_GUARD_PENDING_BIT __guard_test_bit (1, 1)
|
||||
#define _GLIBCXX_GUARD_WAITING_BIT __guard_test_bit (2, 1)
|
||||
__extension__ typedef int __guard __attribute__((mode (__DI__)));
|
||||
|
||||
// __cxa_vec_ctor has void return type.
|
||||
typedef void __cxa_vec_ctor_return_type;
|
||||
#define _GLIBCXX_CXA_VEC_CTOR_RETURN(x) return
|
||||
// Constructors and destructors do not return a value.
|
||||
typedef void __cxa_cdtor_return_type;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
} // namespace __cxxabiv1
|
||||
#endif
|
||||
|
||||
#endif
|
@ -1,178 +0,0 @@
|
||||
// Specific definitions for generic platforms -*- C++ -*-
|
||||
|
||||
// Copyright (C) 2007-2013 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// Under Section 7 of GPL version 3, you are granted additional
|
||||
// permissions described in the GCC Runtime Library Exception, version
|
||||
// 3.1, as published by the Free Software Foundation.
|
||||
|
||||
// You should have received a copy of the GNU General Public License and
|
||||
// a copy of the GCC Runtime Library Exception along with this program;
|
||||
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
/** @file bits/error_constants.h
|
||||
* This is an internal header file, included by other library headers.
|
||||
* Do not attempt to use it directly. @headername{system_error}
|
||||
*/
|
||||
|
||||
#ifndef _GLIBCXX_ERROR_CONSTANTS
|
||||
#define _GLIBCXX_ERROR_CONSTANTS 1
|
||||
|
||||
#include <bits/c++config.h>
|
||||
#include <cerrno>
|
||||
|
||||
namespace std _GLIBCXX_VISIBILITY(default)
|
||||
{
|
||||
_GLIBCXX_BEGIN_NAMESPACE_VERSION
|
||||
|
||||
enum class errc
|
||||
{
|
||||
address_family_not_supported = EAFNOSUPPORT,
|
||||
address_in_use = EADDRINUSE,
|
||||
address_not_available = EADDRNOTAVAIL,
|
||||
already_connected = EISCONN,
|
||||
argument_list_too_long = E2BIG,
|
||||
argument_out_of_domain = EDOM,
|
||||
bad_address = EFAULT,
|
||||
bad_file_descriptor = EBADF,
|
||||
|
||||
#ifdef _GLIBCXX_HAVE_EBADMSG
|
||||
bad_message = EBADMSG,
|
||||
#endif
|
||||
|
||||
broken_pipe = EPIPE,
|
||||
connection_aborted = ECONNABORTED,
|
||||
connection_already_in_progress = EALREADY,
|
||||
connection_refused = ECONNREFUSED,
|
||||
connection_reset = ECONNRESET,
|
||||
cross_device_link = EXDEV,
|
||||
destination_address_required = EDESTADDRREQ,
|
||||
device_or_resource_busy = EBUSY,
|
||||
directory_not_empty = ENOTEMPTY,
|
||||
executable_format_error = ENOEXEC,
|
||||
file_exists = EEXIST,
|
||||
file_too_large = EFBIG,
|
||||
filename_too_long = ENAMETOOLONG,
|
||||
function_not_supported = ENOSYS,
|
||||
host_unreachable = EHOSTUNREACH,
|
||||
|
||||
#ifdef _GLIBCXX_HAVE_EIDRM
|
||||
identifier_removed = EIDRM,
|
||||
#endif
|
||||
|
||||
illegal_byte_sequence = EILSEQ,
|
||||
inappropriate_io_control_operation = ENOTTY,
|
||||
interrupted = EINTR,
|
||||
invalid_argument = EINVAL,
|
||||
invalid_seek = ESPIPE,
|
||||
io_error = EIO,
|
||||
is_a_directory = EISDIR,
|
||||
message_size = EMSGSIZE,
|
||||
network_down = ENETDOWN,
|
||||
network_reset = ENETRESET,
|
||||
network_unreachable = ENETUNREACH,
|
||||
no_buffer_space = ENOBUFS,
|
||||
no_child_process = ECHILD,
|
||||
|
||||
#ifdef _GLIBCXX_HAVE_ENOLINK
|
||||
no_link = ENOLINK,
|
||||
#endif
|
||||
|
||||
no_lock_available = ENOLCK,
|
||||
|
||||
#ifdef _GLIBCXX_HAVE_ENODATA
|
||||
no_message_available = ENODATA,
|
||||
#endif
|
||||
|
||||
no_message = ENOMSG,
|
||||
no_protocol_option = ENOPROTOOPT,
|
||||
no_space_on_device = ENOSPC,
|
||||
|
||||
#ifdef _GLIBCXX_HAVE_ENOSR
|
||||
no_stream_resources = ENOSR,
|
||||
#endif
|
||||
|
||||
no_such_device_or_address = ENXIO,
|
||||
no_such_device = ENODEV,
|
||||
no_such_file_or_directory = ENOENT,
|
||||
no_such_process = ESRCH,
|
||||
not_a_directory = ENOTDIR,
|
||||
not_a_socket = ENOTSOCK,
|
||||
|
||||
#ifdef _GLIBCXX_HAVE_ENOSTR
|
||||
not_a_stream = ENOSTR,
|
||||
#endif
|
||||
|
||||
not_connected = ENOTCONN,
|
||||
not_enough_memory = ENOMEM,
|
||||
|
||||
#ifdef _GLIBCXX_HAVE_ENOTSUP
|
||||
not_supported = ENOTSUP,
|
||||
#endif
|
||||
|
||||
#ifdef _GLIBCXX_HAVE_ECANCELED
|
||||
operation_canceled = ECANCELED,
|
||||
#endif
|
||||
|
||||
operation_in_progress = EINPROGRESS,
|
||||
operation_not_permitted = EPERM,
|
||||
operation_not_supported = EOPNOTSUPP,
|
||||
operation_would_block = EWOULDBLOCK,
|
||||
|
||||
#ifdef _GLIBCXX_HAVE_EOWNERDEAD
|
||||
owner_dead = EOWNERDEAD,
|
||||
#endif
|
||||
|
||||
permission_denied = EACCES,
|
||||
|
||||
#ifdef _GLIBCXX_HAVE_EPROTO
|
||||
protocol_error = EPROTO,
|
||||
#endif
|
||||
|
||||
protocol_not_supported = EPROTONOSUPPORT,
|
||||
read_only_file_system = EROFS,
|
||||
resource_deadlock_would_occur = EDEADLK,
|
||||
resource_unavailable_try_again = EAGAIN,
|
||||
result_out_of_range = ERANGE,
|
||||
|
||||
#ifdef _GLIBCXX_HAVE_ENOTRECOVERABLE
|
||||
state_not_recoverable = ENOTRECOVERABLE,
|
||||
#endif
|
||||
|
||||
#ifdef _GLIBCXX_HAVE_ETIME
|
||||
stream_timeout = ETIME,
|
||||
#endif
|
||||
|
||||
#ifdef _GLIBCXX_HAVE_ETXTBSY
|
||||
text_file_busy = ETXTBSY,
|
||||
#endif
|
||||
|
||||
timed_out = ETIMEDOUT,
|
||||
too_many_files_open_in_system = ENFILE,
|
||||
too_many_files_open = EMFILE,
|
||||
too_many_links = EMLINK,
|
||||
too_many_symbolic_link_levels = ELOOP,
|
||||
|
||||
#ifdef _GLIBCXX_HAVE_EOVERFLOW
|
||||
value_too_large = EOVERFLOW,
|
||||
#endif
|
||||
|
||||
wrong_protocol_type = EPROTOTYPE
|
||||
};
|
||||
|
||||
_GLIBCXX_END_NAMESPACE_VERSION
|
||||
} // namespace
|
||||
|
||||
#endif
|
@ -1,71 +0,0 @@
|
||||
// C++ includes used for precompiling extensions -*- C++ -*-
|
||||
|
||||
// Copyright (C) 2006-2013 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// Under Section 7 of GPL version 3, you are granted additional
|
||||
// permissions described in the GCC Runtime Library Exception, version
|
||||
// 3.1, as published by the Free Software Foundation.
|
||||
|
||||
// You should have received a copy of the GNU General Public License and
|
||||
// a copy of the GCC Runtime Library Exception along with this program;
|
||||
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
/** @file extc++.h
|
||||
* This is an implementation file for a precompiled header.
|
||||
*/
|
||||
|
||||
#if __cplusplus < 201103L
|
||||
#include <bits/stdtr1c++.h>
|
||||
#endif
|
||||
|
||||
#include <ext/algorithm>
|
||||
#include <ext/array_allocator.h>
|
||||
#include <ext/atomicity.h>
|
||||
#include <ext/bitmap_allocator.h>
|
||||
#include <ext/cast.h>
|
||||
#include <ext/concurrence.h>
|
||||
#include <ext/debug_allocator.h>
|
||||
#include <ext/extptr_allocator.h>
|
||||
#include <ext/functional>
|
||||
#include <ext/iterator>
|
||||
#include <ext/malloc_allocator.h>
|
||||
#include <ext/memory>
|
||||
#include <ext/mt_allocator.h>
|
||||
#include <ext/new_allocator.h>
|
||||
#include <ext/numeric>
|
||||
#include <ext/pod_char_traits.h>
|
||||
#include <ext/pointer.h>
|
||||
#include <ext/pool_allocator.h>
|
||||
#include <ext/rb_tree>
|
||||
#include <ext/rope>
|
||||
#include <ext/slist>
|
||||
#include <ext/stdio_filebuf.h>
|
||||
#include <ext/stdio_sync_filebuf.h>
|
||||
#include <ext/throw_allocator.h>
|
||||
#include <ext/typelist.h>
|
||||
#include <ext/type_traits.h>
|
||||
#include <ext/vstring.h>
|
||||
#include <ext/pb_ds/assoc_container.hpp>
|
||||
#include <ext/pb_ds/priority_queue.hpp>
|
||||
#include <ext/pb_ds/exception.hpp>
|
||||
#include <ext/pb_ds/hash_policy.hpp>
|
||||
#include <ext/pb_ds/list_update_policy.hpp>
|
||||
#include <ext/pb_ds/tree_policy.hpp>
|
||||
#include <ext/pb_ds/trie_policy.hpp>
|
||||
|
||||
#ifdef _GLIBCXX_HAVE_ICONV
|
||||
#include <ext/codecvt_specializations.h>
|
||||
#include <ext/enc_filebuf.h>
|
||||
#endif
|
@ -1,889 +0,0 @@
|
||||
/* Threads compatibility routines for libgcc2 and libobjc. */
|
||||
/* Compile this one with gcc. */
|
||||
/* Copyright (C) 1997-2013 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GCC.
|
||||
|
||||
GCC is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free
|
||||
Software Foundation; either version 3, or (at your option) any later
|
||||
version.
|
||||
|
||||
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
Under Section 7 of GPL version 3, you are granted additional
|
||||
permissions described in the GCC Runtime Library Exception, version
|
||||
3.1, as published by the Free Software Foundation.
|
||||
|
||||
You should have received a copy of the GNU General Public License and
|
||||
a copy of the GCC Runtime Library Exception along with this program;
|
||||
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef _GLIBCXX_GCC_GTHR_POSIX_H
|
||||
#define _GLIBCXX_GCC_GTHR_POSIX_H
|
||||
|
||||
/* POSIX threads specific definitions.
|
||||
Easy, since the interface is just one-to-one mapping. */
|
||||
|
||||
#define __GTHREADS 1
|
||||
#define __GTHREADS_CXX0X 1
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
#if ((defined(_LIBOBJC) || defined(_LIBOBJC_WEAK)) \
|
||||
|| !defined(_GTHREAD_USE_MUTEX_TIMEDLOCK))
|
||||
# include <unistd.h>
|
||||
# if defined(_POSIX_TIMEOUTS) && _POSIX_TIMEOUTS >= 0
|
||||
# define _GTHREAD_USE_MUTEX_TIMEDLOCK 1
|
||||
# else
|
||||
# define _GTHREAD_USE_MUTEX_TIMEDLOCK 0
|
||||
# endif
|
||||
#endif
|
||||
|
||||
typedef pthread_t __gthread_t;
|
||||
typedef pthread_key_t __gthread_key_t;
|
||||
typedef pthread_once_t __gthread_once_t;
|
||||
typedef pthread_mutex_t __gthread_mutex_t;
|
||||
typedef pthread_mutex_t __gthread_recursive_mutex_t;
|
||||
typedef pthread_cond_t __gthread_cond_t;
|
||||
typedef struct timespec __gthread_time_t;
|
||||
|
||||
/* POSIX like conditional variables are supported. Please look at comments
|
||||
in gthr.h for details. */
|
||||
#define __GTHREAD_HAS_COND 1
|
||||
|
||||
#define __GTHREAD_MUTEX_INIT PTHREAD_MUTEX_INITIALIZER
|
||||
#define __GTHREAD_MUTEX_INIT_FUNCTION __gthread_mutex_init_function
|
||||
#define __GTHREAD_ONCE_INIT PTHREAD_ONCE_INIT
|
||||
#if defined(PTHREAD_RECURSIVE_MUTEX_INITIALIZER)
|
||||
#define __GTHREAD_RECURSIVE_MUTEX_INIT PTHREAD_RECURSIVE_MUTEX_INITIALIZER
|
||||
#elif defined(PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP)
|
||||
#define __GTHREAD_RECURSIVE_MUTEX_INIT PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
|
||||
#else
|
||||
#define __GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION __gthread_recursive_mutex_init_function
|
||||
#endif
|
||||
#define __GTHREAD_COND_INIT PTHREAD_COND_INITIALIZER
|
||||
#define __GTHREAD_TIME_INIT {0,0}
|
||||
|
||||
#ifdef _GTHREAD_USE_MUTEX_INIT_FUNC
|
||||
# undef __GTHREAD_MUTEX_INIT
|
||||
#endif
|
||||
#ifdef _GTHREAD_USE_RECURSIVE_MUTEX_INIT_FUNC
|
||||
# undef __GTHREAD_RECURSIVE_MUTEX_INIT
|
||||
# undef __GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION
|
||||
# define __GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION __gthread_recursive_mutex_init_function
|
||||
#endif
|
||||
#ifdef _GTHREAD_USE_COND_INIT_FUNC
|
||||
# undef __GTHREAD_COND_INIT
|
||||
# define __GTHREAD_COND_INIT_FUNCTION __gthread_cond_init_function
|
||||
#endif
|
||||
|
||||
#if __GXX_WEAK__ && _GLIBCXX_GTHREAD_USE_WEAK
|
||||
# ifndef __gthrw_pragma
|
||||
# define __gthrw_pragma(pragma)
|
||||
# endif
|
||||
# define __gthrw2(name,name2,type) \
|
||||
static __typeof(type) name __attribute__ ((__weakref__(#name2))); \
|
||||
__gthrw_pragma(weak type)
|
||||
# define __gthrw_(name) __gthrw_ ## name
|
||||
#else
|
||||
# define __gthrw2(name,name2,type)
|
||||
# define __gthrw_(name) name
|
||||
#endif
|
||||
|
||||
/* Typically, __gthrw_foo is a weak reference to symbol foo. */
|
||||
#define __gthrw(name) __gthrw2(__gthrw_ ## name,name,name)
|
||||
|
||||
__gthrw(pthread_once)
|
||||
__gthrw(pthread_getspecific)
|
||||
__gthrw(pthread_setspecific)
|
||||
|
||||
__gthrw(pthread_create)
|
||||
__gthrw(pthread_join)
|
||||
__gthrw(pthread_equal)
|
||||
__gthrw(pthread_self)
|
||||
__gthrw(pthread_detach)
|
||||
#ifndef __BIONIC__
|
||||
__gthrw(pthread_cancel)
|
||||
#endif
|
||||
__gthrw(sched_yield)
|
||||
|
||||
__gthrw(pthread_mutex_lock)
|
||||
__gthrw(pthread_mutex_trylock)
|
||||
#if _GTHREAD_USE_MUTEX_TIMEDLOCK
|
||||
__gthrw(pthread_mutex_timedlock)
|
||||
#endif
|
||||
__gthrw(pthread_mutex_unlock)
|
||||
__gthrw(pthread_mutex_init)
|
||||
__gthrw(pthread_mutex_destroy)
|
||||
|
||||
__gthrw(pthread_cond_init)
|
||||
__gthrw(pthread_cond_broadcast)
|
||||
__gthrw(pthread_cond_signal)
|
||||
__gthrw(pthread_cond_wait)
|
||||
__gthrw(pthread_cond_timedwait)
|
||||
__gthrw(pthread_cond_destroy)
|
||||
|
||||
__gthrw(pthread_key_create)
|
||||
__gthrw(pthread_key_delete)
|
||||
__gthrw(pthread_mutexattr_init)
|
||||
__gthrw(pthread_mutexattr_settype)
|
||||
__gthrw(pthread_mutexattr_destroy)
|
||||
|
||||
|
||||
#if defined(_LIBOBJC) || defined(_LIBOBJC_WEAK)
|
||||
/* Objective-C. */
|
||||
__gthrw(pthread_exit)
|
||||
#ifdef _POSIX_PRIORITY_SCHEDULING
|
||||
#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING
|
||||
__gthrw(sched_get_priority_max)
|
||||
__gthrw(sched_get_priority_min)
|
||||
#endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */
|
||||
#endif /* _POSIX_PRIORITY_SCHEDULING */
|
||||
__gthrw(pthread_attr_destroy)
|
||||
__gthrw(pthread_attr_init)
|
||||
__gthrw(pthread_attr_setdetachstate)
|
||||
#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING
|
||||
__gthrw(pthread_getschedparam)
|
||||
__gthrw(pthread_setschedparam)
|
||||
#endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */
|
||||
#endif /* _LIBOBJC || _LIBOBJC_WEAK */
|
||||
|
||||
#if __GXX_WEAK__ && _GLIBCXX_GTHREAD_USE_WEAK
|
||||
|
||||
/* On Solaris 2.6 up to 9, the libc exposes a POSIX threads interface even if
|
||||
-pthreads is not specified. The functions are dummies and most return an
|
||||
error value. However pthread_once returns 0 without invoking the routine
|
||||
it is passed so we cannot pretend that the interface is active if -pthreads
|
||||
is not specified. On Solaris 2.5.1, the interface is not exposed at all so
|
||||
we need to play the usual game with weak symbols. On Solaris 10 and up, a
|
||||
working interface is always exposed. On FreeBSD 6 and later, libc also
|
||||
exposes a dummy POSIX threads interface, similar to what Solaris 2.6 up
|
||||
to 9 does. FreeBSD >= 700014 even provides a pthread_cancel stub in libc,
|
||||
which means the alternate __gthread_active_p below cannot be used there. */
|
||||
|
||||
#if defined(__FreeBSD__) || (defined(__sun) && defined(__svr4__))
|
||||
|
||||
static volatile int __gthread_active = -1;
|
||||
|
||||
static void
|
||||
__gthread_trigger (void)
|
||||
{
|
||||
__gthread_active = 1;
|
||||
}
|
||||
|
||||
static inline int
|
||||
__gthread_active_p (void)
|
||||
{
|
||||
static pthread_mutex_t __gthread_active_mutex = PTHREAD_MUTEX_INITIALIZER;
|
||||
static pthread_once_t __gthread_active_once = PTHREAD_ONCE_INIT;
|
||||
|
||||
/* Avoid reading __gthread_active twice on the main code path. */
|
||||
int __gthread_active_latest_value = __gthread_active;
|
||||
|
||||
/* This test is not protected to avoid taking a lock on the main code
|
||||
path so every update of __gthread_active in a threaded program must
|
||||
be atomic with regard to the result of the test. */
|
||||
if (__builtin_expect (__gthread_active_latest_value < 0, 0))
|
||||
{
|
||||
if (__gthrw_(pthread_once))
|
||||
{
|
||||
/* If this really is a threaded program, then we must ensure that
|
||||
__gthread_active has been set to 1 before exiting this block. */
|
||||
__gthrw_(pthread_mutex_lock) (&__gthread_active_mutex);
|
||||
__gthrw_(pthread_once) (&__gthread_active_once, __gthread_trigger);
|
||||
__gthrw_(pthread_mutex_unlock) (&__gthread_active_mutex);
|
||||
}
|
||||
|
||||
/* Make sure we'll never enter this block again. */
|
||||
if (__gthread_active < 0)
|
||||
__gthread_active = 0;
|
||||
|
||||
__gthread_active_latest_value = __gthread_active;
|
||||
}
|
||||
|
||||
return __gthread_active_latest_value != 0;
|
||||
}
|
||||
|
||||
#else /* neither FreeBSD nor Solaris */
|
||||
|
||||
/* For a program to be multi-threaded the only thing that it certainly must
|
||||
be using is pthread_create. However, there may be other libraries that
|
||||
intercept pthread_create with their own definitions to wrap pthreads
|
||||
functionality for some purpose. In those cases, pthread_create being
|
||||
defined might not necessarily mean that libpthread is actually linked
|
||||
in.
|
||||
|
||||
For the GNU C library, we can use a known internal name. This is always
|
||||
available in the ABI, but no other library would define it. That is
|
||||
ideal, since any public pthread function might be intercepted just as
|
||||
pthread_create might be. __pthread_key_create is an "internal"
|
||||
implementation symbol, but it is part of the public exported ABI. Also,
|
||||
it's among the symbols that the static libpthread.a always links in
|
||||
whenever pthread_create is used, so there is no danger of a false
|
||||
negative result in any statically-linked, multi-threaded program.
|
||||
|
||||
For others, we choose pthread_cancel as a function that seems unlikely
|
||||
to be redefined by an interceptor library. The bionic (Android) C
|
||||
library does not provide pthread_cancel, so we do use pthread_create
|
||||
there (and interceptor libraries lose). */
|
||||
|
||||
#ifdef __GLIBC__
|
||||
__gthrw2(__gthrw_(__pthread_key_create),
|
||||
__pthread_key_create,
|
||||
pthread_key_create)
|
||||
# define GTHR_ACTIVE_PROXY __gthrw_(__pthread_key_create)
|
||||
#elif defined (__BIONIC__)
|
||||
# define GTHR_ACTIVE_PROXY __gthrw_(pthread_create)
|
||||
#else
|
||||
# define GTHR_ACTIVE_PROXY __gthrw_(pthread_cancel)
|
||||
#endif
|
||||
|
||||
static inline int
|
||||
__gthread_active_p (void)
|
||||
{
|
||||
static void *const __gthread_active_ptr
|
||||
= __extension__ (void *) >HR_ACTIVE_PROXY;
|
||||
return __gthread_active_ptr != 0;
|
||||
}
|
||||
|
||||
#endif /* FreeBSD or Solaris */
|
||||
|
||||
#else /* not __GXX_WEAK__ */
|
||||
|
||||
/* Similar to Solaris, HP-UX 11 for PA-RISC provides stubs for pthread
|
||||
calls in shared flavors of the HP-UX C library. Most of the stubs
|
||||
have no functionality. The details are described in the "libc cumulative
|
||||
patch" for each subversion of HP-UX 11. There are two special interfaces
|
||||
provided for checking whether an application is linked to a shared pthread
|
||||
library or not. However, these interfaces aren't available in early
|
||||
libpthread libraries. We also need a test that works for archive
|
||||
libraries. We can't use pthread_once as some libc versions call the
|
||||
init function. We also can't use pthread_create or pthread_attr_init
|
||||
as these create a thread and thereby prevent changing the default stack
|
||||
size. The function pthread_default_stacksize_np is available in both
|
||||
the archive and shared versions of libpthread. It can be used to
|
||||
determine the default pthread stack size. There is a stub in some
|
||||
shared libc versions which returns a zero size if pthreads are not
|
||||
active. We provide an equivalent stub to handle cases where libc
|
||||
doesn't provide one. */
|
||||
|
||||
#if defined(__hppa__) && defined(__hpux__)
|
||||
|
||||
static volatile int __gthread_active = -1;
|
||||
|
||||
static inline int
|
||||
__gthread_active_p (void)
|
||||
{
|
||||
/* Avoid reading __gthread_active twice on the main code path. */
|
||||
int __gthread_active_latest_value = __gthread_active;
|
||||
size_t __s;
|
||||
|
||||
if (__builtin_expect (__gthread_active_latest_value < 0, 0))
|
||||
{
|
||||
pthread_default_stacksize_np (0, &__s);
|
||||
__gthread_active = __s ? 1 : 0;
|
||||
__gthread_active_latest_value = __gthread_active;
|
||||
}
|
||||
|
||||
return __gthread_active_latest_value != 0;
|
||||
}
|
||||
|
||||
#else /* not hppa-hpux */
|
||||
|
||||
static inline int
|
||||
__gthread_active_p (void)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
#endif /* hppa-hpux */
|
||||
|
||||
#endif /* __GXX_WEAK__ */
|
||||
|
||||
#ifdef _LIBOBJC
|
||||
|
||||
/* This is the config.h file in libobjc/ */
|
||||
#include <config.h>
|
||||
|
||||
#ifdef HAVE_SCHED_H
|
||||
# include <sched.h>
|
||||
#endif
|
||||
|
||||
/* Key structure for maintaining thread specific storage */
|
||||
static pthread_key_t _objc_thread_storage;
|
||||
static pthread_attr_t _objc_thread_attribs;
|
||||
|
||||
/* Thread local storage for a single thread */
|
||||
static void *thread_local_storage = NULL;
|
||||
|
||||
/* Backend initialization functions */
|
||||
|
||||
/* Initialize the threads subsystem. */
|
||||
static inline int
|
||||
__gthread_objc_init_thread_system (void)
|
||||
{
|
||||
if (__gthread_active_p ())
|
||||
{
|
||||
/* Initialize the thread storage key. */
|
||||
if (__gthrw_(pthread_key_create) (&_objc_thread_storage, NULL) == 0)
|
||||
{
|
||||
/* The normal default detach state for threads is
|
||||
* PTHREAD_CREATE_JOINABLE which causes threads to not die
|
||||
* when you think they should. */
|
||||
if (__gthrw_(pthread_attr_init) (&_objc_thread_attribs) == 0
|
||||
&& __gthrw_(pthread_attr_setdetachstate) (&_objc_thread_attribs,
|
||||
PTHREAD_CREATE_DETACHED) == 0)
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Close the threads subsystem. */
|
||||
static inline int
|
||||
__gthread_objc_close_thread_system (void)
|
||||
{
|
||||
if (__gthread_active_p ()
|
||||
&& __gthrw_(pthread_key_delete) (_objc_thread_storage) == 0
|
||||
&& __gthrw_(pthread_attr_destroy) (&_objc_thread_attribs) == 0)
|
||||
return 0;
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Backend thread functions */
|
||||
|
||||
/* Create a new thread of execution. */
|
||||
static inline objc_thread_t
|
||||
__gthread_objc_thread_detach (void (*func)(void *), void *arg)
|
||||
{
|
||||
objc_thread_t thread_id;
|
||||
pthread_t new_thread_handle;
|
||||
|
||||
if (!__gthread_active_p ())
|
||||
return NULL;
|
||||
|
||||
if (!(__gthrw_(pthread_create) (&new_thread_handle, &_objc_thread_attribs,
|
||||
(void *) func, arg)))
|
||||
thread_id = (objc_thread_t) new_thread_handle;
|
||||
else
|
||||
thread_id = NULL;
|
||||
|
||||
return thread_id;
|
||||
}
|
||||
|
||||
/* Set the current thread's priority. */
|
||||
static inline int
|
||||
__gthread_objc_thread_set_priority (int priority)
|
||||
{
|
||||
if (!__gthread_active_p ())
|
||||
return -1;
|
||||
else
|
||||
{
|
||||
#ifdef _POSIX_PRIORITY_SCHEDULING
|
||||
#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING
|
||||
pthread_t thread_id = __gthrw_(pthread_self) ();
|
||||
int policy;
|
||||
struct sched_param params;
|
||||
int priority_min, priority_max;
|
||||
|
||||
if (__gthrw_(pthread_getschedparam) (thread_id, &policy, ¶ms) == 0)
|
||||
{
|
||||
if ((priority_max = __gthrw_(sched_get_priority_max) (policy)) == -1)
|
||||
return -1;
|
||||
|
||||
if ((priority_min = __gthrw_(sched_get_priority_min) (policy)) == -1)
|
||||
return -1;
|
||||
|
||||
if (priority > priority_max)
|
||||
priority = priority_max;
|
||||
else if (priority < priority_min)
|
||||
priority = priority_min;
|
||||
params.sched_priority = priority;
|
||||
|
||||
/*
|
||||
* The solaris 7 and several other man pages incorrectly state that
|
||||
* this should be a pointer to policy but pthread.h is universally
|
||||
* at odds with this.
|
||||
*/
|
||||
if (__gthrw_(pthread_setschedparam) (thread_id, policy, ¶ms) == 0)
|
||||
return 0;
|
||||
}
|
||||
#endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */
|
||||
#endif /* _POSIX_PRIORITY_SCHEDULING */
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/* Return the current thread's priority. */
|
||||
static inline int
|
||||
__gthread_objc_thread_get_priority (void)
|
||||
{
|
||||
#ifdef _POSIX_PRIORITY_SCHEDULING
|
||||
#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING
|
||||
if (__gthread_active_p ())
|
||||
{
|
||||
int policy;
|
||||
struct sched_param params;
|
||||
|
||||
if (__gthrw_(pthread_getschedparam) (__gthrw_(pthread_self) (), &policy, ¶ms) == 0)
|
||||
return params.sched_priority;
|
||||
else
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
#endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */
|
||||
#endif /* _POSIX_PRIORITY_SCHEDULING */
|
||||
return OBJC_THREAD_INTERACTIVE_PRIORITY;
|
||||
}
|
||||
|
||||
/* Yield our process time to another thread. */
|
||||
static inline void
|
||||
__gthread_objc_thread_yield (void)
|
||||
{
|
||||
if (__gthread_active_p ())
|
||||
__gthrw_(sched_yield) ();
|
||||
}
|
||||
|
||||
/* Terminate the current thread. */
|
||||
static inline int
|
||||
__gthread_objc_thread_exit (void)
|
||||
{
|
||||
if (__gthread_active_p ())
|
||||
/* exit the thread */
|
||||
__gthrw_(pthread_exit) (&__objc_thread_exit_status);
|
||||
|
||||
/* Failed if we reached here */
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Returns an integer value which uniquely describes a thread. */
|
||||
static inline objc_thread_t
|
||||
__gthread_objc_thread_id (void)
|
||||
{
|
||||
if (__gthread_active_p ())
|
||||
return (objc_thread_t) __gthrw_(pthread_self) ();
|
||||
else
|
||||
return (objc_thread_t) 1;
|
||||
}
|
||||
|
||||
/* Sets the thread's local storage pointer. */
|
||||
static inline int
|
||||
__gthread_objc_thread_set_data (void *value)
|
||||
{
|
||||
if (__gthread_active_p ())
|
||||
return __gthrw_(pthread_setspecific) (_objc_thread_storage, value);
|
||||
else
|
||||
{
|
||||
thread_local_storage = value;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* Returns the thread's local storage pointer. */
|
||||
static inline void *
|
||||
__gthread_objc_thread_get_data (void)
|
||||
{
|
||||
if (__gthread_active_p ())
|
||||
return __gthrw_(pthread_getspecific) (_objc_thread_storage);
|
||||
else
|
||||
return thread_local_storage;
|
||||
}
|
||||
|
||||
/* Backend mutex functions */
|
||||
|
||||
/* Allocate a mutex. */
|
||||
static inline int
|
||||
__gthread_objc_mutex_allocate (objc_mutex_t mutex)
|
||||
{
|
||||
if (__gthread_active_p ())
|
||||
{
|
||||
mutex->backend = objc_malloc (sizeof (pthread_mutex_t));
|
||||
|
||||
if (__gthrw_(pthread_mutex_init) ((pthread_mutex_t *) mutex->backend, NULL))
|
||||
{
|
||||
objc_free (mutex->backend);
|
||||
mutex->backend = NULL;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Deallocate a mutex. */
|
||||
static inline int
|
||||
__gthread_objc_mutex_deallocate (objc_mutex_t mutex)
|
||||
{
|
||||
if (__gthread_active_p ())
|
||||
{
|
||||
int count;
|
||||
|
||||
/*
|
||||
* Posix Threads specifically require that the thread be unlocked
|
||||
* for __gthrw_(pthread_mutex_destroy) to work.
|
||||
*/
|
||||
|
||||
do
|
||||
{
|
||||
count = __gthrw_(pthread_mutex_unlock) ((pthread_mutex_t *) mutex->backend);
|
||||
if (count < 0)
|
||||
return -1;
|
||||
}
|
||||
while (count);
|
||||
|
||||
if (__gthrw_(pthread_mutex_destroy) ((pthread_mutex_t *) mutex->backend))
|
||||
return -1;
|
||||
|
||||
objc_free (mutex->backend);
|
||||
mutex->backend = NULL;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Grab a lock on a mutex. */
|
||||
static inline int
|
||||
__gthread_objc_mutex_lock (objc_mutex_t mutex)
|
||||
{
|
||||
if (__gthread_active_p ()
|
||||
&& __gthrw_(pthread_mutex_lock) ((pthread_mutex_t *) mutex->backend) != 0)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Try to grab a lock on a mutex. */
|
||||
static inline int
|
||||
__gthread_objc_mutex_trylock (objc_mutex_t mutex)
|
||||
{
|
||||
if (__gthread_active_p ()
|
||||
&& __gthrw_(pthread_mutex_trylock) ((pthread_mutex_t *) mutex->backend) != 0)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Unlock the mutex */
|
||||
static inline int
|
||||
__gthread_objc_mutex_unlock (objc_mutex_t mutex)
|
||||
{
|
||||
if (__gthread_active_p ()
|
||||
&& __gthrw_(pthread_mutex_unlock) ((pthread_mutex_t *) mutex->backend) != 0)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Backend condition mutex functions */
|
||||
|
||||
/* Allocate a condition. */
|
||||
static inline int
|
||||
__gthread_objc_condition_allocate (objc_condition_t condition)
|
||||
{
|
||||
if (__gthread_active_p ())
|
||||
{
|
||||
condition->backend = objc_malloc (sizeof (pthread_cond_t));
|
||||
|
||||
if (__gthrw_(pthread_cond_init) ((pthread_cond_t *) condition->backend, NULL))
|
||||
{
|
||||
objc_free (condition->backend);
|
||||
condition->backend = NULL;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Deallocate a condition. */
|
||||
static inline int
|
||||
__gthread_objc_condition_deallocate (objc_condition_t condition)
|
||||
{
|
||||
if (__gthread_active_p ())
|
||||
{
|
||||
if (__gthrw_(pthread_cond_destroy) ((pthread_cond_t *) condition->backend))
|
||||
return -1;
|
||||
|
||||
objc_free (condition->backend);
|
||||
condition->backend = NULL;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Wait on the condition */
|
||||
static inline int
|
||||
__gthread_objc_condition_wait (objc_condition_t condition, objc_mutex_t mutex)
|
||||
{
|
||||
if (__gthread_active_p ())
|
||||
return __gthrw_(pthread_cond_wait) ((pthread_cond_t *) condition->backend,
|
||||
(pthread_mutex_t *) mutex->backend);
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Wake up all threads waiting on this condition. */
|
||||
static inline int
|
||||
__gthread_objc_condition_broadcast (objc_condition_t condition)
|
||||
{
|
||||
if (__gthread_active_p ())
|
||||
return __gthrw_(pthread_cond_broadcast) ((pthread_cond_t *) condition->backend);
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Wake up one thread waiting on this condition. */
|
||||
static inline int
|
||||
__gthread_objc_condition_signal (objc_condition_t condition)
|
||||
{
|
||||
if (__gthread_active_p ())
|
||||
return __gthrw_(pthread_cond_signal) ((pthread_cond_t *) condition->backend);
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
#else /* _LIBOBJC */
|
||||
|
||||
static inline int
|
||||
__gthread_create (__gthread_t *__threadid, void *(*__func) (void*),
|
||||
void *__args)
|
||||
{
|
||||
return __gthrw_(pthread_create) (__threadid, NULL, __func, __args);
|
||||
}
|
||||
|
||||
static inline int
|
||||
__gthread_join (__gthread_t __threadid, void **__value_ptr)
|
||||
{
|
||||
return __gthrw_(pthread_join) (__threadid, __value_ptr);
|
||||
}
|
||||
|
||||
static inline int
|
||||
__gthread_detach (__gthread_t __threadid)
|
||||
{
|
||||
return __gthrw_(pthread_detach) (__threadid);
|
||||
}
|
||||
|
||||
static inline int
|
||||
__gthread_equal (__gthread_t __t1, __gthread_t __t2)
|
||||
{
|
||||
return __gthrw_(pthread_equal) (__t1, __t2);
|
||||
}
|
||||
|
||||
static inline __gthread_t
|
||||
__gthread_self (void)
|
||||
{
|
||||
return __gthrw_(pthread_self) ();
|
||||
}
|
||||
|
||||
static inline int
|
||||
__gthread_yield (void)
|
||||
{
|
||||
return __gthrw_(sched_yield) ();
|
||||
}
|
||||
|
||||
static inline int
|
||||
__gthread_once (__gthread_once_t *__once, void (*__func) (void))
|
||||
{
|
||||
if (__gthread_active_p ())
|
||||
return __gthrw_(pthread_once) (__once, __func);
|
||||
else
|
||||
return -1;
|
||||
}
|
||||
|
||||
static inline int
|
||||
__gthread_key_create (__gthread_key_t *__key, void (*__dtor) (void *))
|
||||
{
|
||||
return __gthrw_(pthread_key_create) (__key, __dtor);
|
||||
}
|
||||
|
||||
static inline int
|
||||
__gthread_key_delete (__gthread_key_t __key)
|
||||
{
|
||||
return __gthrw_(pthread_key_delete) (__key);
|
||||
}
|
||||
|
||||
static inline void *
|
||||
__gthread_getspecific (__gthread_key_t __key)
|
||||
{
|
||||
return __gthrw_(pthread_getspecific) (__key);
|
||||
}
|
||||
|
||||
static inline int
|
||||
__gthread_setspecific (__gthread_key_t __key, const void *__ptr)
|
||||
{
|
||||
return __gthrw_(pthread_setspecific) (__key, __ptr);
|
||||
}
|
||||
|
||||
static inline void
|
||||
__gthread_mutex_init_function (__gthread_mutex_t *__mutex)
|
||||
{
|
||||
if (__gthread_active_p ())
|
||||
__gthrw_(pthread_mutex_init) (__mutex, NULL);
|
||||
}
|
||||
|
||||
static inline int
|
||||
__gthread_mutex_destroy (__gthread_mutex_t *__mutex)
|
||||
{
|
||||
if (__gthread_active_p ())
|
||||
return __gthrw_(pthread_mutex_destroy) (__mutex);
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int
|
||||
__gthread_mutex_lock (__gthread_mutex_t *__mutex)
|
||||
{
|
||||
if (__gthread_active_p ())
|
||||
return __gthrw_(pthread_mutex_lock) (__mutex);
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int
|
||||
__gthread_mutex_trylock (__gthread_mutex_t *__mutex)
|
||||
{
|
||||
if (__gthread_active_p ())
|
||||
return __gthrw_(pthread_mutex_trylock) (__mutex);
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if _GTHREAD_USE_MUTEX_TIMEDLOCK
|
||||
static inline int
|
||||
__gthread_mutex_timedlock (__gthread_mutex_t *__mutex,
|
||||
const __gthread_time_t *__abs_timeout)
|
||||
{
|
||||
if (__gthread_active_p ())
|
||||
return __gthrw_(pthread_mutex_timedlock) (__mutex, __abs_timeout);
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
static inline int
|
||||
__gthread_mutex_unlock (__gthread_mutex_t *__mutex)
|
||||
{
|
||||
if (__gthread_active_p ())
|
||||
return __gthrw_(pthread_mutex_unlock) (__mutex);
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if !defined( PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP) \
|
||||
|| defined(_GTHREAD_USE_RECURSIVE_MUTEX_INIT_FUNC)
|
||||
static inline int
|
||||
__gthread_recursive_mutex_init_function (__gthread_recursive_mutex_t *__mutex)
|
||||
{
|
||||
if (__gthread_active_p ())
|
||||
{
|
||||
pthread_mutexattr_t __attr;
|
||||
int __r;
|
||||
|
||||
__r = __gthrw_(pthread_mutexattr_init) (&__attr);
|
||||
if (!__r)
|
||||
__r = __gthrw_(pthread_mutexattr_settype) (&__attr,
|
||||
PTHREAD_MUTEX_RECURSIVE);
|
||||
if (!__r)
|
||||
__r = __gthrw_(pthread_mutex_init) (__mutex, &__attr);
|
||||
if (!__r)
|
||||
__r = __gthrw_(pthread_mutexattr_destroy) (&__attr);
|
||||
return __r;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
static inline int
|
||||
__gthread_recursive_mutex_lock (__gthread_recursive_mutex_t *__mutex)
|
||||
{
|
||||
return __gthread_mutex_lock (__mutex);
|
||||
}
|
||||
|
||||
static inline int
|
||||
__gthread_recursive_mutex_trylock (__gthread_recursive_mutex_t *__mutex)
|
||||
{
|
||||
return __gthread_mutex_trylock (__mutex);
|
||||
}
|
||||
|
||||
#if _GTHREAD_USE_MUTEX_TIMEDLOCK
|
||||
static inline int
|
||||
__gthread_recursive_mutex_timedlock (__gthread_recursive_mutex_t *__mutex,
|
||||
const __gthread_time_t *__abs_timeout)
|
||||
{
|
||||
return __gthread_mutex_timedlock (__mutex, __abs_timeout);
|
||||
}
|
||||
#endif
|
||||
|
||||
static inline int
|
||||
__gthread_recursive_mutex_unlock (__gthread_recursive_mutex_t *__mutex)
|
||||
{
|
||||
return __gthread_mutex_unlock (__mutex);
|
||||
}
|
||||
|
||||
static inline int
|
||||
__gthread_recursive_mutex_destroy (__gthread_recursive_mutex_t *__mutex)
|
||||
{
|
||||
return __gthread_mutex_destroy (__mutex);
|
||||
}
|
||||
|
||||
#ifdef _GTHREAD_USE_COND_INIT_FUNC
|
||||
static inline void
|
||||
__gthread_cond_init_function (__gthread_cond_t *__cond)
|
||||
{
|
||||
if (__gthread_active_p ())
|
||||
__gthrw_(pthread_cond_init) (__cond, NULL);
|
||||
}
|
||||
#endif
|
||||
|
||||
static inline int
|
||||
__gthread_cond_broadcast (__gthread_cond_t *__cond)
|
||||
{
|
||||
return __gthrw_(pthread_cond_broadcast) (__cond);
|
||||
}
|
||||
|
||||
static inline int
|
||||
__gthread_cond_signal (__gthread_cond_t *__cond)
|
||||
{
|
||||
return __gthrw_(pthread_cond_signal) (__cond);
|
||||
}
|
||||
|
||||
static inline int
|
||||
__gthread_cond_wait (__gthread_cond_t *__cond, __gthread_mutex_t *__mutex)
|
||||
{
|
||||
return __gthrw_(pthread_cond_wait) (__cond, __mutex);
|
||||
}
|
||||
|
||||
static inline int
|
||||
__gthread_cond_timedwait (__gthread_cond_t *__cond, __gthread_mutex_t *__mutex,
|
||||
const __gthread_time_t *__abs_timeout)
|
||||
{
|
||||
return __gthrw_(pthread_cond_timedwait) (__cond, __mutex, __abs_timeout);
|
||||
}
|
||||
|
||||
static inline int
|
||||
__gthread_cond_wait_recursive (__gthread_cond_t *__cond,
|
||||
__gthread_recursive_mutex_t *__mutex)
|
||||
{
|
||||
return __gthread_cond_wait (__cond, __mutex);
|
||||
}
|
||||
|
||||
static inline int
|
||||
__gthread_cond_destroy (__gthread_cond_t* __cond)
|
||||
{
|
||||
return __gthrw_(pthread_cond_destroy) (__cond);
|
||||
}
|
||||
|
||||
#endif /* _LIBOBJC */
|
||||
|
||||
#endif /* ! _GLIBCXX_GCC_GTHR_POSIX_H */
|
@ -1,889 +0,0 @@
|
||||
/* Threads compatibility routines for libgcc2 and libobjc. */
|
||||
/* Compile this one with gcc. */
|
||||
/* Copyright (C) 1997-2013 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GCC.
|
||||
|
||||
GCC is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free
|
||||
Software Foundation; either version 3, or (at your option) any later
|
||||
version.
|
||||
|
||||
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
Under Section 7 of GPL version 3, you are granted additional
|
||||
permissions described in the GCC Runtime Library Exception, version
|
||||
3.1, as published by the Free Software Foundation.
|
||||
|
||||
You should have received a copy of the GNU General Public License and
|
||||
a copy of the GCC Runtime Library Exception along with this program;
|
||||
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef _GLIBCXX_GCC_GTHR_POSIX_H
|
||||
#define _GLIBCXX_GCC_GTHR_POSIX_H
|
||||
|
||||
/* POSIX threads specific definitions.
|
||||
Easy, since the interface is just one-to-one mapping. */
|
||||
|
||||
#define __GTHREADS 1
|
||||
#define __GTHREADS_CXX0X 1
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
#if ((defined(_LIBOBJC) || defined(_LIBOBJC_WEAK)) \
|
||||
|| !defined(_GTHREAD_USE_MUTEX_TIMEDLOCK))
|
||||
# include <unistd.h>
|
||||
# if defined(_POSIX_TIMEOUTS) && _POSIX_TIMEOUTS >= 0
|
||||
# define _GTHREAD_USE_MUTEX_TIMEDLOCK 1
|
||||
# else
|
||||
# define _GTHREAD_USE_MUTEX_TIMEDLOCK 0
|
||||
# endif
|
||||
#endif
|
||||
|
||||
typedef pthread_t __gthread_t;
|
||||
typedef pthread_key_t __gthread_key_t;
|
||||
typedef pthread_once_t __gthread_once_t;
|
||||
typedef pthread_mutex_t __gthread_mutex_t;
|
||||
typedef pthread_mutex_t __gthread_recursive_mutex_t;
|
||||
typedef pthread_cond_t __gthread_cond_t;
|
||||
typedef struct timespec __gthread_time_t;
|
||||
|
||||
/* POSIX like conditional variables are supported. Please look at comments
|
||||
in gthr.h for details. */
|
||||
#define __GTHREAD_HAS_COND 1
|
||||
|
||||
#define __GTHREAD_MUTEX_INIT PTHREAD_MUTEX_INITIALIZER
|
||||
#define __GTHREAD_MUTEX_INIT_FUNCTION __gthread_mutex_init_function
|
||||
#define __GTHREAD_ONCE_INIT PTHREAD_ONCE_INIT
|
||||
#if defined(PTHREAD_RECURSIVE_MUTEX_INITIALIZER)
|
||||
#define __GTHREAD_RECURSIVE_MUTEX_INIT PTHREAD_RECURSIVE_MUTEX_INITIALIZER
|
||||
#elif defined(PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP)
|
||||
#define __GTHREAD_RECURSIVE_MUTEX_INIT PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
|
||||
#else
|
||||
#define __GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION __gthread_recursive_mutex_init_function
|
||||
#endif
|
||||
#define __GTHREAD_COND_INIT PTHREAD_COND_INITIALIZER
|
||||
#define __GTHREAD_TIME_INIT {0,0}
|
||||
|
||||
#ifdef _GTHREAD_USE_MUTEX_INIT_FUNC
|
||||
# undef __GTHREAD_MUTEX_INIT
|
||||
#endif
|
||||
#ifdef _GTHREAD_USE_RECURSIVE_MUTEX_INIT_FUNC
|
||||
# undef __GTHREAD_RECURSIVE_MUTEX_INIT
|
||||
# undef __GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION
|
||||
# define __GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION __gthread_recursive_mutex_init_function
|
||||
#endif
|
||||
#ifdef _GTHREAD_USE_COND_INIT_FUNC
|
||||
# undef __GTHREAD_COND_INIT
|
||||
# define __GTHREAD_COND_INIT_FUNCTION __gthread_cond_init_function
|
||||
#endif
|
||||
|
||||
#if __GXX_WEAK__ && _GLIBCXX_GTHREAD_USE_WEAK
|
||||
# ifndef __gthrw_pragma
|
||||
# define __gthrw_pragma(pragma)
|
||||
# endif
|
||||
# define __gthrw2(name,name2,type) \
|
||||
static __typeof(type) name __attribute__ ((__weakref__(#name2))); \
|
||||
__gthrw_pragma(weak type)
|
||||
# define __gthrw_(name) __gthrw_ ## name
|
||||
#else
|
||||
# define __gthrw2(name,name2,type)
|
||||
# define __gthrw_(name) name
|
||||
#endif
|
||||
|
||||
/* Typically, __gthrw_foo is a weak reference to symbol foo. */
|
||||
#define __gthrw(name) __gthrw2(__gthrw_ ## name,name,name)
|
||||
|
||||
__gthrw(pthread_once)
|
||||
__gthrw(pthread_getspecific)
|
||||
__gthrw(pthread_setspecific)
|
||||
|
||||
__gthrw(pthread_create)
|
||||
__gthrw(pthread_join)
|
||||
__gthrw(pthread_equal)
|
||||
__gthrw(pthread_self)
|
||||
__gthrw(pthread_detach)
|
||||
#ifndef __BIONIC__
|
||||
__gthrw(pthread_cancel)
|
||||
#endif
|
||||
__gthrw(sched_yield)
|
||||
|
||||
__gthrw(pthread_mutex_lock)
|
||||
__gthrw(pthread_mutex_trylock)
|
||||
#if _GTHREAD_USE_MUTEX_TIMEDLOCK
|
||||
__gthrw(pthread_mutex_timedlock)
|
||||
#endif
|
||||
__gthrw(pthread_mutex_unlock)
|
||||
__gthrw(pthread_mutex_init)
|
||||
__gthrw(pthread_mutex_destroy)
|
||||
|
||||
__gthrw(pthread_cond_init)
|
||||
__gthrw(pthread_cond_broadcast)
|
||||
__gthrw(pthread_cond_signal)
|
||||
__gthrw(pthread_cond_wait)
|
||||
__gthrw(pthread_cond_timedwait)
|
||||
__gthrw(pthread_cond_destroy)
|
||||
|
||||
__gthrw(pthread_key_create)
|
||||
__gthrw(pthread_key_delete)
|
||||
__gthrw(pthread_mutexattr_init)
|
||||
__gthrw(pthread_mutexattr_settype)
|
||||
__gthrw(pthread_mutexattr_destroy)
|
||||
|
||||
|
||||
#if defined(_LIBOBJC) || defined(_LIBOBJC_WEAK)
|
||||
/* Objective-C. */
|
||||
__gthrw(pthread_exit)
|
||||
#ifdef _POSIX_PRIORITY_SCHEDULING
|
||||
#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING
|
||||
__gthrw(sched_get_priority_max)
|
||||
__gthrw(sched_get_priority_min)
|
||||
#endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */
|
||||
#endif /* _POSIX_PRIORITY_SCHEDULING */
|
||||
__gthrw(pthread_attr_destroy)
|
||||
__gthrw(pthread_attr_init)
|
||||
__gthrw(pthread_attr_setdetachstate)
|
||||
#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING
|
||||
__gthrw(pthread_getschedparam)
|
||||
__gthrw(pthread_setschedparam)
|
||||
#endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */
|
||||
#endif /* _LIBOBJC || _LIBOBJC_WEAK */
|
||||
|
||||
#if __GXX_WEAK__ && _GLIBCXX_GTHREAD_USE_WEAK
|
||||
|
||||
/* On Solaris 2.6 up to 9, the libc exposes a POSIX threads interface even if
|
||||
-pthreads is not specified. The functions are dummies and most return an
|
||||
error value. However pthread_once returns 0 without invoking the routine
|
||||
it is passed so we cannot pretend that the interface is active if -pthreads
|
||||
is not specified. On Solaris 2.5.1, the interface is not exposed at all so
|
||||
we need to play the usual game with weak symbols. On Solaris 10 and up, a
|
||||
working interface is always exposed. On FreeBSD 6 and later, libc also
|
||||
exposes a dummy POSIX threads interface, similar to what Solaris 2.6 up
|
||||
to 9 does. FreeBSD >= 700014 even provides a pthread_cancel stub in libc,
|
||||
which means the alternate __gthread_active_p below cannot be used there. */
|
||||
|
||||
#if defined(__FreeBSD__) || (defined(__sun) && defined(__svr4__))
|
||||
|
||||
static volatile int __gthread_active = -1;
|
||||
|
||||
static void
|
||||
__gthread_trigger (void)
|
||||
{
|
||||
__gthread_active = 1;
|
||||
}
|
||||
|
||||
static inline int
|
||||
__gthread_active_p (void)
|
||||
{
|
||||
static pthread_mutex_t __gthread_active_mutex = PTHREAD_MUTEX_INITIALIZER;
|
||||
static pthread_once_t __gthread_active_once = PTHREAD_ONCE_INIT;
|
||||
|
||||
/* Avoid reading __gthread_active twice on the main code path. */
|
||||
int __gthread_active_latest_value = __gthread_active;
|
||||
|
||||
/* This test is not protected to avoid taking a lock on the main code
|
||||
path so every update of __gthread_active in a threaded program must
|
||||
be atomic with regard to the result of the test. */
|
||||
if (__builtin_expect (__gthread_active_latest_value < 0, 0))
|
||||
{
|
||||
if (__gthrw_(pthread_once))
|
||||
{
|
||||
/* If this really is a threaded program, then we must ensure that
|
||||
__gthread_active has been set to 1 before exiting this block. */
|
||||
__gthrw_(pthread_mutex_lock) (&__gthread_active_mutex);
|
||||
__gthrw_(pthread_once) (&__gthread_active_once, __gthread_trigger);
|
||||
__gthrw_(pthread_mutex_unlock) (&__gthread_active_mutex);
|
||||
}
|
||||
|
||||
/* Make sure we'll never enter this block again. */
|
||||
if (__gthread_active < 0)
|
||||
__gthread_active = 0;
|
||||
|
||||
__gthread_active_latest_value = __gthread_active;
|
||||
}
|
||||
|
||||
return __gthread_active_latest_value != 0;
|
||||
}
|
||||
|
||||
#else /* neither FreeBSD nor Solaris */
|
||||
|
||||
/* For a program to be multi-threaded the only thing that it certainly must
|
||||
be using is pthread_create. However, there may be other libraries that
|
||||
intercept pthread_create with their own definitions to wrap pthreads
|
||||
functionality for some purpose. In those cases, pthread_create being
|
||||
defined might not necessarily mean that libpthread is actually linked
|
||||
in.
|
||||
|
||||
For the GNU C library, we can use a known internal name. This is always
|
||||
available in the ABI, but no other library would define it. That is
|
||||
ideal, since any public pthread function might be intercepted just as
|
||||
pthread_create might be. __pthread_key_create is an "internal"
|
||||
implementation symbol, but it is part of the public exported ABI. Also,
|
||||
it's among the symbols that the static libpthread.a always links in
|
||||
whenever pthread_create is used, so there is no danger of a false
|
||||
negative result in any statically-linked, multi-threaded program.
|
||||
|
||||
For others, we choose pthread_cancel as a function that seems unlikely
|
||||
to be redefined by an interceptor library. The bionic (Android) C
|
||||
library does not provide pthread_cancel, so we do use pthread_create
|
||||
there (and interceptor libraries lose). */
|
||||
|
||||
#ifdef __GLIBC__
|
||||
__gthrw2(__gthrw_(__pthread_key_create),
|
||||
__pthread_key_create,
|
||||
pthread_key_create)
|
||||
# define GTHR_ACTIVE_PROXY __gthrw_(__pthread_key_create)
|
||||
#elif defined (__BIONIC__)
|
||||
# define GTHR_ACTIVE_PROXY __gthrw_(pthread_create)
|
||||
#else
|
||||
# define GTHR_ACTIVE_PROXY __gthrw_(pthread_cancel)
|
||||
#endif
|
||||
|
||||
static inline int
|
||||
__gthread_active_p (void)
|
||||
{
|
||||
static void *const __gthread_active_ptr
|
||||
= __extension__ (void *) >HR_ACTIVE_PROXY;
|
||||
return __gthread_active_ptr != 0;
|
||||
}
|
||||
|
||||
#endif /* FreeBSD or Solaris */
|
||||
|
||||
#else /* not __GXX_WEAK__ */
|
||||
|
||||
/* Similar to Solaris, HP-UX 11 for PA-RISC provides stubs for pthread
|
||||
calls in shared flavors of the HP-UX C library. Most of the stubs
|
||||
have no functionality. The details are described in the "libc cumulative
|
||||
patch" for each subversion of HP-UX 11. There are two special interfaces
|
||||
provided for checking whether an application is linked to a shared pthread
|
||||
library or not. However, these interfaces aren't available in early
|
||||
libpthread libraries. We also need a test that works for archive
|
||||
libraries. We can't use pthread_once as some libc versions call the
|
||||
init function. We also can't use pthread_create or pthread_attr_init
|
||||
as these create a thread and thereby prevent changing the default stack
|
||||
size. The function pthread_default_stacksize_np is available in both
|
||||
the archive and shared versions of libpthread. It can be used to
|
||||
determine the default pthread stack size. There is a stub in some
|
||||
shared libc versions which returns a zero size if pthreads are not
|
||||
active. We provide an equivalent stub to handle cases where libc
|
||||
doesn't provide one. */
|
||||
|
||||
#if defined(__hppa__) && defined(__hpux__)
|
||||
|
||||
static volatile int __gthread_active = -1;
|
||||
|
||||
static inline int
|
||||
__gthread_active_p (void)
|
||||
{
|
||||
/* Avoid reading __gthread_active twice on the main code path. */
|
||||
int __gthread_active_latest_value = __gthread_active;
|
||||
size_t __s;
|
||||
|
||||
if (__builtin_expect (__gthread_active_latest_value < 0, 0))
|
||||
{
|
||||
pthread_default_stacksize_np (0, &__s);
|
||||
__gthread_active = __s ? 1 : 0;
|
||||
__gthread_active_latest_value = __gthread_active;
|
||||
}
|
||||
|
||||
return __gthread_active_latest_value != 0;
|
||||
}
|
||||
|
||||
#else /* not hppa-hpux */
|
||||
|
||||
static inline int
|
||||
__gthread_active_p (void)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
#endif /* hppa-hpux */
|
||||
|
||||
#endif /* __GXX_WEAK__ */
|
||||
|
||||
#ifdef _LIBOBJC
|
||||
|
||||
/* This is the config.h file in libobjc/ */
|
||||
#include <config.h>
|
||||
|
||||
#ifdef HAVE_SCHED_H
|
||||
# include <sched.h>
|
||||
#endif
|
||||
|
||||
/* Key structure for maintaining thread specific storage */
|
||||
static pthread_key_t _objc_thread_storage;
|
||||
static pthread_attr_t _objc_thread_attribs;
|
||||
|
||||
/* Thread local storage for a single thread */
|
||||
static void *thread_local_storage = NULL;
|
||||
|
||||
/* Backend initialization functions */
|
||||
|
||||
/* Initialize the threads subsystem. */
|
||||
static inline int
|
||||
__gthread_objc_init_thread_system (void)
|
||||
{
|
||||
if (__gthread_active_p ())
|
||||
{
|
||||
/* Initialize the thread storage key. */
|
||||
if (__gthrw_(pthread_key_create) (&_objc_thread_storage, NULL) == 0)
|
||||
{
|
||||
/* The normal default detach state for threads is
|
||||
* PTHREAD_CREATE_JOINABLE which causes threads to not die
|
||||
* when you think they should. */
|
||||
if (__gthrw_(pthread_attr_init) (&_objc_thread_attribs) == 0
|
||||
&& __gthrw_(pthread_attr_setdetachstate) (&_objc_thread_attribs,
|
||||
PTHREAD_CREATE_DETACHED) == 0)
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Close the threads subsystem. */
|
||||
static inline int
|
||||
__gthread_objc_close_thread_system (void)
|
||||
{
|
||||
if (__gthread_active_p ()
|
||||
&& __gthrw_(pthread_key_delete) (_objc_thread_storage) == 0
|
||||
&& __gthrw_(pthread_attr_destroy) (&_objc_thread_attribs) == 0)
|
||||
return 0;
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Backend thread functions */
|
||||
|
||||
/* Create a new thread of execution. */
|
||||
static inline objc_thread_t
|
||||
__gthread_objc_thread_detach (void (*func)(void *), void *arg)
|
||||
{
|
||||
objc_thread_t thread_id;
|
||||
pthread_t new_thread_handle;
|
||||
|
||||
if (!__gthread_active_p ())
|
||||
return NULL;
|
||||
|
||||
if (!(__gthrw_(pthread_create) (&new_thread_handle, &_objc_thread_attribs,
|
||||
(void *) func, arg)))
|
||||
thread_id = (objc_thread_t) new_thread_handle;
|
||||
else
|
||||
thread_id = NULL;
|
||||
|
||||
return thread_id;
|
||||
}
|
||||
|
||||
/* Set the current thread's priority. */
|
||||
static inline int
|
||||
__gthread_objc_thread_set_priority (int priority)
|
||||
{
|
||||
if (!__gthread_active_p ())
|
||||
return -1;
|
||||
else
|
||||
{
|
||||
#ifdef _POSIX_PRIORITY_SCHEDULING
|
||||
#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING
|
||||
pthread_t thread_id = __gthrw_(pthread_self) ();
|
||||
int policy;
|
||||
struct sched_param params;
|
||||
int priority_min, priority_max;
|
||||
|
||||
if (__gthrw_(pthread_getschedparam) (thread_id, &policy, ¶ms) == 0)
|
||||
{
|
||||
if ((priority_max = __gthrw_(sched_get_priority_max) (policy)) == -1)
|
||||
return -1;
|
||||
|
||||
if ((priority_min = __gthrw_(sched_get_priority_min) (policy)) == -1)
|
||||
return -1;
|
||||
|
||||
if (priority > priority_max)
|
||||
priority = priority_max;
|
||||
else if (priority < priority_min)
|
||||
priority = priority_min;
|
||||
params.sched_priority = priority;
|
||||
|
||||
/*
|
||||
* The solaris 7 and several other man pages incorrectly state that
|
||||
* this should be a pointer to policy but pthread.h is universally
|
||||
* at odds with this.
|
||||
*/
|
||||
if (__gthrw_(pthread_setschedparam) (thread_id, policy, ¶ms) == 0)
|
||||
return 0;
|
||||
}
|
||||
#endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */
|
||||
#endif /* _POSIX_PRIORITY_SCHEDULING */
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/* Return the current thread's priority. */
|
||||
static inline int
|
||||
__gthread_objc_thread_get_priority (void)
|
||||
{
|
||||
#ifdef _POSIX_PRIORITY_SCHEDULING
|
||||
#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING
|
||||
if (__gthread_active_p ())
|
||||
{
|
||||
int policy;
|
||||
struct sched_param params;
|
||||
|
||||
if (__gthrw_(pthread_getschedparam) (__gthrw_(pthread_self) (), &policy, ¶ms) == 0)
|
||||
return params.sched_priority;
|
||||
else
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
#endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */
|
||||
#endif /* _POSIX_PRIORITY_SCHEDULING */
|
||||
return OBJC_THREAD_INTERACTIVE_PRIORITY;
|
||||
}
|
||||
|
||||
/* Yield our process time to another thread. */
|
||||
static inline void
|
||||
__gthread_objc_thread_yield (void)
|
||||
{
|
||||
if (__gthread_active_p ())
|
||||
__gthrw_(sched_yield) ();
|
||||
}
|
||||
|
||||
/* Terminate the current thread. */
|
||||
static inline int
|
||||
__gthread_objc_thread_exit (void)
|
||||
{
|
||||
if (__gthread_active_p ())
|
||||
/* exit the thread */
|
||||
__gthrw_(pthread_exit) (&__objc_thread_exit_status);
|
||||
|
||||
/* Failed if we reached here */
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Returns an integer value which uniquely describes a thread. */
|
||||
static inline objc_thread_t
|
||||
__gthread_objc_thread_id (void)
|
||||
{
|
||||
if (__gthread_active_p ())
|
||||
return (objc_thread_t) __gthrw_(pthread_self) ();
|
||||
else
|
||||
return (objc_thread_t) 1;
|
||||
}
|
||||
|
||||
/* Sets the thread's local storage pointer. */
|
||||
static inline int
|
||||
__gthread_objc_thread_set_data (void *value)
|
||||
{
|
||||
if (__gthread_active_p ())
|
||||
return __gthrw_(pthread_setspecific) (_objc_thread_storage, value);
|
||||
else
|
||||
{
|
||||
thread_local_storage = value;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* Returns the thread's local storage pointer. */
|
||||
static inline void *
|
||||
__gthread_objc_thread_get_data (void)
|
||||
{
|
||||
if (__gthread_active_p ())
|
||||
return __gthrw_(pthread_getspecific) (_objc_thread_storage);
|
||||
else
|
||||
return thread_local_storage;
|
||||
}
|
||||
|
||||
/* Backend mutex functions */
|
||||
|
||||
/* Allocate a mutex. */
|
||||
static inline int
|
||||
__gthread_objc_mutex_allocate (objc_mutex_t mutex)
|
||||
{
|
||||
if (__gthread_active_p ())
|
||||
{
|
||||
mutex->backend = objc_malloc (sizeof (pthread_mutex_t));
|
||||
|
||||
if (__gthrw_(pthread_mutex_init) ((pthread_mutex_t *) mutex->backend, NULL))
|
||||
{
|
||||
objc_free (mutex->backend);
|
||||
mutex->backend = NULL;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Deallocate a mutex. */
|
||||
static inline int
|
||||
__gthread_objc_mutex_deallocate (objc_mutex_t mutex)
|
||||
{
|
||||
if (__gthread_active_p ())
|
||||
{
|
||||
int count;
|
||||
|
||||
/*
|
||||
* Posix Threads specifically require that the thread be unlocked
|
||||
* for __gthrw_(pthread_mutex_destroy) to work.
|
||||
*/
|
||||
|
||||
do
|
||||
{
|
||||
count = __gthrw_(pthread_mutex_unlock) ((pthread_mutex_t *) mutex->backend);
|
||||
if (count < 0)
|
||||
return -1;
|
||||
}
|
||||
while (count);
|
||||
|
||||
if (__gthrw_(pthread_mutex_destroy) ((pthread_mutex_t *) mutex->backend))
|
||||
return -1;
|
||||
|
||||
objc_free (mutex->backend);
|
||||
mutex->backend = NULL;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Grab a lock on a mutex. */
|
||||
static inline int
|
||||
__gthread_objc_mutex_lock (objc_mutex_t mutex)
|
||||
{
|
||||
if (__gthread_active_p ()
|
||||
&& __gthrw_(pthread_mutex_lock) ((pthread_mutex_t *) mutex->backend) != 0)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Try to grab a lock on a mutex. */
|
||||
static inline int
|
||||
__gthread_objc_mutex_trylock (objc_mutex_t mutex)
|
||||
{
|
||||
if (__gthread_active_p ()
|
||||
&& __gthrw_(pthread_mutex_trylock) ((pthread_mutex_t *) mutex->backend) != 0)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Unlock the mutex */
|
||||
static inline int
|
||||
__gthread_objc_mutex_unlock (objc_mutex_t mutex)
|
||||
{
|
||||
if (__gthread_active_p ()
|
||||
&& __gthrw_(pthread_mutex_unlock) ((pthread_mutex_t *) mutex->backend) != 0)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Backend condition mutex functions */
|
||||
|
||||
/* Allocate a condition. */
|
||||
static inline int
|
||||
__gthread_objc_condition_allocate (objc_condition_t condition)
|
||||
{
|
||||
if (__gthread_active_p ())
|
||||
{
|
||||
condition->backend = objc_malloc (sizeof (pthread_cond_t));
|
||||
|
||||
if (__gthrw_(pthread_cond_init) ((pthread_cond_t *) condition->backend, NULL))
|
||||
{
|
||||
objc_free (condition->backend);
|
||||
condition->backend = NULL;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Deallocate a condition. */
|
||||
static inline int
|
||||
__gthread_objc_condition_deallocate (objc_condition_t condition)
|
||||
{
|
||||
if (__gthread_active_p ())
|
||||
{
|
||||
if (__gthrw_(pthread_cond_destroy) ((pthread_cond_t *) condition->backend))
|
||||
return -1;
|
||||
|
||||
objc_free (condition->backend);
|
||||
condition->backend = NULL;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Wait on the condition */
|
||||
static inline int
|
||||
__gthread_objc_condition_wait (objc_condition_t condition, objc_mutex_t mutex)
|
||||
{
|
||||
if (__gthread_active_p ())
|
||||
return __gthrw_(pthread_cond_wait) ((pthread_cond_t *) condition->backend,
|
||||
(pthread_mutex_t *) mutex->backend);
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Wake up all threads waiting on this condition. */
|
||||
static inline int
|
||||
__gthread_objc_condition_broadcast (objc_condition_t condition)
|
||||
{
|
||||
if (__gthread_active_p ())
|
||||
return __gthrw_(pthread_cond_broadcast) ((pthread_cond_t *) condition->backend);
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Wake up one thread waiting on this condition. */
|
||||
static inline int
|
||||
__gthread_objc_condition_signal (objc_condition_t condition)
|
||||
{
|
||||
if (__gthread_active_p ())
|
||||
return __gthrw_(pthread_cond_signal) ((pthread_cond_t *) condition->backend);
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
#else /* _LIBOBJC */
|
||||
|
||||
static inline int
|
||||
__gthread_create (__gthread_t *__threadid, void *(*__func) (void*),
|
||||
void *__args)
|
||||
{
|
||||
return __gthrw_(pthread_create) (__threadid, NULL, __func, __args);
|
||||
}
|
||||
|
||||
static inline int
|
||||
__gthread_join (__gthread_t __threadid, void **__value_ptr)
|
||||
{
|
||||
return __gthrw_(pthread_join) (__threadid, __value_ptr);
|
||||
}
|
||||
|
||||
static inline int
|
||||
__gthread_detach (__gthread_t __threadid)
|
||||
{
|
||||
return __gthrw_(pthread_detach) (__threadid);
|
||||
}
|
||||
|
||||
static inline int
|
||||
__gthread_equal (__gthread_t __t1, __gthread_t __t2)
|
||||
{
|
||||
return __gthrw_(pthread_equal) (__t1, __t2);
|
||||
}
|
||||
|
||||
static inline __gthread_t
|
||||
__gthread_self (void)
|
||||
{
|
||||
return __gthrw_(pthread_self) ();
|
||||
}
|
||||
|
||||
static inline int
|
||||
__gthread_yield (void)
|
||||
{
|
||||
return __gthrw_(sched_yield) ();
|
||||
}
|
||||
|
||||
static inline int
|
||||
__gthread_once (__gthread_once_t *__once, void (*__func) (void))
|
||||
{
|
||||
if (__gthread_active_p ())
|
||||
return __gthrw_(pthread_once) (__once, __func);
|
||||
else
|
||||
return -1;
|
||||
}
|
||||
|
||||
static inline int
|
||||
__gthread_key_create (__gthread_key_t *__key, void (*__dtor) (void *))
|
||||
{
|
||||
return __gthrw_(pthread_key_create) (__key, __dtor);
|
||||
}
|
||||
|
||||
static inline int
|
||||
__gthread_key_delete (__gthread_key_t __key)
|
||||
{
|
||||
return __gthrw_(pthread_key_delete) (__key);
|
||||
}
|
||||
|
||||
static inline void *
|
||||
__gthread_getspecific (__gthread_key_t __key)
|
||||
{
|
||||
return __gthrw_(pthread_getspecific) (__key);
|
||||
}
|
||||
|
||||
static inline int
|
||||
__gthread_setspecific (__gthread_key_t __key, const void *__ptr)
|
||||
{
|
||||
return __gthrw_(pthread_setspecific) (__key, __ptr);
|
||||
}
|
||||
|
||||
static inline void
|
||||
__gthread_mutex_init_function (__gthread_mutex_t *__mutex)
|
||||
{
|
||||
if (__gthread_active_p ())
|
||||
__gthrw_(pthread_mutex_init) (__mutex, NULL);
|
||||
}
|
||||
|
||||
static inline int
|
||||
__gthread_mutex_destroy (__gthread_mutex_t *__mutex)
|
||||
{
|
||||
if (__gthread_active_p ())
|
||||
return __gthrw_(pthread_mutex_destroy) (__mutex);
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int
|
||||
__gthread_mutex_lock (__gthread_mutex_t *__mutex)
|
||||
{
|
||||
if (__gthread_active_p ())
|
||||
return __gthrw_(pthread_mutex_lock) (__mutex);
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int
|
||||
__gthread_mutex_trylock (__gthread_mutex_t *__mutex)
|
||||
{
|
||||
if (__gthread_active_p ())
|
||||
return __gthrw_(pthread_mutex_trylock) (__mutex);
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if _GTHREAD_USE_MUTEX_TIMEDLOCK
|
||||
static inline int
|
||||
__gthread_mutex_timedlock (__gthread_mutex_t *__mutex,
|
||||
const __gthread_time_t *__abs_timeout)
|
||||
{
|
||||
if (__gthread_active_p ())
|
||||
return __gthrw_(pthread_mutex_timedlock) (__mutex, __abs_timeout);
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
static inline int
|
||||
__gthread_mutex_unlock (__gthread_mutex_t *__mutex)
|
||||
{
|
||||
if (__gthread_active_p ())
|
||||
return __gthrw_(pthread_mutex_unlock) (__mutex);
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if !defined( PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP) \
|
||||
|| defined(_GTHREAD_USE_RECURSIVE_MUTEX_INIT_FUNC)
|
||||
static inline int
|
||||
__gthread_recursive_mutex_init_function (__gthread_recursive_mutex_t *__mutex)
|
||||
{
|
||||
if (__gthread_active_p ())
|
||||
{
|
||||
pthread_mutexattr_t __attr;
|
||||
int __r;
|
||||
|
||||
__r = __gthrw_(pthread_mutexattr_init) (&__attr);
|
||||
if (!__r)
|
||||
__r = __gthrw_(pthread_mutexattr_settype) (&__attr,
|
||||
PTHREAD_MUTEX_RECURSIVE);
|
||||
if (!__r)
|
||||
__r = __gthrw_(pthread_mutex_init) (__mutex, &__attr);
|
||||
if (!__r)
|
||||
__r = __gthrw_(pthread_mutexattr_destroy) (&__attr);
|
||||
return __r;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
static inline int
|
||||
__gthread_recursive_mutex_lock (__gthread_recursive_mutex_t *__mutex)
|
||||
{
|
||||
return __gthread_mutex_lock (__mutex);
|
||||
}
|
||||
|
||||
static inline int
|
||||
__gthread_recursive_mutex_trylock (__gthread_recursive_mutex_t *__mutex)
|
||||
{
|
||||
return __gthread_mutex_trylock (__mutex);
|
||||
}
|
||||
|
||||
#if _GTHREAD_USE_MUTEX_TIMEDLOCK
|
||||
static inline int
|
||||
__gthread_recursive_mutex_timedlock (__gthread_recursive_mutex_t *__mutex,
|
||||
const __gthread_time_t *__abs_timeout)
|
||||
{
|
||||
return __gthread_mutex_timedlock (__mutex, __abs_timeout);
|
||||
}
|
||||
#endif
|
||||
|
||||
static inline int
|
||||
__gthread_recursive_mutex_unlock (__gthread_recursive_mutex_t *__mutex)
|
||||
{
|
||||
return __gthread_mutex_unlock (__mutex);
|
||||
}
|
||||
|
||||
static inline int
|
||||
__gthread_recursive_mutex_destroy (__gthread_recursive_mutex_t *__mutex)
|
||||
{
|
||||
return __gthread_mutex_destroy (__mutex);
|
||||
}
|
||||
|
||||
#ifdef _GTHREAD_USE_COND_INIT_FUNC
|
||||
static inline void
|
||||
__gthread_cond_init_function (__gthread_cond_t *__cond)
|
||||
{
|
||||
if (__gthread_active_p ())
|
||||
__gthrw_(pthread_cond_init) (__cond, NULL);
|
||||
}
|
||||
#endif
|
||||
|
||||
static inline int
|
||||
__gthread_cond_broadcast (__gthread_cond_t *__cond)
|
||||
{
|
||||
return __gthrw_(pthread_cond_broadcast) (__cond);
|
||||
}
|
||||
|
||||
static inline int
|
||||
__gthread_cond_signal (__gthread_cond_t *__cond)
|
||||
{
|
||||
return __gthrw_(pthread_cond_signal) (__cond);
|
||||
}
|
||||
|
||||
static inline int
|
||||
__gthread_cond_wait (__gthread_cond_t *__cond, __gthread_mutex_t *__mutex)
|
||||
{
|
||||
return __gthrw_(pthread_cond_wait) (__cond, __mutex);
|
||||
}
|
||||
|
||||
static inline int
|
||||
__gthread_cond_timedwait (__gthread_cond_t *__cond, __gthread_mutex_t *__mutex,
|
||||
const __gthread_time_t *__abs_timeout)
|
||||
{
|
||||
return __gthrw_(pthread_cond_timedwait) (__cond, __mutex, __abs_timeout);
|
||||
}
|
||||
|
||||
static inline int
|
||||
__gthread_cond_wait_recursive (__gthread_cond_t *__cond,
|
||||
__gthread_recursive_mutex_t *__mutex)
|
||||
{
|
||||
return __gthread_cond_wait (__cond, __mutex);
|
||||
}
|
||||
|
||||
static inline int
|
||||
__gthread_cond_destroy (__gthread_cond_t* __cond)
|
||||
{
|
||||
return __gthrw_(pthread_cond_destroy) (__cond);
|
||||
}
|
||||
|
||||
#endif /* _LIBOBJC */
|
||||
|
||||
#endif /* ! _GLIBCXX_GCC_GTHR_POSIX_H */
|
@ -1,298 +0,0 @@
|
||||
/* Threads compatibility routines for libgcc2 and libobjc. */
|
||||
/* Compile this one with gcc. */
|
||||
/* Copyright (C) 1997-2013 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GCC.
|
||||
|
||||
GCC is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free
|
||||
Software Foundation; either version 3, or (at your option) any later
|
||||
version.
|
||||
|
||||
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
Under Section 7 of GPL version 3, you are granted additional
|
||||
permissions described in the GCC Runtime Library Exception, version
|
||||
3.1, as published by the Free Software Foundation.
|
||||
|
||||
You should have received a copy of the GNU General Public License and
|
||||
a copy of the GCC Runtime Library Exception along with this program;
|
||||
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef _GLIBCXX_GCC_GTHR_SINGLE_H
|
||||
#define _GLIBCXX_GCC_GTHR_SINGLE_H
|
||||
|
||||
/* Just provide compatibility for mutex handling. */
|
||||
|
||||
typedef int __gthread_key_t;
|
||||
typedef int __gthread_once_t;
|
||||
typedef int __gthread_mutex_t;
|
||||
typedef int __gthread_recursive_mutex_t;
|
||||
|
||||
#define __GTHREAD_ONCE_INIT 0
|
||||
#define __GTHREAD_MUTEX_INIT 0
|
||||
#define __GTHREAD_MUTEX_INIT_FUNCTION(mx)
|
||||
#define __GTHREAD_RECURSIVE_MUTEX_INIT 0
|
||||
|
||||
#define _GLIBCXX_UNUSED __attribute__((unused))
|
||||
|
||||
#ifdef _LIBOBJC
|
||||
|
||||
/* Thread local storage for a single thread */
|
||||
static void *thread_local_storage = NULL;
|
||||
|
||||
/* Backend initialization functions */
|
||||
|
||||
/* Initialize the threads subsystem. */
|
||||
static inline int
|
||||
__gthread_objc_init_thread_system (void)
|
||||
{
|
||||
/* No thread support available */
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Close the threads subsystem. */
|
||||
static inline int
|
||||
__gthread_objc_close_thread_system (void)
|
||||
{
|
||||
/* No thread support available */
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Backend thread functions */
|
||||
|
||||
/* Create a new thread of execution. */
|
||||
static inline objc_thread_t
|
||||
__gthread_objc_thread_detach (void (* func)(void *), void * arg _GLIBCXX_UNUSED)
|
||||
{
|
||||
/* No thread support available */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Set the current thread's priority. */
|
||||
static inline int
|
||||
__gthread_objc_thread_set_priority (int priority _GLIBCXX_UNUSED)
|
||||
{
|
||||
/* No thread support available */
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Return the current thread's priority. */
|
||||
static inline int
|
||||
__gthread_objc_thread_get_priority (void)
|
||||
{
|
||||
return OBJC_THREAD_INTERACTIVE_PRIORITY;
|
||||
}
|
||||
|
||||
/* Yield our process time to another thread. */
|
||||
static inline void
|
||||
__gthread_objc_thread_yield (void)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/* Terminate the current thread. */
|
||||
static inline int
|
||||
__gthread_objc_thread_exit (void)
|
||||
{
|
||||
/* No thread support available */
|
||||
/* Should we really exit the program */
|
||||
/* exit (&__objc_thread_exit_status); */
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Returns an integer value which uniquely describes a thread. */
|
||||
static inline objc_thread_t
|
||||
__gthread_objc_thread_id (void)
|
||||
{
|
||||
/* No thread support, use 1. */
|
||||
return (objc_thread_t) 1;
|
||||
}
|
||||
|
||||
/* Sets the thread's local storage pointer. */
|
||||
static inline int
|
||||
__gthread_objc_thread_set_data (void *value)
|
||||
{
|
||||
thread_local_storage = value;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Returns the thread's local storage pointer. */
|
||||
static inline void *
|
||||
__gthread_objc_thread_get_data (void)
|
||||
{
|
||||
return thread_local_storage;
|
||||
}
|
||||
|
||||
/* Backend mutex functions */
|
||||
|
||||
/* Allocate a mutex. */
|
||||
static inline int
|
||||
__gthread_objc_mutex_allocate (objc_mutex_t mutex _GLIBCXX_UNUSED)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Deallocate a mutex. */
|
||||
static inline int
|
||||
__gthread_objc_mutex_deallocate (objc_mutex_t mutex _GLIBCXX_UNUSED)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Grab a lock on a mutex. */
|
||||
static inline int
|
||||
__gthread_objc_mutex_lock (objc_mutex_t mutex _GLIBCXX_UNUSED)
|
||||
{
|
||||
/* There can only be one thread, so we always get the lock */
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Try to grab a lock on a mutex. */
|
||||
static inline int
|
||||
__gthread_objc_mutex_trylock (objc_mutex_t mutex _GLIBCXX_UNUSED)
|
||||
{
|
||||
/* There can only be one thread, so we always get the lock */
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Unlock the mutex */
|
||||
static inline int
|
||||
__gthread_objc_mutex_unlock (objc_mutex_t mutex _GLIBCXX_UNUSED)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Backend condition mutex functions */
|
||||
|
||||
/* Allocate a condition. */
|
||||
static inline int
|
||||
__gthread_objc_condition_allocate (objc_condition_t condition _GLIBCXX_UNUSED)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Deallocate a condition. */
|
||||
static inline int
|
||||
__gthread_objc_condition_deallocate (objc_condition_t condition _GLIBCXX_UNUSED)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Wait on the condition */
|
||||
static inline int
|
||||
__gthread_objc_condition_wait (objc_condition_t condition _GLIBCXX_UNUSED,
|
||||
objc_mutex_t mutex _GLIBCXX_UNUSED)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Wake up all threads waiting on this condition. */
|
||||
static inline int
|
||||
__gthread_objc_condition_broadcast (objc_condition_t condition _GLIBCXX_UNUSED)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Wake up one thread waiting on this condition. */
|
||||
static inline int
|
||||
__gthread_objc_condition_signal (objc_condition_t condition _GLIBCXX_UNUSED)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
#else /* _LIBOBJC */
|
||||
|
||||
static inline int
|
||||
__gthread_active_p (void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int
|
||||
__gthread_once (__gthread_once_t *__once _GLIBCXX_UNUSED, void (*__func) (void) _GLIBCXX_UNUSED)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int _GLIBCXX_UNUSED
|
||||
__gthread_key_create (__gthread_key_t *__key _GLIBCXX_UNUSED, void (*__func) (void *) _GLIBCXX_UNUSED)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int _GLIBCXX_UNUSED
|
||||
__gthread_key_delete (__gthread_key_t __key _GLIBCXX_UNUSED)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline void *
|
||||
__gthread_getspecific (__gthread_key_t __key _GLIBCXX_UNUSED)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int
|
||||
__gthread_setspecific (__gthread_key_t __key _GLIBCXX_UNUSED, const void *__v _GLIBCXX_UNUSED)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int
|
||||
__gthread_mutex_destroy (__gthread_mutex_t *__mutex _GLIBCXX_UNUSED)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int
|
||||
__gthread_mutex_lock (__gthread_mutex_t *__mutex _GLIBCXX_UNUSED)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int
|
||||
__gthread_mutex_trylock (__gthread_mutex_t *__mutex _GLIBCXX_UNUSED)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int
|
||||
__gthread_mutex_unlock (__gthread_mutex_t *__mutex _GLIBCXX_UNUSED)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int
|
||||
__gthread_recursive_mutex_lock (__gthread_recursive_mutex_t *__mutex)
|
||||
{
|
||||
return __gthread_mutex_lock (__mutex);
|
||||
}
|
||||
|
||||
static inline int
|
||||
__gthread_recursive_mutex_trylock (__gthread_recursive_mutex_t *__mutex)
|
||||
{
|
||||
return __gthread_mutex_trylock (__mutex);
|
||||
}
|
||||
|
||||
static inline int
|
||||
__gthread_recursive_mutex_unlock (__gthread_recursive_mutex_t *__mutex)
|
||||
{
|
||||
return __gthread_mutex_unlock (__mutex);
|
||||
}
|
||||
|
||||
static inline int
|
||||
__gthread_recursive_mutex_destroy (__gthread_recursive_mutex_t *__mutex)
|
||||
{
|
||||
return __gthread_mutex_destroy (__mutex);
|
||||
}
|
||||
|
||||
#endif /* _LIBOBJC */
|
||||
|
||||
#undef _GLIBCXX_UNUSED
|
||||
|
||||
#endif /* ! _GLIBCXX_GCC_GTHR_SINGLE_H */
|
154
bits/gthr.h
154
bits/gthr.h
@ -1,154 +0,0 @@
|
||||
/* Threads compatibility routines for libgcc2. */
|
||||
/* Compile this one with gcc. */
|
||||
/* Copyright (C) 1997-2013 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GCC.
|
||||
|
||||
GCC is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free
|
||||
Software Foundation; either version 3, or (at your option) any later
|
||||
version.
|
||||
|
||||
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
Under Section 7 of GPL version 3, you are granted additional
|
||||
permissions described in the GCC Runtime Library Exception, version
|
||||
3.1, as published by the Free Software Foundation.
|
||||
|
||||
You should have received a copy of the GNU General Public License and
|
||||
a copy of the GCC Runtime Library Exception along with this program;
|
||||
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef _GLIBCXX_GCC_GTHR_H
|
||||
#define _GLIBCXX_GCC_GTHR_H
|
||||
|
||||
#ifndef _GLIBCXX_HIDE_EXPORTS
|
||||
#pragma GCC visibility push(default)
|
||||
#endif
|
||||
|
||||
/* If this file is compiled with threads support, it must
|
||||
#define __GTHREADS 1
|
||||
to indicate that threads support is present. Also it has define
|
||||
function
|
||||
int __gthread_active_p ()
|
||||
that returns 1 if thread system is active, 0 if not.
|
||||
|
||||
The threads interface must define the following types:
|
||||
__gthread_key_t
|
||||
__gthread_once_t
|
||||
__gthread_mutex_t
|
||||
__gthread_recursive_mutex_t
|
||||
|
||||
The threads interface must define the following macros:
|
||||
|
||||
__GTHREAD_ONCE_INIT
|
||||
to initialize __gthread_once_t
|
||||
__GTHREAD_MUTEX_INIT
|
||||
to initialize __gthread_mutex_t to get a fast
|
||||
non-recursive mutex.
|
||||
__GTHREAD_MUTEX_INIT_FUNCTION
|
||||
to initialize __gthread_mutex_t to get a fast
|
||||
non-recursive mutex.
|
||||
Define this to a function which looks like this:
|
||||
void __GTHREAD_MUTEX_INIT_FUNCTION (__gthread_mutex_t *)
|
||||
Some systems can't initialize a mutex without a
|
||||
function call. Don't define __GTHREAD_MUTEX_INIT in this case.
|
||||
__GTHREAD_RECURSIVE_MUTEX_INIT
|
||||
__GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION
|
||||
as above, but for a recursive mutex.
|
||||
|
||||
The threads interface must define the following static functions:
|
||||
|
||||
int __gthread_once (__gthread_once_t *once, void (*func) ())
|
||||
|
||||
int __gthread_key_create (__gthread_key_t *keyp, void (*dtor) (void *))
|
||||
int __gthread_key_delete (__gthread_key_t key)
|
||||
|
||||
void *__gthread_getspecific (__gthread_key_t key)
|
||||
int __gthread_setspecific (__gthread_key_t key, const void *ptr)
|
||||
|
||||
int __gthread_mutex_destroy (__gthread_mutex_t *mutex);
|
||||
int __gthread_recursive_mutex_destroy (__gthread_recursive_mutex_t *mutex);
|
||||
|
||||
int __gthread_mutex_lock (__gthread_mutex_t *mutex);
|
||||
int __gthread_mutex_trylock (__gthread_mutex_t *mutex);
|
||||
int __gthread_mutex_unlock (__gthread_mutex_t *mutex);
|
||||
|
||||
int __gthread_recursive_mutex_lock (__gthread_recursive_mutex_t *mutex);
|
||||
int __gthread_recursive_mutex_trylock (__gthread_recursive_mutex_t *mutex);
|
||||
int __gthread_recursive_mutex_unlock (__gthread_recursive_mutex_t *mutex);
|
||||
|
||||
The following are supported in POSIX threads only. They are required to
|
||||
fix a deadlock in static initialization inside libsupc++. The header file
|
||||
gthr-posix.h defines a symbol __GTHREAD_HAS_COND to signify that these extra
|
||||
features are supported.
|
||||
|
||||
Types:
|
||||
__gthread_cond_t
|
||||
|
||||
Macros:
|
||||
__GTHREAD_COND_INIT
|
||||
__GTHREAD_COND_INIT_FUNCTION
|
||||
|
||||
Interface:
|
||||
int __gthread_cond_broadcast (__gthread_cond_t *cond);
|
||||
int __gthread_cond_wait (__gthread_cond_t *cond, __gthread_mutex_t *mutex);
|
||||
int __gthread_cond_wait_recursive (__gthread_cond_t *cond,
|
||||
__gthread_recursive_mutex_t *mutex);
|
||||
|
||||
All functions returning int should return zero on success or the error
|
||||
number. If the operation is not supported, -1 is returned.
|
||||
|
||||
If the following are also defined, you should
|
||||
#define __GTHREADS_CXX0X 1
|
||||
to enable the c++0x thread library.
|
||||
|
||||
Types:
|
||||
__gthread_t
|
||||
__gthread_time_t
|
||||
|
||||
Interface:
|
||||
int __gthread_create (__gthread_t *thread, void *(*func) (void*),
|
||||
void *args);
|
||||
int __gthread_join (__gthread_t thread, void **value_ptr);
|
||||
int __gthread_detach (__gthread_t thread);
|
||||
int __gthread_equal (__gthread_t t1, __gthread_t t2);
|
||||
__gthread_t __gthread_self (void);
|
||||
int __gthread_yield (void);
|
||||
|
||||
int __gthread_mutex_timedlock (__gthread_mutex_t *m,
|
||||
const __gthread_time_t *abs_timeout);
|
||||
int __gthread_recursive_mutex_timedlock (__gthread_recursive_mutex_t *m,
|
||||
const __gthread_time_t *abs_time);
|
||||
|
||||
int __gthread_cond_signal (__gthread_cond_t *cond);
|
||||
int __gthread_cond_timedwait (__gthread_cond_t *cond,
|
||||
__gthread_mutex_t *mutex,
|
||||
const __gthread_time_t *abs_timeout);
|
||||
|
||||
*/
|
||||
|
||||
#if __GXX_WEAK__
|
||||
/* The pe-coff weak support isn't fully compatible to ELF's weak.
|
||||
For static libraries it might would work, but as we need to deal
|
||||
with shared versions too, we disable it for mingw-targets. */
|
||||
#ifdef __MINGW32__
|
||||
#undef _GLIBCXX_GTHREAD_USE_WEAK
|
||||
#define _GLIBCXX_GTHREAD_USE_WEAK 0
|
||||
#endif
|
||||
|
||||
#ifndef _GLIBCXX_GTHREAD_USE_WEAK
|
||||
#define _GLIBCXX_GTHREAD_USE_WEAK 1
|
||||
#endif
|
||||
#endif
|
||||
#include <bits/gthr-default.h>
|
||||
|
||||
#ifndef _GLIBCXX_HIDE_EXPORTS
|
||||
#pragma GCC visibility pop
|
||||
#endif
|
||||
|
||||
#endif /* ! _GLIBCXX_GCC_GTHR_H */
|
@ -1,130 +0,0 @@
|
||||
// std::messages implementation details, GNU version -*- C++ -*-
|
||||
|
||||
// Copyright (C) 2001-2013 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// Under Section 7 of GPL version 3, you are granted additional
|
||||
// permissions described in the GCC Runtime Library Exception, version
|
||||
// 3.1, as published by the Free Software Foundation.
|
||||
|
||||
// You should have received a copy of the GNU General Public License and
|
||||
// a copy of the GCC Runtime Library Exception along with this program;
|
||||
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
/** @file bits/messages_members.h
|
||||
* This is an internal header file, included by other library headers.
|
||||
* Do not attempt to use it directly. @headername{locale}
|
||||
*/
|
||||
|
||||
//
|
||||
// ISO C++ 14882: 22.2.7.1.2 messages functions
|
||||
//
|
||||
|
||||
// Written by Benjamin Kosnik <bkoz@redhat.com>
|
||||
|
||||
#include <libintl.h>
|
||||
|
||||
namespace std _GLIBCXX_VISIBILITY(default)
|
||||
{
|
||||
_GLIBCXX_BEGIN_NAMESPACE_VERSION
|
||||
|
||||
// Non-virtual member functions.
|
||||
template<typename _CharT>
|
||||
messages<_CharT>::messages(size_t __refs)
|
||||
: facet(__refs), _M_c_locale_messages(_S_get_c_locale()),
|
||||
_M_name_messages(_S_get_c_name())
|
||||
{ }
|
||||
|
||||
template<typename _CharT>
|
||||
messages<_CharT>::messages(__c_locale __cloc, const char* __s,
|
||||
size_t __refs)
|
||||
: facet(__refs), _M_c_locale_messages(0), _M_name_messages(0)
|
||||
{
|
||||
if (__builtin_strcmp(__s, _S_get_c_name()) != 0)
|
||||
{
|
||||
const size_t __len = __builtin_strlen(__s) + 1;
|
||||
char* __tmp = new char[__len];
|
||||
__builtin_memcpy(__tmp, __s, __len);
|
||||
_M_name_messages = __tmp;
|
||||
}
|
||||
else
|
||||
_M_name_messages = _S_get_c_name();
|
||||
|
||||
// Last to avoid leaking memory if new throws.
|
||||
_M_c_locale_messages = _S_clone_c_locale(__cloc);
|
||||
}
|
||||
|
||||
template<typename _CharT>
|
||||
typename messages<_CharT>::catalog
|
||||
messages<_CharT>::open(const basic_string<char>& __s, const locale& __loc,
|
||||
const char* __dir) const
|
||||
{
|
||||
bindtextdomain(__s.c_str(), __dir);
|
||||
return this->do_open(__s, __loc);
|
||||
}
|
||||
|
||||
// Virtual member functions.
|
||||
template<typename _CharT>
|
||||
messages<_CharT>::~messages()
|
||||
{
|
||||
if (_M_name_messages != _S_get_c_name())
|
||||
delete [] _M_name_messages;
|
||||
_S_destroy_c_locale(_M_c_locale_messages);
|
||||
}
|
||||
|
||||
template<typename _CharT>
|
||||
typename messages<_CharT>::catalog
|
||||
messages<_CharT>::do_open(const basic_string<char>& __s,
|
||||
const locale&) const
|
||||
{
|
||||
// No error checking is done, assume the catalog exists and can
|
||||
// be used.
|
||||
textdomain(__s.c_str());
|
||||
return 0;
|
||||
}
|
||||
|
||||
template<typename _CharT>
|
||||
void
|
||||
messages<_CharT>::do_close(catalog) const
|
||||
{ }
|
||||
|
||||
// messages_byname
|
||||
template<typename _CharT>
|
||||
messages_byname<_CharT>::messages_byname(const char* __s, size_t __refs)
|
||||
: messages<_CharT>(__refs)
|
||||
{
|
||||
if (this->_M_name_messages != locale::facet::_S_get_c_name())
|
||||
{
|
||||
delete [] this->_M_name_messages;
|
||||
if (__builtin_strcmp(__s, locale::facet::_S_get_c_name()) != 0)
|
||||
{
|
||||
const size_t __len = __builtin_strlen(__s) + 1;
|
||||
char* __tmp = new char[__len];
|
||||
__builtin_memcpy(__tmp, __s, __len);
|
||||
this->_M_name_messages = __tmp;
|
||||
}
|
||||
else
|
||||
this->_M_name_messages = locale::facet::_S_get_c_name();
|
||||
}
|
||||
|
||||
if (__builtin_strcmp(__s, "C") != 0
|
||||
&& __builtin_strcmp(__s, "POSIX") != 0)
|
||||
{
|
||||
this->_S_destroy_c_locale(this->_M_c_locale_messages);
|
||||
this->_S_create_c_locale(this->_M_c_locale_messages, __s);
|
||||
}
|
||||
}
|
||||
|
||||
_GLIBCXX_END_NAMESPACE_VERSION
|
||||
} // namespace
|
@ -1,219 +0,0 @@
|
||||
// Optimizations for random number functions, x86 version -*- C++ -*-
|
||||
|
||||
// Copyright (C) 2012-2013 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// Under Section 7 of GPL version 3, you are granted additional
|
||||
// permissions described in the GCC Runtime Library Exception, version
|
||||
// 3.1, as published by the Free Software Foundation.
|
||||
|
||||
// You should have received a copy of the GNU General Public License and
|
||||
// a copy of the GCC Runtime Library Exception along with this program;
|
||||
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
/** @file bits/opt_random.h
|
||||
* This is an internal header file, included by other library headers.
|
||||
* Do not attempt to use it directly. @headername{random}
|
||||
*/
|
||||
|
||||
#ifndef _BITS_OPT_RANDOM_H
|
||||
#define _BITS_OPT_RANDOM_H 1
|
||||
|
||||
#include <x86intrin.h>
|
||||
|
||||
|
||||
#pragma GCC system_header
|
||||
|
||||
|
||||
namespace std _GLIBCXX_VISIBILITY(default)
|
||||
{
|
||||
_GLIBCXX_BEGIN_NAMESPACE_VERSION
|
||||
|
||||
#ifdef __SSE3__
|
||||
template<>
|
||||
template<typename _UniformRandomNumberGenerator>
|
||||
void
|
||||
normal_distribution<double>::
|
||||
__generate(typename normal_distribution<double>::result_type* __f,
|
||||
typename normal_distribution<double>::result_type* __t,
|
||||
_UniformRandomNumberGenerator& __urng,
|
||||
const param_type& __param)
|
||||
{
|
||||
typedef uint64_t __uctype;
|
||||
|
||||
if (__f == __t)
|
||||
return;
|
||||
|
||||
if (_M_saved_available)
|
||||
{
|
||||
_M_saved_available = false;
|
||||
*__f++ = _M_saved * __param.stddev() + __param.mean();
|
||||
|
||||
if (__f == __t)
|
||||
return;
|
||||
}
|
||||
|
||||
constexpr uint64_t __maskval = 0xfffffffffffffull;
|
||||
static const __m128i __mask = _mm_set1_epi64x(__maskval);
|
||||
static const __m128i __two = _mm_set1_epi64x(0x4000000000000000ull);
|
||||
static const __m128d __three = _mm_set1_pd(3.0);
|
||||
const __m128d __av = _mm_set1_pd(__param.mean());
|
||||
|
||||
const __uctype __urngmin = __urng.min();
|
||||
const __uctype __urngmax = __urng.max();
|
||||
const __uctype __urngrange = __urngmax - __urngmin;
|
||||
const __uctype __uerngrange = __urngrange + 1;
|
||||
|
||||
while (__f + 1 < __t)
|
||||
{
|
||||
double __le;
|
||||
__m128d __x;
|
||||
do
|
||||
{
|
||||
union
|
||||
{
|
||||
__m128i __i;
|
||||
__m128d __d;
|
||||
} __v;
|
||||
|
||||
if (__urngrange > __maskval)
|
||||
{
|
||||
if (__detail::_Power_of_2(__uerngrange))
|
||||
__v.__i = _mm_and_si128(_mm_set_epi64x(__urng(),
|
||||
__urng()),
|
||||
__mask);
|
||||
else
|
||||
{
|
||||
const __uctype __uerange = __maskval + 1;
|
||||
const __uctype __scaling = __urngrange / __uerange;
|
||||
const __uctype __past = __uerange * __scaling;
|
||||
uint64_t __v1;
|
||||
do
|
||||
__v1 = __uctype(__urng()) - __urngmin;
|
||||
while (__v1 >= __past);
|
||||
__v1 /= __scaling;
|
||||
uint64_t __v2;
|
||||
do
|
||||
__v2 = __uctype(__urng()) - __urngmin;
|
||||
while (__v2 >= __past);
|
||||
__v2 /= __scaling;
|
||||
|
||||
__v.__i = _mm_set_epi64x(__v1, __v2);
|
||||
}
|
||||
}
|
||||
else if (__urngrange == __maskval)
|
||||
__v.__i = _mm_set_epi64x(__urng(), __urng());
|
||||
else if ((__urngrange + 2) * __urngrange >= __maskval
|
||||
&& __detail::_Power_of_2(__uerngrange))
|
||||
{
|
||||
uint64_t __v1 = __urng() * __uerngrange + __urng();
|
||||
uint64_t __v2 = __urng() * __uerngrange + __urng();
|
||||
|
||||
__v.__i = _mm_and_si128(_mm_set_epi64x(__v1, __v2),
|
||||
__mask);
|
||||
}
|
||||
else
|
||||
{
|
||||
size_t __nrng = 2;
|
||||
__uctype __high = __maskval / __uerngrange / __uerngrange;
|
||||
while (__high > __uerngrange)
|
||||
{
|
||||
++__nrng;
|
||||
__high /= __uerngrange;
|
||||
}
|
||||
const __uctype __highrange = __high + 1;
|
||||
const __uctype __scaling = __urngrange / __highrange;
|
||||
const __uctype __past = __highrange * __scaling;
|
||||
__uctype __tmp;
|
||||
|
||||
uint64_t __v1;
|
||||
do
|
||||
{
|
||||
do
|
||||
__tmp = __uctype(__urng()) - __urngmin;
|
||||
while (__tmp >= __past);
|
||||
__v1 = __tmp / __scaling;
|
||||
for (size_t __cnt = 0; __cnt < __nrng; ++__cnt)
|
||||
{
|
||||
__tmp = __v1;
|
||||
__v1 *= __uerngrange;
|
||||
__v1 += __uctype(__urng()) - __urngmin;
|
||||
}
|
||||
}
|
||||
while (__v1 > __maskval || __v1 < __tmp);
|
||||
|
||||
uint64_t __v2;
|
||||
do
|
||||
{
|
||||
do
|
||||
__tmp = __uctype(__urng()) - __urngmin;
|
||||
while (__tmp >= __past);
|
||||
__v2 = __tmp / __scaling;
|
||||
for (size_t __cnt = 0; __cnt < __nrng; ++__cnt)
|
||||
{
|
||||
__tmp = __v2;
|
||||
__v2 *= __uerngrange;
|
||||
__v2 += __uctype(__urng()) - __urngmin;
|
||||
}
|
||||
}
|
||||
while (__v2 > __maskval || __v2 < __tmp);
|
||||
|
||||
__v.__i = _mm_set_epi64x(__v1, __v2);
|
||||
}
|
||||
|
||||
__v.__i = _mm_or_si128(__v.__i, __two);
|
||||
__x = _mm_sub_pd(__v.__d, __three);
|
||||
__m128d __m = _mm_mul_pd(__x, __x);
|
||||
__le = _mm_cvtsd_f64(_mm_hadd_pd (__m, __m));
|
||||
}
|
||||
while (__le == 0.0 || __le >= 1.0);
|
||||
|
||||
double __mult = (std::sqrt(-2.0 * std::log(__le) / __le)
|
||||
* __param.stddev());
|
||||
|
||||
__x = _mm_add_pd(_mm_mul_pd(__x, _mm_set1_pd(__mult)), __av);
|
||||
|
||||
_mm_storeu_pd(__f, __x);
|
||||
__f += 2;
|
||||
}
|
||||
|
||||
if (__f != __t)
|
||||
{
|
||||
result_type __x, __y, __r2;
|
||||
|
||||
__detail::_Adaptor<_UniformRandomNumberGenerator, result_type>
|
||||
__aurng(__urng);
|
||||
|
||||
do
|
||||
{
|
||||
__x = result_type(2.0) * __aurng() - 1.0;
|
||||
__y = result_type(2.0) * __aurng() - 1.0;
|
||||
__r2 = __x * __x + __y * __y;
|
||||
}
|
||||
while (__r2 > 1.0 || __r2 == 0.0);
|
||||
|
||||
const result_type __mult = std::sqrt(-2 * std::log(__r2) / __r2);
|
||||
_M_saved = __x * __mult;
|
||||
_M_saved_available = true;
|
||||
*__f = __y * __mult * __param.stddev() + __param.mean();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
_GLIBCXX_END_NAMESPACE_VERSION
|
||||
} // namespace
|
||||
|
||||
|
||||
#endif // _BITS_OPT_RANDOM_H
|
@ -1,48 +0,0 @@
|
||||
// Specific definitions for GNU/Linux -*- C++ -*-
|
||||
|
||||
// Copyright (C) 2000-2013 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// Under Section 7 of GPL version 3, you are granted additional
|
||||
// permissions described in the GCC Runtime Library Exception, version
|
||||
// 3.1, as published by the Free Software Foundation.
|
||||
|
||||
// You should have received a copy of the GNU General Public License and
|
||||
// a copy of the GCC Runtime Library Exception along with this program;
|
||||
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
/** @file bits/os_defines.h
|
||||
* This is an internal header file, included by other library headers.
|
||||
* Do not attempt to use it directly. @headername{iosfwd}
|
||||
*/
|
||||
|
||||
#ifndef _GLIBCXX_OS_DEFINES
|
||||
#define _GLIBCXX_OS_DEFINES 1
|
||||
|
||||
// System-specific #define, typedefs, corrections, etc, go here. This
|
||||
// file will come before all others.
|
||||
|
||||
// This keeps isanum, et al from being propagated as macros.
|
||||
#define __NO_CTYPE 1
|
||||
|
||||
#include <features.h>
|
||||
|
||||
// Provide a declaration for the possibly deprecated gets function, as
|
||||
// glibc 2.15 and later does not declare gets for ISO C11 when
|
||||
// __GNU_SOURCE is defined.
|
||||
#if __GLIBC_PREREQ(2,15) && defined(_GNU_SOURCE)
|
||||
# undef _GLIBCXX_HAVE_GETS
|
||||
#endif
|
||||
|
||||
#endif
|
117
bits/stdc++.h
117
bits/stdc++.h
@ -1,117 +0,0 @@
|
||||
// C++ includes used for precompiling -*- C++ -*-
|
||||
|
||||
// Copyright (C) 2003-2013 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// Under Section 7 of GPL version 3, you are granted additional
|
||||
// permissions described in the GCC Runtime Library Exception, version
|
||||
// 3.1, as published by the Free Software Foundation.
|
||||
|
||||
// You should have received a copy of the GNU General Public License and
|
||||
// a copy of the GCC Runtime Library Exception along with this program;
|
||||
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
/** @file stdc++.h
|
||||
* This is an implementation file for a precompiled header.
|
||||
*/
|
||||
|
||||
// 17.4.1.2 Headers
|
||||
|
||||
// C
|
||||
#ifndef _GLIBCXX_NO_ASSERT
|
||||
#include <cassert>
|
||||
#endif
|
||||
#include <cctype>
|
||||
#include <cerrno>
|
||||
#include <cfloat>
|
||||
#include <ciso646>
|
||||
#include <climits>
|
||||
#include <clocale>
|
||||
#include <cmath>
|
||||
#include <csetjmp>
|
||||
#include <csignal>
|
||||
#include <cstdarg>
|
||||
#include <cstddef>
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
#include <ctime>
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
#include <ccomplex>
|
||||
#include <cfenv>
|
||||
#include <cinttypes>
|
||||
#include <cstdalign>
|
||||
#include <cstdbool>
|
||||
#include <cstdint>
|
||||
#include <ctgmath>
|
||||
#include <cwchar>
|
||||
#include <cwctype>
|
||||
#endif
|
||||
|
||||
// C++
|
||||
#include <algorithm>
|
||||
#include <bitset>
|
||||
#include <complex>
|
||||
#include <deque>
|
||||
#include <exception>
|
||||
#include <fstream>
|
||||
#include <functional>
|
||||
#include <iomanip>
|
||||
#include <ios>
|
||||
#include <iosfwd>
|
||||
#include <iostream>
|
||||
#include <istream>
|
||||
#include <iterator>
|
||||
#include <limits>
|
||||
#include <list>
|
||||
#include <locale>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <new>
|
||||
#include <numeric>
|
||||
#include <ostream>
|
||||
#include <queue>
|
||||
#include <set>
|
||||
#include <sstream>
|
||||
#include <stack>
|
||||
#include <stdexcept>
|
||||
#include <streambuf>
|
||||
#include <string>
|
||||
#include <typeinfo>
|
||||
#include <utility>
|
||||
#include <valarray>
|
||||
#include <vector>
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
#include <array>
|
||||
#include <atomic>
|
||||
#include <chrono>
|
||||
#include <condition_variable>
|
||||
#include <forward_list>
|
||||
#include <future>
|
||||
#include <initializer_list>
|
||||
#include <mutex>
|
||||
#include <random>
|
||||
#include <ratio>
|
||||
#include <regex>
|
||||
#include <scoped_allocator>
|
||||
#include <system_error>
|
||||
#include <thread>
|
||||
#include <tuple>
|
||||
#include <typeindex>
|
||||
#include <type_traits>
|
||||
#include <unordered_map>
|
||||
#include <unordered_set>
|
||||
#endif
|
@ -1,53 +0,0 @@
|
||||
// C++ includes used for precompiling TR1 -*- C++ -*-
|
||||
|
||||
// Copyright (C) 2006-2013 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// Under Section 7 of GPL version 3, you are granted additional
|
||||
// permissions described in the GCC Runtime Library Exception, version
|
||||
// 3.1, as published by the Free Software Foundation.
|
||||
|
||||
// You should have received a copy of the GNU General Public License and
|
||||
// a copy of the GCC Runtime Library Exception along with this program;
|
||||
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
/** @file stdtr1c++.h
|
||||
* This is an implementation file for a precompiled header.
|
||||
*/
|
||||
|
||||
#include <bits/stdc++.h>
|
||||
|
||||
#include <tr1/array>
|
||||
#include <tr1/cctype>
|
||||
#include <tr1/cfenv>
|
||||
#include <tr1/cfloat>
|
||||
#include <tr1/cinttypes>
|
||||
#include <tr1/climits>
|
||||
#include <tr1/cmath>
|
||||
#include <tr1/complex>
|
||||
#include <tr1/cstdarg>
|
||||
#include <tr1/cstdbool>
|
||||
#include <tr1/cstdint>
|
||||
#include <tr1/cstdio>
|
||||
#include <tr1/cstdlib>
|
||||
#include <tr1/ctgmath>
|
||||
#include <tr1/ctime>
|
||||
#include <tr1/cwchar>
|
||||
#include <tr1/cwctype>
|
||||
#include <tr1/functional>
|
||||
#include <tr1/random>
|
||||
#include <tr1/tuple>
|
||||
#include <tr1/unordered_map>
|
||||
#include <tr1/unordered_set>
|
||||
#include <tr1/utility>
|
@ -1,89 +0,0 @@
|
||||
// std::time_get, std::time_put implementation, GNU version -*- C++ -*-
|
||||
|
||||
// Copyright (C) 2001-2013 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// Under Section 7 of GPL version 3, you are granted additional
|
||||
// permissions described in the GCC Runtime Library Exception, version
|
||||
// 3.1, as published by the Free Software Foundation.
|
||||
|
||||
// You should have received a copy of the GNU General Public License and
|
||||
// a copy of the GCC Runtime Library Exception along with this program;
|
||||
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
/** @file bits/time_members.h
|
||||
* This is an internal header file, included by other library headers.
|
||||
* Do not attempt to use it directly. @headername{locale}
|
||||
*/
|
||||
|
||||
//
|
||||
// ISO C++ 14882: 22.2.5.1.2 - time_get functions
|
||||
// ISO C++ 14882: 22.2.5.3.2 - time_put functions
|
||||
//
|
||||
|
||||
// Written by Benjamin Kosnik <bkoz@redhat.com>
|
||||
|
||||
namespace std _GLIBCXX_VISIBILITY(default)
|
||||
{
|
||||
_GLIBCXX_BEGIN_NAMESPACE_VERSION
|
||||
|
||||
template<typename _CharT>
|
||||
__timepunct<_CharT>::__timepunct(size_t __refs)
|
||||
: facet(__refs), _M_data(0), _M_c_locale_timepunct(0),
|
||||
_M_name_timepunct(_S_get_c_name())
|
||||
{ _M_initialize_timepunct(); }
|
||||
|
||||
template<typename _CharT>
|
||||
__timepunct<_CharT>::__timepunct(__cache_type* __cache, size_t __refs)
|
||||
: facet(__refs), _M_data(__cache), _M_c_locale_timepunct(0),
|
||||
_M_name_timepunct(_S_get_c_name())
|
||||
{ _M_initialize_timepunct(); }
|
||||
|
||||
template<typename _CharT>
|
||||
__timepunct<_CharT>::__timepunct(__c_locale __cloc, const char* __s,
|
||||
size_t __refs)
|
||||
: facet(__refs), _M_data(0), _M_c_locale_timepunct(0),
|
||||
_M_name_timepunct(0)
|
||||
{
|
||||
if (__builtin_strcmp(__s, _S_get_c_name()) != 0)
|
||||
{
|
||||
const size_t __len = __builtin_strlen(__s) + 1;
|
||||
char* __tmp = new char[__len];
|
||||
__builtin_memcpy(__tmp, __s, __len);
|
||||
_M_name_timepunct = __tmp;
|
||||
}
|
||||
else
|
||||
_M_name_timepunct = _S_get_c_name();
|
||||
|
||||
__try
|
||||
{ _M_initialize_timepunct(__cloc); }
|
||||
__catch(...)
|
||||
{
|
||||
if (_M_name_timepunct != _S_get_c_name())
|
||||
delete [] _M_name_timepunct;
|
||||
__throw_exception_again;
|
||||
}
|
||||
}
|
||||
|
||||
template<typename _CharT>
|
||||
__timepunct<_CharT>::~__timepunct()
|
||||
{
|
||||
if (_M_name_timepunct != _S_get_c_name())
|
||||
delete [] _M_name_timepunct;
|
||||
delete _M_data;
|
||||
_S_destroy_c_locale(_M_c_locale_timepunct);
|
||||
}
|
||||
|
||||
_GLIBCXX_END_NAMESPACE_VERSION
|
||||
} // namespace
|
@ -6,6 +6,7 @@
|
||||
|
||||
#include <ctype.h> // Log.h
|
||||
#include <errno.h> // Errno.h
|
||||
#include <sys/errno.h> // Errno.h
|
||||
#include <stdarg.h> // Log.h
|
||||
#include <stdint.h> // commonly included in include files
|
||||
#include <stdio.h> // commonly included in include files
|
||||
@ -20,4 +21,9 @@
|
||||
#include "Errno.h" // commonly included in include files
|
||||
#include "Log.h" // commonly included in include files
|
||||
|
||||
// cygwin fix
|
||||
#ifndef O_ASYNC
|
||||
#define O_ASYNC 0
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
44
gb.deb.rules
Executable file
44
gb.deb.rules
Executable file
@ -0,0 +1,44 @@
|
||||
#!/usr/bin/make -f
|
||||
# -*- makefile -*-
|
||||
# Sample debian/rules that uses debhelper.
|
||||
# This file was originally written by Joey Hess and Craig Small.
|
||||
# As a special exception, when this file is copied by dh-make into a
|
||||
# dh-make output file, you may use that output file without restriction.
|
||||
# This special exception was added by Craig Small in version 0.37 of dh-make.
|
||||
|
||||
# Uncomment this to turn on verbose mode.
|
||||
export DH_VERBOSE=1
|
||||
|
||||
#overide_dh_strip:
|
||||
# echo "shit"
|
||||
|
||||
#binary:
|
||||
# echo "shit"
|
||||
|
||||
%:
|
||||
dh $@
|
||||
|
||||
# it calls i386-objdump which does not exist
|
||||
# we override dh_shlibdeps below so this is not need either
|
||||
override_dh_makeshlibs:
|
||||
echo "skipping dh_makeshlibs call! MDW"
|
||||
|
||||
# it calls i386-strip which does not exist
|
||||
# most binaries are already stripped anyway i think, so not important...
|
||||
override_dh_strip:
|
||||
echo "skipping dh_strip call! MDW"
|
||||
|
||||
# skip this step, it puts "shlibs:Depends=libc6 (>= 2.3)" into
|
||||
# debian/gb.substvars and makes dpkg -i bitch about dependencies not being met
|
||||
override_dh_shlibdeps:
|
||||
echo "skipping dh_shlibdeps call! MDW"
|
||||
|
||||
# override_dh_shlibdeps-indep:
|
||||
# echo "shit"
|
||||
|
||||
# override_dh_shlibdeps-i386:
|
||||
# echo "shit"
|
||||
|
||||
# override_shlibdeps:
|
||||
# echo "shit"
|
||||
|
@ -89,23 +89,70 @@ A work-in-progress <a href=/compare.html>comparison to SOLR</a>.
|
||||
|
||||
<br><br><a name=quickstart></a>
|
||||
<h1>Quick Start</h1>
|
||||
<<i>Last Updated May 2014</i>>
|
||||
<<i>Last Updated June 2014</i>>
|
||||
<br>
|
||||
<br>
|
||||
|
||||
<b><font color=red>Requirements:</font></b>
|
||||
<br><br>
|
||||
|
||||
<!--Until I get the binary packages ready, <a href=#src>build from the source code</a>, it should only take about 30 seconds to type the three commands.-->
|
||||
|
||||
Requirements: You will need an Intel or AMD system running Linux and at least 4GB of RAM to run one instance/host of gb.<br><br>
|
||||
|
||||
Install the <a href=http://www.gigablast.com/gb-1.0-0.i686.rpm>Gigablast package for RedHat</a>. This package is beta. Ubuntu package is coming soon, <a href=#src>build from source code</a> for that for now.
|
||||
You will need an Intel or AMD system with at least 4GB of RAM for every gigablast shard you want to run.
|
||||
|
||||
<br><br>
|
||||
If it does not start by itself type 'gb -d' (as root) to run it in the background as a daemon.
|
||||
|
||||
<b><font color=red>For Linux:</font></b>
|
||||
<br><br>
|
||||
|
||||
1. Download the <a href=http://www.gigablast.com/gb-1.0-0.i686.rpm>Gigablast package for <b>RedHat</b> Linux</a> or the <a href=http://www.gigablast.com/gb_1.0-1_i386.deb>Gigablast package for <b>Ubuntu</b>/Debian Linux</a>.
|
||||
|
||||
<br><br>
|
||||
Once installed visit your <a href=http://127.0.0.1:8000/>local port 8000</a> to access the search engine controls and begin configuration. It could take up to 20 seconds to start the search engine for the first time.
|
||||
|
||||
2. After downloading, install the package by entering <b>sudo dpkg -i <i><filename></i></b> where filename is the file you just downloaded.
|
||||
|
||||
<br><br>
|
||||
3. Type <b>sudo gb -d</b> to run it in the background as a daemon.
|
||||
|
||||
<br><br>
|
||||
4. If running for the first time, it could take up to 20 seconds to build some preliminary files.
|
||||
|
||||
<br><br>
|
||||
5. Once running, visit <a href=http://127.0.0.1:8000/>port 8000</a> with your browser to access the Gigablast controls.
|
||||
|
||||
<br><br>
|
||||
|
||||
|
||||
<b><font color=red>For Microsoft Windows:</font></b>
|
||||
<br><br>
|
||||
1. If you are running Microsoft Windows, then you will need to install Oracle's <a href=http://www.virtualbox.org/wiki/Downloads><b>VirtualBox for Windows hosts</b></a> software. That will allow you to run Linux in its own window on your Microsoft Windows desktop.
|
||||
|
||||
<br><br>
|
||||
|
||||
2. When configuring a new Linux virtual machine in VirtualBox, make sure you select at least 4GB of RAM.
|
||||
|
||||
<br><br>
|
||||
|
||||
3. Once VirtualBox is installed you can download either an
|
||||
<!--<a href=http://virtualboxes.org/images/ubuntu/>Ubuntu</a> or <a href=http://virtualboxes.org/images/fedora/>RedHat Fedora</a>-->
|
||||
<a href="http://www.ubuntu.com/download/desktop">Ubuntu CD-ROM Image (.iso file)</a> or a <a href="http://fedoraproject.org/get-fedora">Red Hat Fedora CD-ROM Image (.iso file)</a>.
|
||||
The CD-ROM Images represent Linux installation CDs.
|
||||
|
||||
<br><br>
|
||||
|
||||
4. When you boot up Ubuntu or Fedora under VirtualBox for the first time, it will prompt you for the CD-ROM drive, and it will allow you to enter your .iso filename there.
|
||||
|
||||
<br><br>
|
||||
|
||||
5. Once you finish the Linux installation process
|
||||
and then boot into Linux through VirtualBox, you can follow the Linux Quick Start instructions above.
|
||||
|
||||
<br><br>
|
||||
<br>
|
||||
|
||||
<hr>
|
||||
|
||||
<br>
|
||||
|
||||
<table><tr><td colspan=2><b>Installed Files</b></td></tr>
|
||||
<tr><td><nobr>/var/gigablast/data0/</nobr></td><td>Directory of Gigablast binary and data files</td></tr>
|
||||
@ -150,17 +197,17 @@ For RedHat do a <b>yum install gcc-c++</b>
|
||||
-->
|
||||
|
||||
<b>1.</b> For <u>Ubuntu</u> do <b>apt-get install make g++ gcc-multilib lib32stdc++6</b>
|
||||
<br>
|
||||
<br><br>
|
||||
<b>2.</b> For <u>RedHat</u> do <b>yum install gcc-c++</b>
|
||||
<br>
|
||||
<br><br>
|
||||
<b>3.</b> Download the <a href=https://github.com/gigablast/open-source-search-engine>Gigablast source code</a> using <b>wget --no-check-certificate "https://github.com/gigablast/open-source-search-engine/archive/master.zip"</b>, unzip it and cd into it. (optionally use <b>git clone https://github.com/gigablast/open-source-search-engine.git ./github</b> if you have <i>git</i> installed.)
|
||||
<br>
|
||||
<br><br>
|
||||
<b>4.</b> Run <b>make</b> to compile. (e.g. use 'make -j 4' to compile on four cores)
|
||||
<br>
|
||||
<br><br>
|
||||
<b>5.</b> Run <b>./gb -d</b> to start a single gigablast node which listens on port 8000 running in daemon mode (-d).
|
||||
<br>
|
||||
<br><br>
|
||||
<b>6.</b> The first time you run gb, wait about 30 seconds for it to build some files. Check the log file to see when it completes.
|
||||
<br>
|
||||
<br><br>
|
||||
<b>7.</b> Go to the <a href=http://127.0.0.1:8000/>root page</a> to begin.
|
||||
|
||||
<br>
|
||||
@ -326,17 +373,17 @@ Each directory should have the following files and subdirectories:<br><br>
|
||||
<br>
|
||||
<br>
|
||||
1. Turn off spidering in the <a href=/admin/master>master controls</a>.
|
||||
<br>
|
||||
<br><br>
|
||||
2. Shut down the clustering by doing a <b>gb stop</b> command on the command line OR by clicking on "save & exit" in the <a href=/admin/master>master controls</a>
|
||||
<br>
|
||||
<br><br>
|
||||
3. Edit the hosts.conf file in the working directory to add the new hosts. (<a href=/hosts.conf.txt>sample hosts.conf</a>)
|
||||
<br>
|
||||
<br><br>
|
||||
4. Ensure you can do passwordless ssh from host #0 to each new IP address you added. This generally requires running <b>ssh-keygen -t dsa</b> on host #0 to create the files <i>~/.ssh/id_dsa</i> and <i>~/.ssh/id_dsa.pub</i>. Then you need to insert the key in <i>~/.ssh/id_dsa.pub</i> into the <i>~/.ssh/authorized_keys2</i> file on every host, including host #0, in your cluster. Furthermore, you must do a <b>chmod 700 ~/.ssh/authorized_keys2</b> on each one otherwise the passwordless ssh will not work.
|
||||
<br>
|
||||
<br><br>
|
||||
5. Run <b>gb install <hostid></b> on host #0 for each new hostid to copy the required files from host #0 to the new hosts. This will do an <i>scp</i> which requires the passwordless ssh. <hostid> can be a range of hostids like <i>5-12</i> as well.
|
||||
<br>
|
||||
<br><br>
|
||||
6. Run <b>gb start</b> on the command line to start up all gb instances/processes in the cluster.
|
||||
<br>
|
||||
<br><br>
|
||||
7. Click on <b>rebalance shards</b> in the <a href=/admin/master>master controls</a> to begin moving data from the old shards to the new shards. The <a href=/admin/hosts>hosts table</a> will let you know when the rebalance operation is complete. It should be able to serve queries during the rebalancing, but spidering can not resume until it is completed.
|
||||
<br>
|
||||
<br>
|
||||
|
14
main.cpp
14
main.cpp
@ -379,10 +379,12 @@ int main2 ( int argc , char *argv[] ) {
|
||||
|
||||
g_conf.m_runAsDaemon = false;
|
||||
|
||||
#ifndef CYGWIN
|
||||
// appears that linux 2.4.17 kernel would crash with this?
|
||||
// let's try again on gk127 to make sure
|
||||
// YES! gk0 cluster has run for months with this just fine!!
|
||||
mlockall(MCL_CURRENT|MCL_FUTURE);
|
||||
#endif
|
||||
|
||||
//g_timedb.makeStartKey ( 0 );
|
||||
|
||||
@ -13736,7 +13738,7 @@ bool pingTest ( long hid , unsigned short clientPort ) {
|
||||
int n;
|
||||
struct sockaddr_in to;
|
||||
sockaddr_in from;
|
||||
unsigned int fromLen;
|
||||
socklen_t fromLen;
|
||||
long long startTime;
|
||||
|
||||
// make the dgram
|
||||
@ -17199,6 +17201,16 @@ int copyFiles ( char *dstDir ) {
|
||||
SafeBuf fileListBuf;
|
||||
g_process.getFilesToCopy ( srcDir , &fileListBuf );
|
||||
|
||||
// include data files so when building a debian/redhat
|
||||
// package 'make install' we copy those as well.
|
||||
// no let's just build it the first time gb runs, but gb should
|
||||
// bind to port 8000 before building and just return a msg
|
||||
// that says "pls wait while building data files for the first time"
|
||||
//File f;
|
||||
//f.set ( srcDir ,"wikititles2.dat");
|
||||
//if ( f.doesExist() )
|
||||
// fileListBuf.safePrintf(" %s",f.getFilename());
|
||||
|
||||
SafeBuf tmp;
|
||||
tmp.safePrintf(
|
||||
"cp -r %s %s"
|
||||
|
29
test.cpp
29
test.cpp
@ -1,29 +0,0 @@
|
||||
// Matt Wells, copyright Jan 2002
|
||||
|
||||
// program to test Rdb
|
||||
|
||||
#include "gb-include.h"
|
||||
|
||||
long x,y,z;
|
||||
|
||||
#define x y
|
||||
|
||||
#undef x
|
||||
#define y z
|
||||
#define x y
|
||||
|
||||
int main ( int argc , char *argv[] ) {
|
||||
|
||||
x = 13;
|
||||
|
||||
printf("z=%li\n",z);
|
||||
|
||||
long shift = 2;
|
||||
unsigned long long h = 1 >> shift;
|
||||
printf("h=%llu\n",h);
|
||||
|
||||
shift = 32;
|
||||
unsigned long x = 1 >> shift;
|
||||
printf("x=%llu\n",x);
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user