関数 | |
void | gfree_debugsyms (void) |
static char * | debug_list_class_names_and_levels (void) |
const char * | debug_classname_from_index (int ndx) |
static int | debug_lookup_classname_int (const char *classname) |
int | debug_add_class (const char *classname) |
int | debug_lookup_classname (const char *classname) |
static void | debug_dump_status (int level) |
static BOOL | debug_parse_params (char **params) |
BOOL | debug_parse_levels (const char *params_str) |
static void | debug_message (int msg_type, struct process_id src, void *buf, size_t len, void *private_data) |
void | debug_message_send (pid_t pid, const char *params_str) |
static void | debuglevel_message (int msg_type, struct process_id src, void *buf, size_t len, void *private_data) |
void | debug_init (void) |
void | setup_logging (const char *pname, BOOL interactive) |
BOOL | reopen_logs (void) |
void | force_check_log_size (void) |
BOOL | need_to_check_log_size (void) |
void | check_log_size (void) |
int | Debug1 (const char *format_str,...) |
static void | bufr_print (void) |
static void | format_debug_text (const char *msg) |
void | dbgflush (void) |
BOOL | dbghdr (int level, const char *file, const char *func, int line) |
BOOL | dbgtext (const char *format_str,...) |
変数 | |
XFILE * | dbf = NULL |
pstring | debugf = "" |
BOOL | debug_warn_unknown_class = True |
BOOL | debug_auto_add_unknown_class = True |
BOOL | AllowDebugChange = True |
BOOL | override_logfile |
static int | debug_all_class_hack = 1 |
static BOOL | debug_all_class_isset_hack = True |
static int | debug_num_classes = 0 |
int * | DEBUGLEVEL_CLASS = &debug_all_class_hack |
BOOL * | DEBUGLEVEL_CLASS_ISSET = &debug_all_class_isset_hack |
int | DEBUGLEVEL = &debug_all_class_hack |
static BOOL | stdout_logging = False |
static int | debug_count = 0 |
static int | syslog_level = 0 |
static pstring | format_bufr = { '\0' } |
static size_t | format_pos = 0 |
static BOOL | log_overflow = False |
static const char * | default_classname_table [] |
static char ** | classname_table = NULL |
void gfree_debugsyms | ( | void | ) |
参照先 classname_table・debug_all_class_hack・debug_all_class_isset_hack・debug_num_classes・DEBUGLEVEL_CLASS・DEBUGLEVEL_CLASS_ISSET.
参照元 gfree_all().
00185 { 00186 int i; 00187 00188 if ( classname_table ) { 00189 for ( i = 0; i < debug_num_classes; i++ ) { 00190 SAFE_FREE( classname_table[i] ); 00191 } 00192 SAFE_FREE( classname_table ); 00193 } 00194 00195 if ( DEBUGLEVEL_CLASS != &debug_all_class_hack ) 00196 SAFE_FREE( DEBUGLEVEL_CLASS ); 00197 00198 if ( DEBUGLEVEL_CLASS_ISSET != &debug_all_class_isset_hack ) 00199 SAFE_FREE( DEBUGLEVEL_CLASS_ISSET ); 00200 }
static char* debug_list_class_names_and_levels | ( | void | ) | [static] |
参照先 asprintf()・bitmap::b・buf・classname_table・debug_all_class_hack・debug_num_classes・DEBUGLEVEL・DEBUGLEVEL_CLASS・DEBUGLEVEL_CLASS_ISSET・err・list().
参照元 debuglevel_message().
00209 { 00210 int i, dim; 00211 char **list; 00212 char *buf = NULL; 00213 char *b; 00214 BOOL err = False; 00215 00216 if (DEBUGLEVEL_CLASS == &debug_all_class_hack) { 00217 return NULL; 00218 } 00219 00220 list = SMB_CALLOC_ARRAY(char *, debug_num_classes + 1); 00221 if (!list) { 00222 return NULL; 00223 } 00224 00225 /* prepare strings */ 00226 for (i = 0, dim = 0; i < debug_num_classes; i++) { 00227 int l = asprintf(&list[i], 00228 "%s:%d ", 00229 classname_table[i], 00230 DEBUGLEVEL_CLASS_ISSET[i]?DEBUGLEVEL_CLASS[i]:DEBUGLEVEL); 00231 if (l < 0 || l > MAX_CLASS_NAME_SIZE) { 00232 err = True; 00233 goto done; 00234 } 00235 dim += l; 00236 } 00237 00238 /* create single string list - add space for newline */ 00239 b = buf = (char *)SMB_MALLOC(dim+1); 00240 if (!buf) { 00241 err = True; 00242 goto done; 00243 } 00244 for (i = 0; i < debug_num_classes; i++) { 00245 int l = strlen(list[i]); 00246 strncpy(b, list[i], l); 00247 b = b + l; 00248 } 00249 b[-1] = '\n'; /* replace last space with newline */ 00250 b[0] = '\0'; /* null terminate string */ 00251 00252 done: 00253 /* free strings list */ 00254 for (i = 0; i < debug_num_classes; i++) { 00255 SAFE_FREE(list[i]); 00256 } 00257 SAFE_FREE(list); 00258 00259 if (err) { 00260 return NULL; 00261 } else { 00262 return buf; 00263 } 00264 }
const char* debug_classname_from_index | ( | int | ndx | ) |
参照先 classname_table・debug_num_classes.
00271 { 00272 if (ndx < 0 || ndx >= debug_num_classes) 00273 return NULL; 00274 else 00275 return classname_table[ndx]; 00276 }
static int debug_lookup_classname_int | ( | const char * | classname | ) | [static] |
参照先 classname_table・debug_num_classes.
参照元 debug_add_class()・debug_lookup_classname().
00283 { 00284 int i; 00285 00286 if (!classname) return -1; 00287 00288 for (i=0; i < debug_num_classes; i++) { 00289 if (strcmp(classname, classname_table[i])==0) 00290 return i; 00291 } 00292 return -1; 00293 }
int debug_add_class | ( | const char * | classname | ) |
参照先 classname_table・debug_all_class_hack・debug_all_class_isset_hack・debug_init()・debug_lookup_classname_int()・debug_num_classes・DEBUGLEVEL・DEBUGLEVEL_CLASS・DEBUGLEVEL_CLASS_ISSET.
参照元 debug_init()・debug_lookup_classname()・vfs_extd_audit_init()・vfs_full_audit_init()・vfs_recycle_init()・vfs_shadow_copy_init().
00300 { 00301 int ndx; 00302 void *new_ptr; 00303 00304 if (!classname) 00305 return -1; 00306 00307 /* check the init has yet been called */ 00308 debug_init(); 00309 00310 ndx = debug_lookup_classname_int(classname); 00311 if (ndx >= 0) 00312 return ndx; 00313 ndx = debug_num_classes; 00314 00315 new_ptr = DEBUGLEVEL_CLASS; 00316 if (DEBUGLEVEL_CLASS == &debug_all_class_hack) { 00317 /* Initial loading... */ 00318 new_ptr = NULL; 00319 } 00320 new_ptr = SMB_REALLOC_ARRAY(new_ptr, int, debug_num_classes + 1); 00321 if (!new_ptr) 00322 return -1; 00323 DEBUGLEVEL_CLASS = (int *)new_ptr; 00324 DEBUGLEVEL_CLASS[ndx] = 0; 00325 00326 /* debug_level is the pointer used for the DEBUGLEVEL-thingy */ 00327 if (ndx==0) { 00328 /* Transfer the initial level from debug_all_class_hack */ 00329 DEBUGLEVEL_CLASS[ndx] = DEBUGLEVEL; 00330 } 00331 debug_level = DEBUGLEVEL_CLASS; 00332 00333 new_ptr = DEBUGLEVEL_CLASS_ISSET; 00334 if (new_ptr == &debug_all_class_isset_hack) { 00335 new_ptr = NULL; 00336 } 00337 new_ptr = SMB_REALLOC_ARRAY(new_ptr, BOOL, debug_num_classes + 1); 00338 if (!new_ptr) 00339 return -1; 00340 DEBUGLEVEL_CLASS_ISSET = (int *)new_ptr; 00341 DEBUGLEVEL_CLASS_ISSET[ndx] = False; 00342 00343 new_ptr = SMB_REALLOC_ARRAY(classname_table, char *, debug_num_classes + 1); 00344 if (!new_ptr) 00345 return -1; 00346 classname_table = (char **)new_ptr; 00347 00348 classname_table[ndx] = SMB_STRDUP(classname); 00349 if (! classname_table[ndx]) 00350 return -1; 00351 00352 debug_num_classes++; 00353 00354 return ndx; 00355 }
int debug_lookup_classname | ( | const char * | classname | ) |
参照先 debug_add_class()・debug_auto_add_unknown_class・debug_lookup_classname_int()・debug_warn_unknown_class.
参照元 debug_parse_params().
00362 { 00363 int ndx; 00364 00365 if (!classname || !*classname) 00366 return -1; 00367 00368 ndx = debug_lookup_classname_int(classname); 00369 00370 if (ndx != -1) 00371 return ndx; 00372 00373 if (debug_warn_unknown_class) { 00374 DEBUG(0, ("debug_lookup_classname(%s): Unknown class\n", 00375 classname)); 00376 } 00377 if (debug_auto_add_unknown_class) { 00378 return debug_add_class(classname); 00379 } 00380 return -1; 00381 }
static void debug_dump_status | ( | int | level | ) | [static] |
参照先 classname_table・debug_num_classes・DEBUGLEVEL_CLASS・DEBUGLEVEL_CLASS_ISSET.
参照元 debug_parse_levels().
00388 { 00389 int q; 00390 00391 DEBUG(level, ("INFO: Current debug levels:\n")); 00392 for (q = 0; q < debug_num_classes; q++) { 00393 DEBUGADD(level, (" %s: %s/%d\n", 00394 classname_table[q], 00395 (DEBUGLEVEL_CLASS_ISSET[q] 00396 ? "True" : "False"), 00397 DEBUGLEVEL_CLASS[q])); 00398 } 00399 }
static BOOL debug_parse_params | ( | char ** | params | ) | [static] |
参照先 debug_lookup_classname()・debug_num_classes・DEBUGLEVEL_CLASS・DEBUGLEVEL_CLASS_ISSET.
参照元 debug_parse_levels().
00407 { 00408 int i, ndx; 00409 char *class_name; 00410 char *class_level; 00411 00412 if (!params) 00413 return False; 00414 00415 /* Allow DBGC_ALL to be specified w/o requiring its class name e.g."10" 00416 * v.s. "all:10", this is the traditional way to set DEBUGLEVEL 00417 */ 00418 if (isdigit((int)params[0][0])) { 00419 DEBUGLEVEL_CLASS[DBGC_ALL] = atoi(params[0]); 00420 DEBUGLEVEL_CLASS_ISSET[DBGC_ALL] = True; 00421 i = 1; /* start processing at the next params */ 00422 } else { 00423 i = 0; /* DBGC_ALL not specified OR class name was included */ 00424 } 00425 00426 /* Fill in new debug class levels */ 00427 for (; i < debug_num_classes && params[i]; i++) { 00428 if ((class_name=strtok(params[i],":")) && 00429 (class_level=strtok(NULL, "\0")) && 00430 ((ndx = debug_lookup_classname(class_name)) != -1)) { 00431 DEBUGLEVEL_CLASS[ndx] = atoi(class_level); 00432 DEBUGLEVEL_CLASS_ISSET[ndx] = True; 00433 } else { 00434 DEBUG(0,("debug_parse_params: unrecognized debug class name or format [%s]\n", params[i])); 00435 return False; 00436 } 00437 } 00438 00439 return True; 00440 }
BOOL debug_parse_levels | ( | const char * | params_str | ) |
参照先 AllowDebugChange・debug_dump_status()・debug_init()・debug_parse_params()・str_list_free()・str_list_make().
参照元 debug_message()・handle_debug_list()・popt_common_callback().
00449 { 00450 char **params; 00451 00452 /* Just in case */ 00453 debug_init(); 00454 00455 if (AllowDebugChange == False) 00456 return True; 00457 00458 params = str_list_make(params_str, NULL); 00459 00460 if (debug_parse_params(params)) { 00461 debug_dump_status(5); 00462 str_list_free(¶ms); 00463 return True; 00464 } else { 00465 str_list_free(¶ms); 00466 return False; 00467 } 00468 }
static void debug_message | ( | int | msg_type, | |
struct process_id | src, | |||
void * | buf, | |||
size_t | len, | |||
void * | private_data | |||
) | [static] |
参照先 debug_parse_levels()・procid_to_pid().
参照元 debug_init().
00476 { 00477 const char *params_str = (const char *)buf; 00478 00479 /* Check, it's a proper string! */ 00480 if (params_str[len-1] != '\0') { 00481 DEBUG(1, ("Invalid debug message from pid %u to pid %u\n", 00482 (unsigned int)procid_to_pid(&src), 00483 (unsigned int)getpid())); 00484 return; 00485 } 00486 00487 DEBUG(3, ("INFO: Remote set of debug to `%s' (pid %u from pid %u)\n", 00488 params_str, (unsigned int)getpid(), 00489 (unsigned int)procid_to_pid(&src))); 00490 00491 debug_parse_levels(params_str); 00492 }
void debug_message_send | ( | pid_t | pid, | |
const char * | params_str | |||
) |
参照先 message_send_pid()・pid_to_procid().
00499 { 00500 if (!params_str) 00501 return; 00502 message_send_pid(pid_to_procid(pid), MSG_DEBUG, 00503 params_str, strlen(params_str) + 1, 00504 False); 00505 }
static void debuglevel_message | ( | int | msg_type, | |
struct process_id | src, | |||
void * | buf, | |||
size_t | len, | |||
void * | private_data | |||
) | [static] |
参照先 debug_list_class_names_and_levels()・message・message_send_pid()・procid_to_pid().
参照元 debug_init().
00513 { 00514 char *message = debug_list_class_names_and_levels(); 00515 00516 if (!message) { 00517 DEBUG(0,("debuglevel_message - debug_list_class_names_and_levels returned NULL\n")); 00518 return; 00519 } 00520 00521 DEBUG(1,("INFO: Received REQ_DEBUGLEVEL message from PID %u\n", 00522 (unsigned int)procid_to_pid(&src))); 00523 message_send_pid(src, MSG_DEBUGLEVEL, message, strlen(message) + 1, True); 00524 00525 SAFE_FREE(message); 00526 }
void debug_init | ( | void | ) |
参照先 debug_add_class()・debug_message()・debuglevel_message()・default_classname_table・initialised・message_register().
参照元 debug_add_class()・debug_parse_levels()・setup_logging().
00533 { 00534 static BOOL initialised = False; 00535 const char **p; 00536 00537 if (initialised) 00538 return; 00539 00540 initialised = True; 00541 00542 message_register(MSG_DEBUG, debug_message, NULL); 00543 message_register(MSG_REQ_DEBUGLEVEL, debuglevel_message, NULL); 00544 00545 for(p = default_classname_table; *p; p++) { 00546 debug_add_class(*p); 00547 } 00548 }
void setup_logging | ( | const char * | pname, | |
BOOL | interactive | |||
) |
参照先 dbf・debug_init()・stdout_logging・strrchr_m()・x_fclose()・x_fflush()・x_setbuf()・x_stdout.
参照元 cac_Init()・initlsa()・initsamr()・initsmb()・main()・nss_wins_init()・pam_sm_acct_mgmt()・pam_sm_authenticate()・pam_sm_chauthtok()・parse_quota_set()・py_setup_logging()・send_fs_socket()・smb_krb5_locator_init()・smbc_init_context().
00555 { 00556 debug_init(); 00557 00558 /* reset to allow multiple setup calls, going from interactive to 00559 non-interactive */ 00560 stdout_logging = False; 00561 if (dbf) { 00562 x_fflush(dbf); 00563 (void) x_fclose(dbf); 00564 } 00565 00566 dbf = NULL; 00567 00568 if (interactive) { 00569 stdout_logging = True; 00570 dbf = x_stdout; 00571 x_setbuf( x_stdout, NULL ); 00572 } 00573 #ifdef WITH_SYSLOG 00574 else { 00575 const char *p = strrchr_m( pname,'/' ); 00576 if (p) 00577 pname = p + 1; 00578 #ifdef LOG_DAEMON 00579 openlog( pname, LOG_PID, SYSLOG_FACILITY ); 00580 #else 00581 /* for old systems that have no facility codes. */ 00582 openlog( pname, LOG_PID ); 00583 #endif 00584 } 00585 #endif 00586 }
BOOL reopen_logs | ( | void | ) |
参照先 close_low_fds()・dbf・debugf・errno・force_check_log_size()・log_overflow・lp_loaded()・stdout_logging・strerror()・sys_dup2()・x_fclose()・x_fflush()・x_fileno()・x_fopen()・x_setbuf().
参照元 check_log_size()・fork_child_dc_connect()・fork_domain_child()・main()・msg_reload_nmbd_services()・py_setup_logging()・reload_services()・reload_services_file()・reply_special()・send_fs_socket()・smbc_init_context().
00597 { 00598 pstring fname; 00599 mode_t oldumask; 00600 XFILE *new_dbf = NULL; 00601 XFILE *old_dbf = NULL; 00602 BOOL ret = True; 00603 00604 if (stdout_logging) 00605 return True; 00606 00607 oldumask = umask( 022 ); 00608 00609 pstrcpy(fname, debugf ); 00610 debugf[0] = '\0'; 00611 00612 if (lp_loaded()) { 00613 char *logfname; 00614 00615 logfname = lp_logfile(); 00616 if (*logfname) 00617 pstrcpy(fname, logfname); 00618 } 00619 00620 pstrcpy( debugf, fname ); 00621 new_dbf = x_fopen( debugf, O_WRONLY|O_APPEND|O_CREAT, 0644); 00622 00623 if (!new_dbf) { 00624 log_overflow = True; 00625 DEBUG(0, ("Unable to open new log file %s: %s\n", debugf, strerror(errno))); 00626 log_overflow = False; 00627 if (dbf) 00628 x_fflush(dbf); 00629 ret = False; 00630 } else { 00631 x_setbuf(new_dbf, NULL); 00632 old_dbf = dbf; 00633 dbf = new_dbf; 00634 if (old_dbf) 00635 (void) x_fclose(old_dbf); 00636 } 00637 00638 /* Fix from klausr@ITAP.Physik.Uni-Stuttgart.De 00639 * to fix problem where smbd's that generate less 00640 * than 100 messages keep growing the log. 00641 */ 00642 force_check_log_size(); 00643 (void)umask(oldumask); 00644 00645 /* Take over stderr to catch ouput into logs */ 00646 if (dbf && sys_dup2(x_fileno(dbf), 2) == -1) { 00647 close_low_fds(True); /* Close stderr too, if dup2 can't point it 00648 at the logfile */ 00649 } 00650 00651 return ret; 00652 }
void force_check_log_size | ( | void | ) |
参照先 debug_count.
参照元 open_sockets_smbd()・reopen_logs()・timeout_processing().
00659 { 00660 debug_count = 100; 00661 }
BOOL need_to_check_log_size | ( | void | ) |
参照先 dbf・debug_count.
参照元 check_log_size()・smbd_process().
00668 { 00669 int maxlog; 00670 00671 if( debug_count < 100 ) 00672 return( False ); 00673 00674 maxlog = lp_max_log_size() * 1024; 00675 if( !dbf || maxlog <= 0 ) { 00676 debug_count = 0; 00677 return(False); 00678 } 00679 return( True ); 00680 }
void check_log_size | ( | void | ) |
参照先 dbf・debug_count・debugf・get_file_size()・log_overflow・name・need_to_check_log_size()・reopen_logs()・sys_fstat()・x_fileno()・x_fopen().
参照元 Debug1()・smbd_process()・timeout_processing().
00687 { 00688 int maxlog; 00689 SMB_STRUCT_STAT st; 00690 00691 /* 00692 * We need to be root to check/change log-file, skip this and let the main 00693 * loop check do a new check as root. 00694 */ 00695 00696 if( geteuid() != 0 ) 00697 return; 00698 00699 if(log_overflow || !need_to_check_log_size() ) 00700 return; 00701 00702 maxlog = lp_max_log_size() * 1024; 00703 00704 if( sys_fstat( x_fileno( dbf ), &st ) == 0 && st.st_size > maxlog ) { 00705 (void)reopen_logs(); 00706 if( dbf && get_file_size( debugf ) > maxlog ) { 00707 pstring name; 00708 00709 slprintf( name, sizeof(name)-1, "%s.old", debugf ); 00710 (void)rename( debugf, name ); 00711 00712 if (!reopen_logs()) { 00713 /* We failed to reopen a log - continue using the old name. */ 00714 (void)rename(name, debugf); 00715 } 00716 } 00717 } 00718 00719 /* 00720 * Here's where we need to panic if dbf == NULL.. 00721 */ 00722 00723 if(dbf == NULL) { 00724 /* This code should only be reached in very strange 00725 * circumstances. If we merely fail to open the new log we 00726 * should stick with the old one. ergo this should only be 00727 * reached when opening the logs for the first time: at 00728 * startup or when the log level is increased from zero. 00729 * -dwg 6 June 2000 00730 */ 00731 dbf = x_fopen( "/dev/console", O_WRONLY, 0); 00732 if(dbf) { 00733 DEBUG(0,("check_log_size: open of debug file %s failed - using console.\n", 00734 debugf )); 00735 } else { 00736 /* 00737 * We cannot continue without a debug file handle. 00738 */ 00739 abort(); 00740 } 00741 } 00742 debug_count = 0; 00743 }
int Debug1 | ( | const char * | format_str, | |
... | ||||
) |
参照先 check_log_size()・dbf・debug_count・debugf・errno・msgbuf・stdout_logging・syslog_level・x_fflush()・x_fopen()・x_setbuf()・x_vfprintf().
00751 { 00752 va_list ap; 00753 int old_errno = errno; 00754 00755 debug_count++; 00756 00757 if( stdout_logging ) { 00758 va_start( ap, format_str ); 00759 if(dbf) 00760 (void)x_vfprintf( dbf, format_str, ap ); 00761 va_end( ap ); 00762 errno = old_errno; 00763 return( 0 ); 00764 } 00765 00766 /* prevent recursion by checking if reopen_logs() has temporaily 00767 set the debugf string to "" */ 00768 if( debugf[0] == '\0') 00769 return( 0 ); 00770 00771 #ifdef WITH_SYSLOG 00772 if( !lp_syslog_only() ) 00773 #endif 00774 { 00775 if( !dbf ) { 00776 mode_t oldumask = umask( 022 ); 00777 00778 dbf = x_fopen( debugf, O_WRONLY|O_APPEND|O_CREAT, 0644 ); 00779 (void)umask( oldumask ); 00780 if( dbf ) { 00781 x_setbuf( dbf, NULL ); 00782 } else { 00783 errno = old_errno; 00784 return(0); 00785 } 00786 } 00787 } 00788 00789 #ifdef WITH_SYSLOG 00790 if( syslog_level < lp_syslog() ) { 00791 /* map debug levels to syslog() priorities 00792 * note that not all DEBUG(0, ...) calls are 00793 * necessarily errors */ 00794 static int priority_map[] = { 00795 LOG_ERR, /* 0 */ 00796 LOG_WARNING, /* 1 */ 00797 LOG_NOTICE, /* 2 */ 00798 LOG_INFO, /* 3 */ 00799 }; 00800 int priority; 00801 pstring msgbuf; 00802 00803 if( syslog_level >= ( sizeof(priority_map) / sizeof(priority_map[0]) ) || syslog_level < 0) 00804 priority = LOG_DEBUG; 00805 else 00806 priority = priority_map[syslog_level]; 00807 00808 va_start( ap, format_str ); 00809 vslprintf( msgbuf, sizeof(msgbuf)-1, format_str, ap ); 00810 va_end( ap ); 00811 00812 msgbuf[255] = '\0'; 00813 syslog( priority, "%s", msgbuf ); 00814 } 00815 #endif 00816 00817 check_log_size(); 00818 00819 #ifdef WITH_SYSLOG 00820 if( !lp_syslog_only() ) 00821 #endif 00822 { 00823 va_start( ap, format_str ); 00824 if(dbf) 00825 (void)x_vfprintf( dbf, format_str, ap ); 00826 va_end( ap ); 00827 if(dbf) 00828 (void)x_fflush( dbf ); 00829 } 00830 00831 errno = old_errno; 00832 00833 return( 0 ); 00834 }
static void bufr_print | ( | void | ) | [static] |
参照先 Debug1()・format_bufr・format_pos.
参照元 dbgflush()・format_debug_text().
00844 { 00845 format_bufr[format_pos] = '\0'; 00846 (void)Debug1( "%s", format_bufr ); 00847 format_pos = 0; 00848 }
static void format_debug_text | ( | const char * | msg | ) | [static] |
参照先 bufr_print()・Debug1()・format_bufr・format_pos・lp_loaded()・stdout_logging.
参照元 dbgtext().
00867 { 00868 size_t i; 00869 BOOL timestamp = (!stdout_logging && (lp_timestamp_logs() || !(lp_loaded()))); 00870 00871 for( i = 0; msg[i]; i++ ) { 00872 /* Indent two spaces at each new line. */ 00873 if(timestamp && 0 == format_pos) { 00874 format_bufr[0] = format_bufr[1] = ' '; 00875 format_pos = 2; 00876 } 00877 00878 /* If there's room, copy the character to the format buffer. */ 00879 if( format_pos < FORMAT_BUFR_MAX ) 00880 format_bufr[format_pos++] = msg[i]; 00881 00882 /* If a newline is encountered, print & restart. */ 00883 if( '\n' == msg[i] ) 00884 bufr_print(); 00885 00886 /* If the buffer is full dump it out, reset it, and put out a line 00887 * continuation indicator. 00888 */ 00889 if( format_pos >= FORMAT_BUFR_MAX ) { 00890 bufr_print(); 00891 (void)Debug1( " +>\n" ); 00892 } 00893 } 00894 00895 /* Just to be safe... */ 00896 format_bufr[format_pos] = '\0'; 00897 }
void dbgflush | ( | void | ) |
参照先 bufr_print()・dbf・x_fflush().
参照元 dump_core().
00907 { 00908 bufr_print(); 00909 if(dbf) 00910 (void)x_fflush( dbf ); 00911 }
BOOL dbghdr | ( | int | level, | |
const char * | file, | |||
const char * | func, | |||
int | line | |||
) |
参照先 current_timestring()・Debug1()・errno・format_pos・lp_loaded()・stdout_logging・sys_getpid()・syslog_level.
00936 { 00937 /* Ensure we don't lose any real errno value. */ 00938 int old_errno = errno; 00939 00940 if( format_pos ) { 00941 /* This is a fudge. If there is stuff sitting in the format_bufr, then 00942 * the *right* thing to do is to call 00943 * format_debug_text( "\n" ); 00944 * to write the remainder, and then proceed with the new header. 00945 * Unfortunately, there are several places in the code at which 00946 * the DEBUG() macro is used to build partial lines. That in mind, 00947 * we'll work under the assumption that an incomplete line indicates 00948 * that a new header is *not* desired. 00949 */ 00950 return( True ); 00951 } 00952 00953 #ifdef WITH_SYSLOG 00954 /* Set syslog_level. */ 00955 syslog_level = level; 00956 #endif 00957 00958 /* Don't print a header if we're logging to stdout. */ 00959 if( stdout_logging ) 00960 return( True ); 00961 00962 /* Print the header if timestamps are turned on. If parameters are 00963 * not yet loaded, then default to timestamps on. 00964 */ 00965 if( lp_timestamp_logs() || lp_debug_prefix_timestamp() || !(lp_loaded()) ) { 00966 char header_str[200]; 00967 00968 header_str[0] = '\0'; 00969 00970 if( lp_debug_pid()) 00971 slprintf(header_str,sizeof(header_str)-1,", pid=%u",(unsigned int)sys_getpid()); 00972 00973 if( lp_debug_uid()) { 00974 size_t hs_len = strlen(header_str); 00975 slprintf(header_str + hs_len, 00976 sizeof(header_str) - 1 - hs_len, 00977 ", effective(%u, %u), real(%u, %u)", 00978 (unsigned int)geteuid(), (unsigned int)getegid(), 00979 (unsigned int)getuid(), (unsigned int)getgid()); 00980 } 00981 00982 /* Print it all out at once to prevent split syslog output. */ 00983 if( lp_debug_prefix_timestamp() ) { 00984 (void)Debug1( "[%s, %d%s] ", 00985 current_timestring(lp_debug_hires_timestamp()), level, 00986 header_str); 00987 } else { 00988 (void)Debug1( "[%s, %d%s] %s:%s(%d)\n", 00989 current_timestring(lp_debug_hires_timestamp()), level, 00990 header_str, file, func, line ); 00991 } 00992 } 00993 00994 errno = old_errno; 00995 return( True ); 00996 }
BOOL dbgtext | ( | const char * | format_str, | |
... | ||||
) |
参照先 format_debug_text()・msgbuf.
01012 { 01013 va_list ap; 01014 pstring msgbuf; 01015 01016 va_start( ap, format_str ); 01017 vslprintf( msgbuf, sizeof(msgbuf)-1, format_str, ap ); 01018 va_end( ap ); 01019 01020 format_debug_text( msgbuf ); 01021 01022 return( True ); 01023 }
BOOL debug_warn_unknown_class = True |
BOOL debug_auto_add_unknown_class = True |
BOOL AllowDebugChange = True |
int debug_all_class_hack = 1 [static] |
BOOL debug_all_class_isset_hack = True [static] |
int debug_num_classes = 0 [static] |
int* DEBUGLEVEL_CLASS = &debug_all_class_hack |
int DEBUGLEVEL = &debug_all_class_hack |
参照元 ads_get_gpo_list()・api_wkssvc_NetrAddAlternateComputerName()・api_WKSSVC_NETRENUMERATECOMPUTERNAMES()・api_WKSSVC_NETRGETJOINABLEOUS()・api_WKSSVC_NETRGETJOINABLEOUS2()・api_WKSSVC_NETRGETJOININFORMATION()・api_WKSSVC_NETRJOINDOMAIN()・api_wkssvc_NetrJoinDomain2()・api_WKSSVC_NETRLOGONDOMAINNAMEADD()・api_WKSSVC_NETRLOGONDOMAINNAMEDEL()・api_WKSSVC_NETRMESSAGEBUFFERSEND()・api_wkssvc_NetrRemoveAlternateComputerName()・api_WKSSVC_NETRRENAMEMACHINEINDOMAIN()・api_wkssvc_NetrRenameMachineInDomain2()・api_WKSSVC_NETRSETPRIMARYCOMPUTERNAME()・api_WKSSVC_NETRUNJOINDOMAIN()・api_wkssvc_NetrUnjoinDomain2()・api_WKSSVC_NETRUSEADD()・api_WKSSVC_NETRUSEDEL()・api_WKSSVC_NETRUSEENUM()・api_WKSSVC_NETRUSEGETINFO()・api_WKSSVC_NETRVALIDATENAME()・api_WKSSVC_NETRVALIDATENAME2()・api_WKSSVC_NETRWKSTATRANSPORTADD()・api_WKSSVC_NETRWKSTATRANSPORTDEL()・api_WKSSVC_NETRWKSTAUSERGETINFO()・api_WKSSVC_NETRWKSTAUSERSETINFO()・api_WKSSVC_NETRWORKSTATIONSTATISTICSGET()・api_wkssvc_NetWkstaEnumUsers()・api_wkssvc_NetWkstaGetInfo()・api_wkssvc_NetWkstaSetInfo()・api_wkssvc_NetWkstaTransportEnum()・asyncdns_process()・brl_get_locks_internal()・cac_Init()・cmd_debuglevel()・cmd_sign()・debug_add_class()・debug_list_class_names_and_levels()・exit_server_common()・fill_grent_mem()・get_dc_list()・get_debuglevel()・get_key_from_keytab()・init_registry()・initlsa()・initsamr()・initsmb()・internal_resolve_name()・local_password_change()・main()・namecache_store()・net_copy_fileattr()・notify_load()・notify_save()・nss_wins_init()・nt_printing_getsec()・parse_mount_smb()・print_socket_options()・printer_driver_files_in_use()・process_options()・prs_dump_region()・rpc_api_pipe_req()・rpccli_wkssvc_NetrAddAlternateComputerName()・rpccli_WKSSVC_NETRENUMERATECOMPUTERNAMES()・rpccli_WKSSVC_NETRGETJOINABLEOUS()・rpccli_WKSSVC_NETRGETJOINABLEOUS2()・rpccli_WKSSVC_NETRGETJOININFORMATION()・rpccli_WKSSVC_NETRJOINDOMAIN()・rpccli_wkssvc_NetrJoinDomain2()・rpccli_WKSSVC_NETRLOGONDOMAINNAMEADD()・rpccli_WKSSVC_NETRLOGONDOMAINNAMEDEL()・rpccli_WKSSVC_NETRMESSAGEBUFFERSEND()・rpccli_wkssvc_NetrRemoveAlternateComputerName()・rpccli_WKSSVC_NETRRENAMEMACHINEINDOMAIN()・rpccli_wkssvc_NetrRenameMachineInDomain2()・rpccli_WKSSVC_NETRSETPRIMARYCOMPUTERNAME()・rpccli_WKSSVC_NETRUNJOINDOMAIN()・rpccli_wkssvc_NetrUnjoinDomain2()・rpccli_WKSSVC_NETRUSEADD()・rpccli_WKSSVC_NETRUSEDEL()・rpccli_WKSSVC_NETRUSEENUM()・rpccli_WKSSVC_NETRUSEGETINFO()・rpccli_WKSSVC_NETRVALIDATENAME()・rpccli_WKSSVC_NETRVALIDATENAME2()・rpccli_WKSSVC_NETRWKSTATRANSPORTADD()・rpccli_WKSSVC_NETRWKSTATRANSPORTDEL()・rpccli_WKSSVC_NETRWKSTAUSERGETINFO()・rpccli_WKSSVC_NETRWKSTAUSERSETINFO()・rpccli_WKSSVC_NETRWORKSTATIONSTATISTICSGET()・rpccli_wkssvc_NetWkstaEnumUsers()・rpccli_wkssvc_NetWkstaGetInfo()・rpccli_wkssvc_NetWkstaSetInfo()・rpccli_wkssvc_NetWkstaTransportEnum()・set_debuglevel()・show_msg()・smb_dos_errstr()・smb_dump()・smbc_init_context()・update_printer_sec()・winbindd_status().
BOOL stdout_logging = False [static] |
int debug_count = 0 [static] |
int syslog_level = 0 [static] |
pstring format_bufr = { '\0' } [static] |
size_t format_pos = 0 [static] |
BOOL log_overflow = False [static] |
const char* default_classname_table[] [static] |
初期値:
{ "all", "tdb", "printdrivers", "lanman", "smb", "rpc_parse", "rpc_srv", "rpc_cli", "passdb", "sam", "auth", "winbind", "vfs", "idmap", "quota", "acls", "locking", "msdfs", "dmapi", NULL }
参照元 debug_init().
char** classname_table = NULL [static] |