h->
env? (
const char*) h + h->
env: 0;
116&& v->
local&& v->
local!= (
unsigned int)(-1)) {
125 unsigned intlocalhost;
146 const char* arg,
size_targlen,
147 const char*
val,
size_tvallen,
148 const char**
a,
char** v)
153 const char* c =
env;
163 const char* p = strchr(c ==
env? c : ++c,
'=');
167c = strchr(q,
'\n');
168 if((
size_t)(p - q) != arglen ||
strncasecmp(q, arg, arglen) != 0)
172 if(memchr(p + 1,
'!', (c ? (
size_t)(c - p) : strlen(p)) - 1))
174 for(q = p+1
+ strspn(p+1,
" \t!"); ; q = p + strspn(p,
" \t!")) {
177 if(*q !=
'\0'&& *q !=
'\n')
178 len= strcspn(q,
" \t!\n");
183 if(
len&& *q ==
'~') {
188 if(
len== 1 && *q ==
'*') {
191}
else if(
len== 1 && *q ==
'-') {
204 if(vlen == 2 && q[0] ==
'"'&& q[1] ==
'"')
282 return(
int) copysign(1.0,
296 return n<
data->n_cand ? &
data->cand[
n].cand : 0;
327 #if defined(_DEBUG) && !defined(NDEBUG) 328 static const unsigned charkZero[
sizeof(v->
cksum)] = { 0 };
329 const char* stop = (
const char*) &v->
cksum;
330 size_t len= (
size_t)(stop - base);
331 unsigned int(*update)(
unsigned intsum,
const void* ptr,
size_t len);
343cksum = (*update)(cksum, base,
len);
344cksum = (*update)(cksum, kZero,
sizeof(kZero));
346cksum = (*update)(cksum, stop +
sizeof(kZero),
len);
347 returnv->
cksum== cksum ? 1
: 0
;
410 unsigned int count, cksum;
423(
"Cached LBSM heap[%p, %p, %d] expired",
g_LBSM_Heap,
432(
"Cached LBSM heap[%p, %p, %d] valid",
g_LBSM_Heap,
445(
"Bad serial (%d) from LBSM heap attach", serial));
454 if(v && (
void*) v == base) {
456(
"LBSM heap[%d] version mismatch" 457 " (current=%hu.%hu, expected=%u.%u+)",
462(
"LBSM heap[%d] version information %s",
463serial, v ?
"misplaced":
"missing"));
468 intagain = !retry && serial > 1? 1
: 0
;
470(
"LBSM heap[%d] out-of-date" 471 " (current=%lu, expiry=%lu, age=%lu, #%u)%s", serial,
472(
unsigned long) now, (
unsigned long) v->
entry.
good,
473(
unsigned long) now -(
unsigned long) v->
entry.
good,
474v->
count, again ?
", re-trying":
""));
484(
"Cached LBSM heap[%p, %p, %d] dropped",
g_LBSM_Heap,
498(
"Cached LBSM heap[%p, %p, %d] used",
g_LBSM_Heap,
506(
"Cached LBSM heap[%p, %p, %d] stale",
g_LBSM_Heap,
515(
"Unable to copy LBSM heap[%d]", serial));
526(
"Cached LBSM heap[%p, %p, %d] renewed",
535(
"LBSM heap[%p, %p, %d]%s checksum failure%s",
537retry == eAgain ?
" persistent":
"",
538retry ?
"":
", re-trying"));
575strcpy(
buf,
"(unknown)");
577(
"Dynamic %s server `%s' on [%s] w/%s host entry",
579(
const char*) svc + svc->
name,
580 buf, host ?
"outdated":
"o"));
608 const char*
env, *
a;
620(
"LBSM heap[%p, %p, %d] for \"%s\" detected",
630memset(idx, 0,
sizeof(idx));
633 n= n_cand = a_cand = 0;
638name = *iter->
name? iter->
name: 0;
671 if(dns_info_time < svc->
info.time)
676 if(dns_info_time < svc->
info.time)
689 for(
n= 0;
n< iter->
n_skip; ++
n) {
732 if(iter->
pref< 0.0 && iter->
host 737}
else if(iter->
arglen) {
749 if(best_match >
match)
765}
else if(standby < 0)
767}
else if(standby) {
770memset(idx, 0,
sizeof(idx));
771 for(
i= 0;
i< n_cand; ++
i) {
776}
else for(
i= 0;
i< n_cand; ++
i)
781 if(n < iter->n_skip)
821v ? (*v ? v :
"\"\"") :
"",
822standby > 0 ?
", standby":
""));
828 if(n_cand == a_cand) {
833? realloc(
cand,
n*
sizeof(*temp))
834:
malloc(
n*
sizeof(*temp)));
842 assert((
size_t)
match<
sizeof(idx)/
sizeof(idx[0]));
846 for(
i=
match;
i<
sizeof(idx)/
sizeof(idx[0]); ++
i)
863 assert(!best_match || !idx[best_match - 1]);
864 for(
n= idx[best_match];
n< n_cand; ++
n) {
868n_cand = idx[best_match];
885 n= (size_t) rand() %
n;
900 if(dns_info_time < svc->
info.time)
916: copysign(svc->
info.
rate, -1.0);
920 if(!svc && !dns_info_time)
937(
const char*) svc + svc->
name:
"");
943 if((host =
cand[
n].host) != 0) {
945 HINFO_Create(host->addr, &host->sys,
sizeof(host->sys),
971(
"LBSM heap[%p, %p, %d] for \"%s\" released",
heap,
982(
"LBSM heap[%p, %p, %d] for \"%s\" retained",
heap,
999rate, fine,
last->host,
last->port, 0);
1008(
"LBSM heap[%p, %p, %d] for \"%s\" discarded",
1025 static void s_Fini(
void);
1038(
"Cached LBSM heap[%p, %p, %d] destroyed",
g_LBSM_Heap,
1074 intno_dispd_follows)
1085 if(!no_dispd_follows)
1088 if(iter->
data== iter)
1090 if(!no_dispd_follows && !
tmp) {
1130(
"LBSM heap[%p, %p, %d] released",
1150 size_tnamelen = name && *name ? strlen(name) : 0;
1164 for(e =
env; *e; e =
env) {
1167 if(!(
env= strchr(e,
'\n'))) {
1171 len= (size_t)(
env++ - e);
1172 if(!(p = (
const char*) memchr(e,
'=',
len)))
1174 len= (size_t)(p - e);
1175 if(
len!= namelen)
1179 len= (size_t)(
env- ++p);
1185(
"LBSM heap[%p, %p, %d] released",
1200(
const SLBSM_Sysinfo*)((
const char*) hinfo +
sizeof(*hinfo));
1202 #if defined(_DEBUG) && !defined(NDEBUG) && defined(NETDAEMONS_VERSION_INT) 1204 static ints_Warn = 0;
1208strcpy(
addr,
"(unknown)");
1210(
"HINFO may be incorrect for obsolete LBSMD at %s" 1211 " (detected=%hu.%hu.%hu, expected=%s+)",
addr,
1226 return si->data.nrproc & 0xFF;
1233 return si->data.nrproc >> 8;
1241 return si->data.hzfreq / 0.128;
1248 return(
int)
si->load.nrtask;
1256 doublepgsizemb =
si->data.pgsize / 1024.0;
1257memusage[0] =
si->load.ram_total * pgsizemb;
1258memusage[1] =
si->load.ram_cache * pgsizemb;
1259memusage[2] =
si->load.ram_free * pgsizemb;
1260memusage[3] =
si->load.swap_total * pgsizemb;
1261memusage[4] =
si->load.swap_free * pgsizemb;
1272 unsigned shortmajor = (
unsignedshort)((
si->data.kernel >> 24) & 0xFF);
1273 unsigned shortminor = (
unsignedshort)((
si->data.kernel >> 16) & 0xFF);
1275p->
bits=
si->data.machine >> 14;
1276p->
arch= (
si->data.machine >> 8) & 0x3F;
1277p->
ostype=
si->data.machine & 0xFF;
1278p->
pgsize= (size_t)
si->data.pgsize << 10;
1286p->
svcpack= (
unsignedshort)(((major % div) << 8) |
1297 for(
n= 0;
n<
sizeof(
si->load.port)/
sizeof(
si->load.port[0]); ++
n) {
1298 if(!
si->load.port[
n])
1301ports[
n].
port=
si->load.port[
n];
1302ports[
n].
used=
si->load.used[
n] / 2.0;
1314lavg[0] =
si->load.avg;
1315lavg[1] =
si->load.avgBLAST;
1324status[0] =
si->load.status;
1325status[1] =
si->load.statusBLAST;
1344 intdispd_to_follow)
1471status *= (100. - (fine < 0. ? 0. : fine > 100. ? 100. : fine)) / 100.0;
1472 return fabs(status);
static int heap[2 *(256+1+29)+1]
static const char si[8][64]
static DLIST_TYPE *DLIST_NAME() last(DLIST_LIST_TYPE *list)
static const struct type types[]
struct SHINFO_Params::@85 kernel
Kernel/OS version #, if available.
unsigned short port
Port number, host byte order.
TNCBI_Time bootup
System boot time, time_t-compatible.
TNCBI_Time startup
LBSMD start time, time_t-compatible.
void * HEAP_Base(const HEAP heap)
HEAP HEAP_Copy(const HEAP orig, size_t extra, int serial)
SSERV_Info * SERV_CreateDnsInfo(unsigned int host)
unsigned int HEAP_Destroy(HEAP heap)
TNcbiCapacity bits
Platform bitness, 32/64/32+64/0=unknown.
unsigned short svcpack
Kernel service pack (Hi=major, Lo=minor)
int HEAP_Serial(const HEAP heap)
SSERV_FirewallInfo firewall
struct SHINFO_Params::@86 daemon
LBSMD daemon version.
double used
Port usage as percentage, [0..100].
TNcbiOSType ostype
OS type ID, see enum, 0=unknown.
const char * SERV_TypeStr(ESERV_Type type)
unsigned int HEAP_AddRef(HEAP heap)
char * SERV_WriteInfo(const SSERV_Info *info)
unsigned short TSERV_TypeOnly
Server type only, w/o specials.
unsigned int HEAP_Detach(HEAP heap)
TNcbiArch arch
Architecture ID, see enum, 0=unknown.
TNCBI_Size HEAP_Size(const HEAP heap)
#define SERV_LOCALHOST
Special values for the "preferred_host" parameter.
int SERV_EqualInfo(const SSERV_Info *info1, const SSERV_Info *info2)
size_t pgsize
Hardware page size in bytes, if known.
@ fSERV_Stateless
Stateless servers only.
int SOCK_ntoa(unsigned int addr, char *buf, size_t bufsize)
Convert IP address to a string in dotted notation.
unsigned int SOCK_GetLocalHostAddress(ESwitch reget)
Same as SOCK_GetLocalHostAddress6() only strictly for IPv4.
unsigned int UTIL_Adler32_Update(unsigned int checksum, const void *ptr, size_t len)
Calculate/Update Adler-32 checksum NB: Initial checksum is "1".
enum ENcbiSwitch ESwitch
Aux.
#define NCBI_TIME_INFINITE
unsigned int UTIL_CRC32_Update(unsigned int checksum, const void *ptr, size_t len)
Calculate/Update CRC-32 checksum NB: Initial checksum is "0".
unsigned int
A callback function used to compare two keys in a database.
#define LBSM_DEFAULT_RATE
#define LBSM_STANDBY_THRESHOLD
HOST_INFO HINFO_Create(unsigned int addr, const void *hinfo, size_t hinfo_size, const char *env, const char *arg, const char *val)
size_t LB_Select(SERV_ITER iter, void *data, FGetCandidate get_candidate, double bonus)
const SLBSM_Host * LBSM_LookupHost(HEAP heap, unsigned int addr, const SLBSM_Entry *hint)
int LBSM_SubmitPenaltyOrRerate(const char *name, ESERV_Type type, double rate, TNCBI_Time fine, unsigned int host, unsigned short port, const char *path)
const char * LBSM_GetConfig(HEAP heap)
const SLBSM_Version * LBSM_GetVersion(HEAP heap)
const SLBSM_Service * LBSM_LookupService(HEAP heap, const char *name, int mask, const SLBSM_Service *hint)
#define LBSM_HEAP_VERSION_MIN_CRC32
#define LBSM_KERNELID_SVPKBIT
#define LBSM_HEAP_VERSION_MAJ_CRC32
#define LBSM_HEAP_VERSION_MAJ
#define LBSM_HEAP_VERSION_MIN
#define LBSM_KERNELID_SVPKDIV
pid_t LBSM_UnLBSMD(int undaemon)
int LBSM_LBSMD(int check_n_lock)
void LBSM_Shmem_Detach(HEAP heap)
HEAP LBSM_Shmem_Attach(int fallback)
static HEAP s_GetHeapCopy(TNCBI_Time now)
static int s_VerifyChecksum(const HEAP heap, unsigned int count, unsigned int cksum)
static const SSERV_VTable kLbsmdOp
static SLB_Candidate * s_GetCandidate(void *user_data, size_t n)
static int s_SortStandbys(const void *p1, const void *p2)
static const SLBSM_Sysinfo * s_GetSysinfo(const HOST_INFO hinfo, int warn)
static const char * s_HostEnv(const SLBSM_Host *h)
static SSERV_Info * s_FakeDnsReturn(SERV_ITER iter, HOST_INFO *host_info, int sign, TNCBI_Time time)
static void s_Close(SERV_ITER)
static int s_IfDaemon(void)
static unsigned int s_GetLocalHostAddress(HEAP heap)
static int s_Feedback(SERV_ITER, double, TNCBI_Time)
int LBSM_HINFO_Status(const HOST_INFO hinfo, double status[2])
double LBSM_HINFO_CpuClock(const HOST_INFO hinfo)
int LBSM_HINFO_PortUsage(const HOST_INFO hinfo, SHINFO_PortUsage ports[], size_t count)
const char * LBSMD_GetConfig(void)
int LBSM_HINFO_Memusage(const HOST_INFO hinfo, double memusage[5])
static EHOST_Match s_Match(const char *env, const char *arg, size_t arglen, const char *val, size_t vallen, const char **a, char **v)
HEAP LBSMD_GetHeapCopy(TNCBI_Time now)
double LBSM_CalculateStatus(double rate, double fine, ESERV_Algo algo, const SLBSM_HostLoad *load)
unsigned int LBSMD_GetLocalHostAddress(const void *p)
int LBSM_HINFO_TaskCount(const HOST_INFO hinfo)
int LBSM_HINFO_LoadAverage(const HOST_INFO hinfo, double lavg[2])
volatile HEAP g_LBSM_Heap
const char * LBSMD_GetHostParameter(unsigned int addr, const char *name)
static unsigned int s_Localhost(const SLBSM_Version *v)
ESwitch LBSMD_FastHeapAccess(ESwitch OnOff)
static const SLBSM_Host * s_LookupHost(HEAP heap, const SERV_ITER iter, const SLBSM_Service *svc)
static SSERV_Info * s_GetNextInfo(SERV_ITER, HOST_INFO *)
int LBSM_HINFO_CpuCount(const HOST_INFO hinfo)
static ESwitch s_LBSM_FastHeapAccess
int LBSM_HINFO_CpuUnits(const HOST_INFO hinfo)
#define LBSMD_LOCAL_BONUS
const SSERV_VTable * SERV_LBSMD_Open(SERV_ITER iter, SSERV_Info **info, HOST_INFO *host_info, int no_dispd_follows)
int LBSM_HINFO_MachineParams(const HOST_INFO hinfo, SHINFO_Params *p)
unsigned int g_NCBI_ConnectRandomSeed
#define CORE_LOGF_X(subcode, level, fmt_args)
#define CORE_LOGF_ERRNO_X(subcode, level, error, fmt_args)
#define NCBI_CONNECT_SRAND_ADDEND
#define CORE_LOGF(level, fmt_args)
SSERV_Info * SERV_CopyInfoEx(const SSERV_Info *orig, const char *name)
const char * SERV_NameOfInfo(const SSERV_Info *info)
const char * SERV_CurrentName(SERV_ITER iter)
#define NETDAEMONS_VERSION_INT
#define NETDAEMONS_MAJOR_OF(ver)
#define NETDAEMONS_MINOR_OF(ver)
#define NETDAEMONS_PATCH_OF(ver)
#define NETDAEMONS_VERSION_STR
static int match(PCRE2_SPTR start_eptr, PCRE2_SPTR start_ecode, uint16_t top_bracket, PCRE2_SIZE frame_size, pcre2_match_data *match_data, match_block *mb)
const SLBSM_Service * svc
struct SLBSM_Candidate * cand
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4