summaryrefslogtreecommitdiffstats
path: root/kernel/trace
AgeCommit message (Expand)Author
2008-07-18cpumask: Replace cpumask_of_cpu with cpumask_of_cpu_ptrMike Travis
2008-07-14Merge branch 'tracing/ftrace' into auto-ftrace-nextIngo Molnar
2008-07-11ftrace: build fix for ftraced_suspendIngo Molnar
2008-07-11ftrace: separate out the function enabled variableSteven Rostedt
2008-07-11ftrace: add ftrace_kill_atomicSteven Rostedt
2008-07-11ftrace: use current CPU for function startupSteven Rostedt
2008-07-11ftrace: start wakeup tracing after setting function tracerSteven Rostedt
2008-07-11ftrace: check proper config for preempt typeSteven Rostedt
2008-07-11ftrace: define function trace nopSteven Rostedt
2008-07-11ftrace: move sched_switch enable after markersSteven Rostedt
2008-07-10Merge branch 'tracing/sysprof' into auto-ftrace-nextIngo Molnar
2008-07-10Merge branch 'tracing/mmiotrace' into auto-ftrace-nextIngo Molnar
2008-07-03ftrace: prevent ftrace modifications while being kprobe'd, v2Abhishek Sagar
2008-06-23ftrace: avoid modifying kprobe'd recordsAbhishek Sagar
2008-06-23ftrace: freeze kprobe'd recordsAbhishek Sagar
2008-06-23ftrace: store mcount address in rec->ipAbhishek Sagar
2008-06-16namespacecheck: fixesIngo Molnar
2008-06-14ftrace: fix "notrace" filtering priorityAbhishek Sagar
2008-06-12ftrace: fix printoutJiri Slaby
2008-06-10ftrace: disable tracing when current_tracer is set to "none"Ankita Garg
2008-06-10ftrace: prevent freeing of all failed updatesAbhishek Sagar
2008-06-10ftrace: add debugfs entry 'failures'Abhishek Sagar
2008-06-10ftrace: remove ftrace_ip_converted()Abhishek Sagar
2008-06-10ftrace: prevent freeing of all failed updatesAbhishek Sagar
2008-06-02ftrace: user update and disable dynamic ftrace daemonSteven Rostedt
2008-06-02ftrace: distinguish kretprobe'd functions in trace logsAbhishek Sagar
2008-05-26ftrace: fix updating of ftrace_update_cntAbhishek Sagar
2008-05-26ftrace: safe traversal of ftrace_hash hlistAbhishek Sagar
2008-05-26ftrace: fix up cmdline recordingSteven Rostedt
2008-05-26ftrace: set_ftrace_notrace featureSteven Rostedt
2008-05-26ftrace: remove printks from irqsoff traceSteven Rostedt
2008-05-26ftrace: add function tracing to wake up tracingSteven Rostedt
2008-05-26ftrace: move ftrace_special to trace.cSteven Rostedt
2008-05-26ftrace: limit use of check pagesSteven Rostedt
2008-05-24sysprof: make it depend on X86Thomas Gleixner
2008-05-24x86 mmiotrace: use resource_size_t for phys addressesPekka Paalanen
2008-05-24mmiotrace: do not print bogus pid for maps eitherPekka Paalanen
2008-05-24mmiotrace: print overrun countsPekka Paalanen
2008-05-24mmiotrace: print header using the read hook.Pekka Paalanen
2008-05-24x86 mmiotrace: Do not print bogus pidPekka Paalanen
2008-05-24mmiotrace: ftrace fixIngo Molnar
2008-05-24ftrace: mmiotrace update, #2Pekka Paalanen
2008-05-24ftrace: mmiotrace, updatesPekka Paalanen
2008-05-24ftrace: add mmiotrace pluginPekka Paalanen
2008-05-23ftrace/sysprof: don't trace the user stack if we are a kernel thread.Soeren Sandmann
2008-05-23sysprof: update copyrightsIngo Molnar
2008-05-23sysprof: kernel traceSoeren Sandmann Pedersen
2008-05-23ftrace: make it more available in the KconfigThomas Gleixner
2008-05-23ftrace: fix __trace_special()Thomas Gleixner
2008-05-23ftrace: remove notraceThomas Gleixner
href='#n300'>300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <openssl/objects.h>
#include <openssl/comp.h>
#include <openssl/err.h>

COMP_METHOD *COMP_zlib(void );

static COMP_METHOD zlib_method_nozlib={
	NID_undef,
	"(undef)",
	NULL,
	NULL,
	NULL,
	NULL,
	NULL,
	NULL,
	};

#ifndef ZLIB
#undef ZLIB_SHARED
#else

#include <zlib.h>

static int zlib_stateful_init(COMP_CTX *ctx);
static void zlib_stateful_finish(COMP_CTX *ctx);
static int zlib_stateful_compress_block(COMP_CTX *ctx, unsigned char *out,
	unsigned int olen, unsigned char *in, unsigned int ilen);
static int zlib_stateful_expand_block(COMP_CTX *ctx, unsigned char *out,
	unsigned int olen, unsigned char *in, unsigned int ilen);


