ctfmerge.c (178529) | ctfmerge.c (178546) |
---|---|
1/* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE --- 162 unchanged lines hidden (view full) --- 171 * this comment will not live to see the stock hit five. 172 */ 173 174#include <stdio.h> 175#include <stdlib.h> 176#include <unistd.h> 177#include <pthread.h> 178#include <assert.h> | 1/* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE --- 162 unchanged lines hidden (view full) --- 171 * this comment will not live to see the stock hit five. 172 */ 173 174#include <stdio.h> 175#include <stdlib.h> 176#include <unistd.h> 177#include <pthread.h> 178#include <assert.h> |
179#if defined(sun) |
|
179#include <synch.h> | 180#include <synch.h> |
181#endif |
|
180#include <signal.h> 181#include <libgen.h> 182#include <string.h> 183#include <errno.h> | 182#include <signal.h> 183#include <libgen.h> 184#include <string.h> 185#include <errno.h> |
186#if defined(sun) |
|
184#include <alloca.h> | 187#include <alloca.h> |
188#endif |
|
185#include <sys/param.h> 186#include <sys/types.h> 187#include <sys/mman.h> | 189#include <sys/param.h> 190#include <sys/types.h> 191#include <sys/mman.h> |
192#if defined(sun) |
|
188#include <sys/sysconf.h> | 193#include <sys/sysconf.h> |
194#endif |
|
189 190#include "ctf_headers.h" 191#include "ctftools.h" 192#include "ctfmerge.h" 193#include "traverse.h" 194#include "memory.h" 195#include "fifo.h" 196#include "barrier.h" --- 24 unchanged lines hidden (view full) --- 221 " %s [-g] -c srcfile destfile\n" 222 "\n" 223 " Note: if -L labelenv is specified and labelenv is not set in\n" 224 " the environment, a default value is used.\n", 225 progname, progname, strlen(progname), " ", 226 progname, progname); 227} 228 | 195 196#include "ctf_headers.h" 197#include "ctftools.h" 198#include "ctfmerge.h" 199#include "traverse.h" 200#include "memory.h" 201#include "fifo.h" 202#include "barrier.h" --- 24 unchanged lines hidden (view full) --- 227 " %s [-g] -c srcfile destfile\n" 228 "\n" 229 " Note: if -L labelenv is specified and labelenv is not set in\n" 230 " the environment, a default value is used.\n", 231 progname, progname, strlen(progname), " ", 232 progname, progname); 233} 234 |
235#if defined(sun) |
|
229static void 230bigheap(void) 231{ 232 size_t big, *size; 233 int sizes; 234 struct memcntl_mha mha; 235 236 /* --- 31 unchanged lines hidden (view full) --- 268 * set the preferred page size for the heap 269 */ 270 mha.mha_cmd = MHA_MAPSIZE_BSSBRK; 271 mha.mha_flags = 0; 272 mha.mha_pagesize = big; 273 274 (void) memcntl(NULL, 0, MC_HAT_ADVISE, (caddr_t)&mha, 0, 0); 275} | 236static void 237bigheap(void) 238{ 239 size_t big, *size; 240 int sizes; 241 struct memcntl_mha mha; 242 243 /* --- 31 unchanged lines hidden (view full) --- 275 * set the preferred page size for the heap 276 */ 277 mha.mha_cmd = MHA_MAPSIZE_BSSBRK; 278 mha.mha_flags = 0; 279 mha.mha_pagesize = big; 280 281 (void) memcntl(NULL, 0, MC_HAT_ADVISE, (caddr_t)&mha, 0, 0); 282} |
283#endif |
|
276 277static void 278finalize_phase_one(workqueue_t *wq) 279{ 280 int startslot, i; 281 282 /* 283 * wip slots are cleared out only when maxbatchsz td's have been merged --- 306 unchanged lines hidden (view full) --- 590 int dounlink = getenv("CTFMERGE_TERMINATE_NO_UNLINK") ? 0 : 1; 591 592 if (tmpname != NULL && dounlink) 593 unlink(tmpname); 594 595 if (outfile == NULL) 596 return; 597 | 284 285static void 286finalize_phase_one(workqueue_t *wq) 287{ 288 int startslot, i; 289 290 /* 291 * wip slots are cleared out only when maxbatchsz td's have been merged --- 306 unchanged lines hidden (view full) --- 598 int dounlink = getenv("CTFMERGE_TERMINATE_NO_UNLINK") ? 0 : 1; 599 600 if (tmpname != NULL && dounlink) 601 unlink(tmpname); 602 603 if (outfile == NULL) 604 return; 605 |
606#if !defined(__FreeBSD__) |
|
598 if (dounlink) { 599 fprintf(stderr, "Removing %s\n", outfile); 600 unlink(outfile); 601 } | 607 if (dounlink) { 608 fprintf(stderr, "Removing %s\n", outfile); 609 unlink(outfile); 610 } |
611#endif |
|
602} 603 604static void 605copy_ctf_data(char *srcfile, char *destfile, int keep_stabs) 606{ 607 tdata_t *srctd; 608 609 if (read_ctf(&srcfile, 1, NULL, read_ctf_save_cb, &srctd, 1) == 0) --- 82 unchanged lines hidden (view full) --- 692 sigaddset(&sets, SIGTERM); 693 pthread_sigmask(SIG_BLOCK, &sets, NULL); 694 695 for (i = 0; i < wq->wq_nthreads; i++) { 696 pthread_create(&thrid, NULL, (void *(*)(void *))worker_thread, 697 wq); 698 } 699 | 612} 613 614static void 615copy_ctf_data(char *srcfile, char *destfile, int keep_stabs) 616{ 617 tdata_t *srctd; 618 619 if (read_ctf(&srcfile, 1, NULL, read_ctf_save_cb, &srctd, 1) == 0) --- 82 unchanged lines hidden (view full) --- 702 sigaddset(&sets, SIGTERM); 703 pthread_sigmask(SIG_BLOCK, &sets, NULL); 704 705 for (i = 0; i < wq->wq_nthreads; i++) { 706 pthread_create(&thrid, NULL, (void *(*)(void *))worker_thread, 707 wq); 708 } 709 |
710#if defined(sun) |
|
700 sigset(SIGINT, handle_sig); 701 sigset(SIGQUIT, handle_sig); 702 sigset(SIGTERM, handle_sig); | 711 sigset(SIGINT, handle_sig); 712 sigset(SIGQUIT, handle_sig); 713 sigset(SIGTERM, handle_sig); |
714#else 715 signal(SIGINT, handle_sig); 716 signal(SIGQUIT, handle_sig); 717 signal(SIGTERM, handle_sig); 718#endif |
|
703 pthread_sigmask(SIG_UNBLOCK, &sets, NULL); 704} 705 706static int 707strcompare(const void *p1, const void *p2) 708{ 709 char *s1 = *((char **)p1); 710 char *s2 = *((char **)p2); --- 278 unchanged lines hidden --- | 719 pthread_sigmask(SIG_UNBLOCK, &sets, NULL); 720} 721 722static int 723strcompare(const void *p1, const void *p2) 724{ 725 char *s1 = *((char **)p1); 726 char *s2 = *((char **)p2); --- 278 unchanged lines hidden --- |