Changeset ec0f79b5ee03bd254353c5cb634373649f79ebc2
- Timestamp:
- 02/21/11 17:06:05
(2 years ago)
- Author:
- Theo Schlossnagle <jesus@omniti.com>
- git-committer:
- Theo Schlossnagle <jesus@omniti.com> 1298307965 +0000
- git-parent:
[1a778bd1b1b6f321eff6ff69403dd1cd55d8ef1a]
- git-author:
- Theo Schlossnagle <jesus@omniti.com> 1298307965 +0000
- Message:
several warning (now error) fixes on Linux
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r09ecd28 |
rec0f79b |
|
| 44 | 44 | #endif |
|---|
| 45 | 45 | |
|---|
| | 46 | #define pthread_self_ptr() ((void *)pthread_self()) |
|---|
| | 47 | |
|---|
| 46 | 48 | static noit_atomic32_t threads_jobq_inited = 0; |
|---|
| 47 | 49 | static pthread_key_t threads_jobq; |
|---|
| … | … | |
| 235 | 237 | job->timeout_triggered = 1; |
|---|
| 236 | 238 | job->timeout_event = NULL; |
|---|
| 237 | | noitL(eventer_deb, "%p jobq -> timeout job [%p]\n", pthread_self(), job); |
|---|
| | 239 | noitL(eventer_deb, "%p jobq -> timeout job [%p]\n", pthread_self_ptr(), job); |
|---|
| 238 | 240 | if(job->inflight) { |
|---|
| 239 | 241 | eventer_job_t *jobcopy; |
|---|
| … | … | |
| 249 | 251 | /* We need to cleanup... we haven't done it yet. */ |
|---|
| 250 | 252 | noitL(eventer_deb, "[inline] %p jobq[%s] -> cleanup [%p]\n", |
|---|
| 251 | | pthread_self(), job->jobq->queue_name, job); |
|---|
| | 253 | pthread_self_ptr(), job->jobq->queue_name, job); |
|---|
| 252 | 254 | /* This is the real question... asynch cleanup is supposed to |
|---|
| 253 | 255 | * be called asynch -- we're going to call it synchronously |
|---|
| … | … | |
| 334 | 336 | } |
|---|
| 335 | 337 | pthread_setspecific(jobq->activejob, job); |
|---|
| 336 | | noitL(eventer_deb, "%p jobq[%s] -> running job [%p]\n", pthread_self(), jobq->queue_name, job); |
|---|
| | 338 | noitL(eventer_deb, "%p jobq[%s] -> running job [%p]\n", pthread_self_ptr(), |
|---|
| | 339 | jobq->queue_name, job); |
|---|
| 337 | 340 | |
|---|
| 338 | 341 | /* Mark our commencement */ |
|---|
| … | … | |
| 346 | 349 | * to pull the job off the queue. We must be in bad shape here. |
|---|
| 347 | 350 | */ |
|---|
| 348 | | noitL(eventer_deb, "%p jobq[%s] -> timeout before start [%p]\n", pthread_self(), jobq->queue_name, job); |
|---|
| | 351 | noitL(eventer_deb, "%p jobq[%s] -> timeout before start [%p]\n", |
|---|
| | 352 | pthread_self_ptr(), jobq->queue_name, job); |
|---|
| 349 | 353 | gettimeofday(&job->finish_time, NULL); /* We're done */ |
|---|
| 350 | 354 | sub_timeval(job->finish_time, job->fd_event->whence, &diff); |
|---|
| 351 | 355 | sub_timeval(job->finish_time, job->create_time, &diff2); |
|---|
| 352 | 356 | noitL(eventer_deb, "%p jobq[%s] -> timeout before start [%p] -%0.6f (%0.6f)\n", |
|---|
| 353 | | pthread_self(), jobq->queue_name, job, |
|---|
| | 357 | pthread_self_ptr(), jobq->queue_name, job, |
|---|
| 354 | 358 | (float)diff.tv_sec + (float)diff.tv_usec/1000000.0, |
|---|
| 355 | 359 | (float)diff2.tv_sec + (float)diff2.tv_usec/1000000.0); |
|---|
| … | … | |
| 375 | 379 | if(noit_atomic_cas32(&job->inflight, 1, 0) == 0) { |
|---|
| 376 | 380 | if(!job->timeout_triggered) { |
|---|
| 377 | | noitL(eventer_deb, "%p jobq[%s] -> executing [%p]\n", pthread_self(), jobq->queue_name, job); |
|---|
| | 381 | noitL(eventer_deb, "%p jobq[%s] -> executing [%p]\n", |
|---|
| | 382 | pthread_self_ptr(), jobq->queue_name, job); |
|---|
| 378 | 383 | /* Choose the right cancellation policy (or none) */ |
|---|
| 379 | 384 | if(job->fd_event->mask & EVENTER_CANCEL_ASYNCH) { |
|---|
| … | … | |
| 406 | 411 | |
|---|
| 407 | 412 | job->inflight = 0; |
|---|
| 408 | | noitL(eventer_deb, "%p jobq[%s] -> finished [%p]\n", pthread_self(), jobq->queue_name, job); |
|---|
| | 413 | noitL(eventer_deb, "%p jobq[%s] -> finished [%p]\n", pthread_self_ptr(), |
|---|
| | 414 | jobq->queue_name, job); |
|---|
| 409 | 415 | /* No we know we won't have siglongjmp called on us */ |
|---|
| 410 | 416 | |
|---|
| … | … | |
| 418 | 424 | if(noit_atomic_cas32(&job->has_cleanedup, 1, 0) == 0) { |
|---|
| 419 | 425 | /* We need to cleanup... we haven't done it yet. */ |
|---|
| 420 | | noitL(eventer_deb, "%p jobq[%s] -> cleanup [%p]\n", pthread_self(), jobq->queue_name, job); |
|---|
| | 426 | noitL(eventer_deb, "%p jobq[%s] -> cleanup [%p]\n", pthread_self_ptr(), |
|---|
| | 427 | jobq->queue_name, job); |
|---|
| 421 | 428 | if(job->fd_event) |
|---|
| 422 | 429 | job->fd_event->callback(job->fd_event, EVENTER_ASYNCH_CLEANUP, |
|---|
| r61205cb |
rec0f79b |
|
| 118 | 118 | ps = noit_skiplist_find_compare(&active_procs, &pid, &iter, __proc_state_pid); |
|---|
| 119 | 119 | noitL(nldeb, "reaped pid %d (check: %lld) -> %x\n", |
|---|
| 120 | | pid, ps?ps->check_no:-1, status); |
|---|
| | 120 | pid, (long long int)(ps?ps->check_no:-1), status); |
|---|
| 121 | 121 | if(ps) { |
|---|
| 122 | 122 | ps->status = status; |
|---|
| … | … | |
| 186 | 186 | noitL(noit_error, "%d done procs to cleanup\n", done_procs.size); |
|---|
| 187 | 187 | while((ps = noit_skiplist_pop(&done_procs, NULL)) != NULL) { |
|---|
| 188 | | noitL(noit_error, "finished %lld/%d\n", ps->check_no, ps->pid); |
|---|
| | 188 | noitL(noit_error, "finished %lld/%d\n", (long long int)ps->check_no, ps->pid); |
|---|
| 189 | 189 | if(ps->cancelled == 0) { |
|---|
| 190 | 190 | assert_write(out_fd, &ps->check_no, |
|---|
| r629726b |
rec0f79b |
|
| 90 | 90 | gettimeofday(&now, NULL); |
|---|
| 91 | 91 | snprintf(vbuff, sizeof(vbuff), "%llu.%03d", (unsigned long long)now.tv_sec, |
|---|
| 92 | | now.tv_usec / 1000); |
|---|
| | 92 | (int)(now.tv_usec / 1000)); |
|---|
| 93 | 93 | xmlNewTextChild(root, NULL, (xmlChar *)"current_time", (xmlChar *)vbuff); |
|---|
| 94 | 94 | |
|---|
| r8c720f9 |
rec0f79b |
|
| 195 | 195 | "M\t%lu.%03lu\t%s\t%s\t%c\t%lld\n", |
|---|
| 196 | 196 | SECPART(&c->whence), MSECPART(&c->whence), uuid_str, |
|---|
| 197 | | m->metric_name, m->metric_type, *(m->metric_value.l)); |
|---|
| | 197 | m->metric_name, m->metric_type, |
|---|
| | 198 | (long long int)*(m->metric_value.l)); |
|---|
| 198 | 199 | break; |
|---|
| 199 | 200 | case METRIC_UINT64: |
|---|
| … | … | |
| 201 | 202 | "M\t%lu.%03lu\t%s\t%s\t%c\t%llu\n", |
|---|
| 202 | 203 | SECPART(&c->whence), MSECPART(&c->whence), uuid_str, |
|---|
| 203 | | m->metric_name, m->metric_type, *(m->metric_value.L)); |
|---|
| | 204 | m->metric_name, m->metric_type, |
|---|
| | 205 | (long long unsigned int)*(m->metric_value.L)); |
|---|
| 204 | 206 | break; |
|---|
| 205 | 207 | case METRIC_DOUBLE: |
|---|
| … | … | |
| 246 | 248 | rv = snprintf(b, l, "%u", *(m->metric_value.I)); break; |
|---|
| 247 | 249 | case METRIC_INT64: |
|---|
| 248 | | rv = snprintf(b, l, "%lld", *(m->metric_value.l)); break; |
|---|
| | 250 | rv = snprintf(b, l, "%lld", (long long int)*(m->metric_value.l)); break; |
|---|
| 249 | 251 | case METRIC_UINT64: |
|---|
| 250 | | rv = snprintf(b, l, "%llu", *(m->metric_value.L)); break; |
|---|
| | 252 | rv = snprintf(b, l, "%llu", |
|---|
| | 253 | (long long unsigned int)*(m->metric_value.L)); break; |
|---|
| 251 | 254 | case METRIC_DOUBLE: |
|---|
| 252 | 255 | rv = snprintf(b, l, "%.12e", *(m->metric_value.n)); break; |
|---|
| r8c720f9 |
rec0f79b |
|
| 381 | 381 | const char *path, |
|---|
| 382 | 382 | noit_hash_table *table) { |
|---|
| 383 | | int cnt; |
|---|
| | 383 | unsigned int cnt; |
|---|
| 384 | 384 | xmlXPathObjectPtr pobj = NULL; |
|---|
| 385 | 385 | xmlXPathContextPtr current_ctxt; |
|---|
| r4a4fa32 |
rec0f79b |
|
| 610 | 610 | void |
|---|
| 611 | 611 | noit_http_process_querystring(noit_http_request *req) { |
|---|
| 612 | | char *cp, *interest, *brk; |
|---|
| | 612 | char *cp, *interest, *brk = NULL; |
|---|
| 613 | 613 | cp = strchr(req->uri_str, '?'); |
|---|
| 614 | 614 | if(!cp) return; |
|---|
| rbf14ffc |
rec0f79b |
|
| 117 | 117 | &((struct sockaddr_in *)&addr6)->sin_addr, |
|---|
| 118 | 118 | buff, sizeof(buff)); |
|---|
| 119 | | port = ntohs(((struct sockaddr_in *)&addr6)->sin_port); |
|---|
| | 119 | memcpy(&port, &((struct sockaddr_in *)&addr6)->sin_port, sizeof(port)); |
|---|
| | 120 | port = ntohs(port); |
|---|
| 120 | 121 | } |
|---|
| 121 | 122 | else if(addr6.sin6_family == AF_INET6) { |
|---|
| … | … | |
| 980 | 981 | } while(0) |
|---|
| 981 | 982 | #define push_noit_m_u64(name, value) do { \ |
|---|
| 982 | | snprintf(wr, len, "%s\tL\t%llu\n", name, value); \ |
|---|
| | 983 | snprintf(wr, len, "%s\tL\t%llu\n", name, (long long unsigned int)value); \ |
|---|
| 983 | 984 | stratcon_datastore_push(DS_OP_INSERT, \ |
|---|
| 984 | 985 | (struct sockaddr *)&self_stratcon_ip, \ |
|---|
| … | … | |
| 1141 | 1142 | &((struct sockaddr_in *)&addr6)->sin_addr, |
|---|
| 1142 | 1143 | buff, sizeof(buff)); |
|---|
| 1143 | | port = ntohs(((struct sockaddr_in *)&addr6)->sin_port); |
|---|
| | 1144 | memcpy(&port, &((struct sockaddr_in *)&addr6)->sin_port, sizeof(port)); |
|---|
| | 1145 | port = ntohs(port); |
|---|
| 1144 | 1146 | } |
|---|
| 1145 | 1147 | else if(addr6.sin6_family == AF_INET6) { |
|---|