/* memory allocations functions for zlib intialization */
static void* zlib_zalloc(void* opaque, unsigned int no, unsigned int size)
{
	void *p;
	
	p=OPENSSL_malloc(no*size);
	if (p)
		memset(p, 0, no*size);
	return p;
}


static void zlib_zfree(void* opaque, void* address)
{
	OPENSSL_free(address);
}

#if 0
static int zlib_compress_block(COMP_CTX *ctx, unsigned char *out,
	unsigned int olen, unsigned char *in, unsigned int ilen);
static int zlib_expand_block(COMP_CTX *ctx, unsigned char *out,
	unsigned int olen, unsigned char *in, unsigned int ilen);

static int zz_uncompress(Bytef *dest, uLongf *destLen, const Bytef *source,
	uLong sourceLen);

static COMP_METHOD zlib_stateless_method={
	NID_zlib_compression,
	LN_zlib_compression,
	NULL,
	NULL,
	zlib_compress_block,
	zlib_expand_block,
	NULL,
	NULL,
	};
#endif

static COMP_METHOD zlib_stateful_method={
	NID_zlib_compression,
	LN_zlib_compression,
	zlib_stateful_init,
	zlib_stateful_finish,
	zlib_stateful_compress_block,
	zlib_stateful_expand_block,
	NULL,
	NULL,
	};

/* 
 * When OpenSSL is built on Windows, we do not want to require that
 * the ZLIB.DLL be available in order for the OpenSSL DLLs to
 * work.  Therefore, all ZLIB routines are loaded at run time
 * and we do not link to a .LIB file when ZLIB_SHARED is set.
 */
#if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_WIN32)
# include <windows.h>
#endif /* !(OPENSSL_SYS_WINDOWS || OPENSSL_SYS_WIN32) */

#ifdef ZLIB_SHARED
#include <openssl/dso.h>

/* Function pointers */
typedef int (*compress_ft)(Bytef *dest,uLongf *destLen,
	const Bytef *source, uLong sourceLen);
typedef int (*inflateEnd_ft)(z_streamp strm);
typedef int (*inflate_ft)(z_streamp strm, int flush);
typedef int (*inflateInit__ft)(z_streamp strm,
	const char * version, int stream_size);
typedef int (*deflateEnd_ft)(z_streamp strm);
typedef int (*deflate_ft)(z_streamp strm, int flush);
typedef int (*deflateInit__ft)(z_streamp strm, int level,
	const char * version, int stream_size);
typedef const char * (*zError__ft)(int err);
static compress_ft	p_compress=NULL;
static inflateEnd_ft	p_inflateEnd=NULL;
static inflate_ft	p_inflate=NULL;
static inflateInit__ft	p_inflateInit_=NULL;
static deflateEnd_ft	p_deflateEnd=NULL;
static deflate_ft	p_deflate=NULL;
static deflateInit__ft	p_deflateInit_=NULL;
static zError__ft	p_zError=NULL;

static int zlib_loaded = 0;     /* only attempt to init func pts once */
static DSO *zlib_dso = NULL;

#define compress                p_compress
#define inflateEnd              p_inflateEnd
#define inflate                 p_inflate
#define inflateInit_            p_inflateInit_
#define deflateEnd              p_deflateEnd
#define deflate                 p_deflate
#define deflateInit_            p_deflateInit_
#define zError			p_zError
#endif /* ZLIB_SHARED */

struct zlib_state
	{
	z_stream istream;
	z_stream ostream;
	};

static int zlib_stateful_ex_idx = -1;

static void zlib_stateful_free_ex_data(void *obj, void *item,
	CRYPTO_EX_DATA *ad, int ind,long argl, void *argp)
	{
	struct zlib_state *state = (struct zlib_state *)item;
	inflateEnd(&state->istream);
	deflateEnd(&state->ostream);
	OPENSSL_free(state);
	}

static int zlib_stateful_init(COMP_CTX *ctx)
	{
	int err;
	struct zlib_state *state =
		(struct zlib_state *)OPENSSL_malloc(sizeof(struct zlib_state));

	if (state == NULL)
		goto err;

	state->istream.zalloc = zlib_zalloc;
	state->istream.zfree = zlib_zfree;
	state->istream.opaque = Z_NULL;
	state->istream.next_in = Z_NULL;
	state->istream.next_out = Z_NULL;
	state->istream.avail_in = 0;
	state->istream.avail_out = 0;
	err = inflateInit_(&state->istream,
		ZLIB_VERSION, sizeof(z_stream));
	if (err != Z_OK)
		goto err;

	state->ostream.zalloc = zlib_zalloc;
	state->ostream.zfree = zlib_zfree;
	state->ostream.opaque = Z_NULL;
	state->ostream.next_in = Z_NULL;
	state->ostream.next_out = Z_NULL;
	state->ostream.avail_in = 0;
	state->ostream.avail_out = 0;
	err = deflateInit_(&state->ostream,Z_DEFAULT_COMPRESSION,
		ZLIB_VERSION, sizeof(z_stream));
	if (err != Z_OK)
		goto err;

	CRYPTO_new_ex_data(CRYPTO_EX_INDEX_COMP,