Changeset 19 for trunk/src/sh_unix.c
- Timestamp:
- Feb 12, 2006, 10:49:56 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/sh_unix.c
r18 r19 573 573 if (mysignal == SIGUSR2) 574 574 { 575 sig_suspend_switch = 1;575 ++sig_suspend_switch; 576 576 ++sig_urgent; 577 577 } … … 1582 1582 if (skey->mlock_failed == SL_FALSE) 1583 1583 { 1584 if ( (-1) == sh_unix_mlock( (char *) skey, sizeof (sh_key_t)) ) 1584 if ( (-1) == sh_unix_mlock( FIL__, __LINE__, 1585 (char *) skey, sizeof (sh_key_t)) ) 1585 1586 { 1586 1587 skey->mlock_failed = SL_TRUE; … … 2754 2755 #include "sh_ignore.h" 2755 2756 2757 int sh_unix_checksum_size (char * filename, struct stat * fbuf, 2758 char * fileHash, int alert_timeout) 2759 { 2760 file_type tmpFile; 2761 int status; 2762 2763 SL_ENTER(_("sh_unix_checksum_size")); 2764 2765 /* lookup file in database */ 2766 status = sh_hash_get_it (filename, &tmpFile); 2767 if (status != 0) { 2768 goto out; 2769 } 2770 2771 /* if last < current get checksum */ 2772 if (tmpFile.size < fbuf->st_size) 2773 { 2774 strcpy(fileHash, /* known to fit */ 2775 sh_tiger_generic_hash (filename, TIGER_FD, tmpFile.size, 2776 alert_timeout)); 2777 2778 /* return */ 2779 SL_RETURN( 0, _("sh_unix_checksum_size")); 2780 } 2781 2782 out: 2783 strcpy(fileHash, /* known to fit */ 2784 _("000000000000000000000000000000000000000000000000")); 2785 SL_RETURN( -1, _("sh_unix_checksum_size")); 2786 } 2787 2756 2788 int sh_unix_getinfo (int level, char * filename, file_type * theFile, 2757 2789 char * fileHash, int policy) … … 2891 2923 _("000000000000000000000000000000000000000000000000")); 2892 2924 } 2893 else if ( policy == SH_LEVEL_PRELINK&&2925 else if ((theFile->check_mask & MODI_PREL) != 0 && 2894 2926 S_TRUE == sh_prelink_iself(rval_open, fbuf.st_size, 2895 2927 alert_timeout)) … … 2906 2938 sh_tiger_generic_hash (theFile->fullpath, TIGER_FD, 0, 2907 2939 alert_timeout)); 2940 if ((theFile->check_mask & MODI_SGROW) != 0) 2941 { 2942 sl_rewind(rval_open); 2943 tiger_fd = rval_open; 2944 sh_unix_checksum_size (theFile->fullpath, &fbuf, 2945 &fileHash[KEY_LEN + 1], 2946 alert_timeout); 2947 } 2908 2948 } 2909 2949 } … … 2939 2979 alert_timeout), 2940 2980 KEY_LEN + 1); 2981 if ((theFile->check_mask & MODI_SGROW) != 0) 2982 { 2983 sl_rewind(rval_open); 2984 tiger_fd = rval_open; 2985 sh_unix_checksum_size (theFile->fullpath, &fbuf, 2986 &fileHash[KEY_LEN + 1], 2987 alert_timeout); 2988 } 2941 2989 } 2942 2990 } … … 3648 3696 unsigned long page_start; 3649 3697 int page_refcount; 3698 char file[64]; 3699 int line; 3650 3700 struct sh_page_lt * next; 3651 3701 } sh_page_l; … … 3691 3741 3692 3742 #if defined(HAVE_MLOCK) && !defined(HAVE_BROKEN_MLOCK) 3693 int sh_unix_mlock ( void * in_addr, size_t len)3743 int sh_unix_mlock (char * file, int line, void * in_addr, size_t len) 3694 3744 { 3695 3745 int num_pages; … … 3755 3805 page_list->page_start = addr; 3756 3806 page_list->page_refcount = 1; 3807 sl_strlcpy(page_list->file, file, 64); 3808 page_list->line = line; 3757 3809 status = mlock( (void *) addr, pagesize); 3758 3810 if (status != 0) … … 3929 3981 while (page_list != NULL) 3930 3982 { 3983 #ifdef WITH_TPT 3984 sl_snprintf(str, 128, _("file: %s line: %d page: %d"), 3985 page_list->file, page_list->line, i+1); 3986 sh_error_handle(SH_ERR_INFO, FIL__, __LINE__, i, MSG_E_SUBGEN, 3987 str, _("sh_unix_count_mlock")); 3988 #endif 3931 3989 page_list = page_list->next; 3932 3990 ++i; 3933 3991 } 3934 s printf(str, _("%d pages locked"), i); /* known to fit */3992 sl_snprintf(str, 128, _("%d pages locked"), i); 3935 3993 sh_error_handle(SH_ERR_INFO, FIL__, __LINE__, i, MSG_E_SUBGEN, 3936 3994 str, _("sh_unix_count_mlock"));
Note:
See TracChangeset
for help on using the changeset viewer.