static int sched_debug_show(struct seq_file *m, void *v) { u64 now = ktime_to_ns(ktime_get()); int cpu; SEQ_printf(m, "Sched Debug Version: v0.09, %s %.*s\n", init_utsname()->release, (int)strcspn(init_utsname()->version, " "), init_utsname()->version); SEQ_printf(m, "now at %Lu.%06ld msecs\n", SPLIT_NS(now)); #define P(x) \ SEQ_printf(m, " .%-40s: %Ld\n", #x, (long long)(x)) #define PN(x) \ SEQ_printf(m, " .%-40s: %Ld.%06ld\n", #x, SPLIT_NS(x)) P(jiffies); PN(sysctl_sched_latency); PN(sysctl_sched_min_granularity); PN(sysctl_sched_wakeup_granularity); PN(sysctl_sched_child_runs_first); P(sysctl_sched_features); #undef PN #undef P for_each_online_cpu(cpu) print_cpu(m, cpu); SEQ_printf(m, "\n"); return 0; }
void show_regs(struct pt_regs * regs) { unsigned long cr0 = 0L, cr2 = 0L, cr3 = 0L, cr4 = 0L; printk("\n"); printk("Pid: %d, comm: %20s\n", current->pid, current->comm); printk("EIP: %04x:[<%08lx>] CPU: %d\n",0xffff & regs->xcs,regs->eip, smp_processor_id()); print_symbol("EIP is at %s\n", regs->eip); if (user_mode_vm(regs)) printk(" ESP: %04x:%08lx",0xffff & regs->xss,regs->esp); printk(" EFLAGS: %08lx %s (%s %.*s)\n", regs->eflags, print_tainted(), init_utsname()->release, (int)strcspn(init_utsname()->version, " "), init_utsname()->version); printk("EAX: %08lx EBX: %08lx ECX: %08lx EDX: %08lx\n", regs->eax,regs->ebx,regs->ecx,regs->edx); printk("ESI: %08lx EDI: %08lx EBP: %08lx", regs->esi, regs->edi, regs->ebp); printk(" DS: %04x ES: %04x FS: %04x\n", 0xffff & regs->xds,0xffff & regs->xes, 0xffff & regs->xfs); cr0 = read_cr0(); cr2 = read_cr2(); cr3 = read_cr3(); cr4 = read_cr4_safe(); printk("CR0: %08lx CR2: %08lx CR3: %08lx CR4: %08lx\n", cr0, cr2, cr3, cr4); show_trace(NULL, regs, ®s->esp); }
void show_regs_common(void) { const char *vendor, *product, *board; vendor = dmi_get_system_info(DMI_SYS_VENDOR); if (!vendor) vendor = ""; product = dmi_get_system_info(DMI_PRODUCT_NAME); if (!product) product = ""; /* Board Name is optional */ board = dmi_get_system_info(DMI_BOARD_NAME); printk(KERN_CONT "\n"); printk(KERN_DEFAULT "Pid: %d, comm: %.20s %s %s %.*s", task_pid_nr(current), current->comm, print_tainted(), init_utsname()->release, (int)strcspn(init_utsname()->version, " "), init_utsname()->version); printk(KERN_CONT " %s %s", vendor, product); if (board) printk(KERN_CONT "/%s", board); printk(KERN_CONT "\n"); }
static int sched_debug_show(struct seq_file *m, void *v) { u64 ktime, sched_clk, cpu_clk; unsigned long flags; int cpu; local_irq_save(flags); ktime = ktime_to_ns(ktime_get()); sched_clk = sched_clock(); cpu_clk = local_clock(); local_irq_restore(flags); SEQ_printf(m, "Sched Debug Version: v0.10, %s %.*s\n", init_utsname()->release, (int)strcspn(init_utsname()->version, " "), init_utsname()->version); #define P(x) \ SEQ_printf(m, "%-40s: %Ld\n", #x, (long long)(x)) #define PN(x) \ SEQ_printf(m, "%-40s: %Ld.%06ld\n", #x, SPLIT_NS(x)) PN(ktime); PN(sched_clk); PN(cpu_clk); P(jiffies); #ifdef CONFIG_HAVE_UNSTABLE_SCHED_CLOCK P(sched_clock_stable); #endif #undef PN #undef P SEQ_printf(m, "\n"); SEQ_printf(m, "sysctl_sched\n"); #define P(x) \ SEQ_printf(m, " .%-40s: %Ld\n", #x, (long long)(x)) #define PN(x) \ SEQ_printf(m, " .%-40s: %Ld.%06ld\n", #x, SPLIT_NS(x)) PN(sysctl_sched_latency); PN(sysctl_sched_min_granularity); PN(sysctl_sched_wakeup_granularity); P(sysctl_sched_child_runs_first); P(sysctl_sched_features); #undef PN #undef P SEQ_printf(m, " .%-40s: %d (%s)\n", "sysctl_sched_tunable_scaling", sysctl_sched_tunable_scaling, sched_tunable_scaling_names[sysctl_sched_tunable_scaling]); read_lock_irqsave(&tasklist_lock, flags); //for_each_online_cpu(cpu) for_each_possible_cpu(cpu) print_cpu(m, cpu); read_unlock_irqrestore(&tasklist_lock, flags); SEQ_printf(m, "\n"); return 0; }
void __show_registers(struct pt_regs *regs, int all) { unsigned long cr0 = 0L, cr2 = 0L, cr3 = 0L, cr4 = 0L; unsigned long d0, d1, d2, d3, d6, d7; unsigned long sp; unsigned short ss, gs; if (user_mode_vm(regs)) { sp = regs->sp; ss = regs->ss & 0xffff; savesegment(gs, gs); } else { sp = (unsigned long) (®s->sp); savesegment(ss, ss); savesegment(gs, gs); } printk("\n"); printk("Pid: %d, comm: %s %s (%s %.*s)\n", task_pid_nr(current), current->comm, print_tainted(), init_utsname()->release, (int)strcspn(init_utsname()->version, " "), init_utsname()->version); printk("EIP: %04x:[<%08lx>] EFLAGS: %08lx CPU: %d\n", (u16)regs->cs, regs->ip, regs->flags, smp_processor_id()); print_symbol("EIP is at %s\n", regs->ip); printk("EAX: %08lx EBX: %08lx ECX: %08lx EDX: %08lx\n", regs->ax, regs->bx, regs->cx, regs->dx); printk("ESI: %08lx EDI: %08lx EBP: %08lx ESP: %08lx\n", regs->si, regs->di, regs->bp, sp); printk(" DS: %04x ES: %04x FS: %04x GS: %04x SS: %04x\n", (u16)regs->ds, (u16)regs->es, (u16)regs->fs, gs, ss); if (!all) return; cr0 = read_cr0(); cr2 = read_cr2(); cr3 = read_cr3(); cr4 = read_cr4_safe(); printk("CR0: %08lx CR2: %08lx CR3: %08lx CR4: %08lx\n", cr0, cr2, cr3, cr4); get_debugreg(d0, 0); get_debugreg(d1, 1); get_debugreg(d2, 2); get_debugreg(d3, 3); printk("DR0: %08lx DR1: %08lx DR2: %08lx DR3: %08lx\n", d0, d1, d2, d3); get_debugreg(d6, 6); get_debugreg(d7, 7); printk("DR6: %08lx DR7: %08lx\n", d6, d7); }
/* * The architecture-independent dump_stack generator */ void dump_stack(void) { unsigned long stack; printk("Pid: %d, comm: %.20s %s %s %.*s\n", current->pid, current->comm, print_tainted(), init_utsname()->release, (int)strcspn(init_utsname()->version, " "), init_utsname()->version); show_trace(NULL, NULL, &stack); }
static int __init gncm_bind(struct usb_composite_dev *cdev) { int gcnum; struct usb_gadget *gadget = cdev->gadget; int status; status = gether_setup(cdev->gadget, hostaddr); if (status < 0) return status; gcnum = usb_gadget_controller_number(gadget); if (gcnum >= 0) device_desc.bcdDevice = cpu_to_le16(0x0300 | gcnum); else { dev_warn(&gadget->dev, "controller '%s' not recognized; trying %s\n", gadget->name, ncm_config_driver.label); device_desc.bcdDevice = cpu_to_le16(0x0300 | 0x0099); } snprintf(manufacturer, sizeof manufacturer, "%s %s with %s", init_utsname()->sysname, init_utsname()->release, gadget->name); status = usb_string_id(cdev); if (status < 0) goto fail; strings_dev[STRING_MANUFACTURER_IDX].id = status; device_desc.iManufacturer = status; status = usb_string_id(cdev); if (status < 0) goto fail; strings_dev[STRING_PRODUCT_IDX].id = status; device_desc.iProduct = status; status = usb_add_config(cdev, &ncm_config_driver, ncm_do_config); if (status < 0) goto fail; dev_info(&gadget->dev, "%s\n", DRIVER_DESC); return 0; fail: gether_cleanup(); return status; }
static int __init zero_bind(struct usb_composite_dev *cdev) { int gcnum; struct usb_gadget *gadget = cdev->gadget; int id; id = usb_string_id(cdev); if (id < 0) return id; strings_dev[STRING_MANUFACTURER_IDX].id = id; device_desc.iManufacturer = id; id = usb_string_id(cdev); if (id < 0) return id; strings_dev[STRING_PRODUCT_IDX].id = id; device_desc.iProduct = id; id = usb_string_id(cdev); if (id < 0) return id; strings_dev[STRING_SERIAL_IDX].id = id; device_desc.iSerialNumber = id; setup_timer(&autoresume_timer, zero_autoresume, (unsigned long) cdev); if (loopdefault) { loopback_add(cdev, autoresume != 0); sourcesink_add(cdev, autoresume != 0); } else { sourcesink_add(cdev, autoresume != 0); loopback_add(cdev, autoresume != 0); } gcnum = usb_gadget_controller_number(gadget); if (gcnum >= 0) device_desc.bcdDevice = cpu_to_le16(0x0200 + gcnum); else { pr_warning("%s: controller '%s' not recognized\n", longname, gadget->name); device_desc.bcdDevice = cpu_to_le16(0x9999); } INFO(cdev, "%s, version: " DRIVER_VERSION "\n", longname); snprintf(manufacturer, sizeof manufacturer, "%s %s with %s", init_utsname()->sysname, init_utsname()->release, gadget->name); return 0; }
/* * The architecture-independent dump_stack generator */ void dump_stack(void) { unsigned long bp; unsigned long stack; bp = stack_frame(current, NULL); printk("Pid: %d, comm: %.20s mm: {%p} %s %s %.*s\n", current->pid, current->comm,current->mm, print_tainted(), init_utsname()->release, (int)strcspn(init_utsname()->version, " "), init_utsname()->version); show_trace(NULL, NULL, &stack, bp); }
static int mutex_stats_show(struct seq_file *m, void *v) { SEQ_printf(m, "ChronOS Version: %s, %s %.*s\n", CHRONOS_VERSION_STRING, init_utsname()->release, (int)strcspn(init_utsname()->version, " "), init_utsname()->version); print_mutex(m); SEQ_printf(m, "\n"); return 0; }
static void mtdoops_write(struct mtdoops_context *cxt, int panic) { struct mtd_info *mtd = cxt->mtd; size_t retlen; u32 *hdr; int ret; /* Add mtdoops header to the buffer */ hdr = cxt->oops_buf; hdr[0] = cxt->nextcount; hdr[1] = MTDOOPS_KERNMSG_MAGIC; memcpy(&hdr[2], init_utsname(), sizeof(struct new_utsname)); if (panic) ret = mtd->panic_write(mtd, cxt->nextpage * record_size, record_size, &retlen, cxt->oops_buf); else ret = mtd->write(mtd, cxt->nextpage * record_size, record_size, &retlen, cxt->oops_buf); if (retlen != record_size || ret < 0) printk(KERN_ERR "mtdoops: write failure at %ld (%td of %ld written), error %d\n", cxt->nextpage * record_size, retlen, record_size, ret); mark_page_used(cxt, cxt->nextpage); mtdoops_inc_counter(cxt); }
static int sched_debug_show(struct seq_file *m, void *v) { u64 ktime, sched_clk, cpu_clk; unsigned long flags; int cpu; local_irq_save(flags); ktime = ktime_to_ns(ktime_get()); sched_clk = sched_clock(); cpu_clk = local_clock(); local_irq_restore(flags); SEQ_printf(m, "Sched Debug Version: v0.10, %s %.*s\n", init_utsname()->release, (int)strcspn(init_utsname()->version, " "), init_utsname()->version);
static int __init uml_version_setup(char *line, int *add) { printf("%s\n", init_utsname()->release); exit(0); return 0; }
static void __init setup_processor(void) { struct cpu_info *cpu_info; u64 reg_value; /* * locate processor in the list of supported processor * types. The linker builds this table for us from the * entries in arch/arm/mm/proc.S */ cpu_info = lookup_processor_type(read_cpuid_id()); if (!cpu_info) { printk("CPU configuration botched (ID %08x), unable to continue.\n", read_cpuid_id()); while (1); } cpu_name = cpu_info->cpu_name; printk("CPU: %s [%08x] revision %d\n", cpu_name, read_cpuid_id(), read_cpuid_id() & 15); sprintf(init_utsname()->machine, "aarch64"); elf_hwcap = 0; /* Read the number of ASID bits */ reg_value = read_cpuid(ID_AA64MMFR0_EL1) & 0xf0; if (reg_value == 0x00) max_asid_bits = 8; else if (reg_value == 0x20) max_asid_bits = 16; else BUG_ON(1); cpu_last_asid = 1 << max_asid_bits; }
const char * sysapi_utsname_machine(void) { if( ! utsname_inited ) { init_utsname(); } return utsname_machine; }
const char * sysapi_utsname_version(void) { if( ! utsname_inited ) { init_utsname(); } return utsname_version; }
const char * sysapi_utsname_release(void) { if( ! utsname_inited ) { init_utsname(); } return utsname_release; }
void dump_stack(void) { unsigned long bp = 0; unsigned long stack; #ifdef CONFIG_FRAME_POINTER if (!bp) get_bp(bp); #endif printk("Pid: %d, comm: %.20s %s %s %.*s\n", current->pid, current->comm, print_tainted(), init_utsname()->release, (int)strcspn(init_utsname()->version, " "), init_utsname()->version); show_trace(NULL, NULL, &stack, bp); }
const char * sysapi_utsname_nodename(void) { if( ! utsname_inited ) { init_utsname(); } return utsname_nodename; }
static int __init pSeries_init_panel(void) { /* Manually leave the kernel version on the panel. */ ppc_md.progress("Linux ppc64\n", 0); ppc_md.progress(init_utsname()->version, 0); return 0; }
static int __init uml_version_setup(char *line, int *add) { /* Explicitly use printf() to show version in stdout */ printf("%s\n", init_utsname()->release); exit(0); return 0; }
static int __init audio_bind(struct usb_composite_dev *cdev) { int gcnum; int status; gcnum = usb_gadget_controller_number(cdev->gadget); if (gcnum >= 0) device_desc.bcdDevice = cpu_to_le16(0x0300 | gcnum); else { ERROR(cdev, "controller '%s' not recognized; trying %s\n", cdev->gadget->name, audio_config_driver.label); device_desc.bcdDevice = __constant_cpu_to_le16(0x0300 | 0x0099); } /* device descriptor strings: manufacturer, product */ snprintf(manufacturer, sizeof manufacturer, "%s %s with %s", init_utsname()->sysname, init_utsname()->release, cdev->gadget->name); status = usb_string_id(cdev); if (status < 0) goto fail; strings_dev[STRING_MANUFACTURER_IDX].id = status; device_desc.iManufacturer = status; status = usb_string_id(cdev); if (status < 0) goto fail; strings_dev[STRING_PRODUCT_IDX].id = status; device_desc.iProduct = status; status = usb_add_config(cdev, &audio_config_driver); if (status < 0) goto fail; INFO(cdev, "%s, version: %s\n", DRIVER_DESC, DRIVER_VERSION); return 0; fail: return status; }
static void init_header(struct swsusp_info *info) { memset(info, 0, sizeof(struct swsusp_info)); info->version_code = LINUX_VERSION_CODE; info->num_physpages = num_physpages; memcpy(&info->uts, init_utsname(), sizeof(struct new_utsname)); info->cpus = num_online_cpus(); info->image_pages = nr_copy_pages; info->pages = nr_copy_pages + nr_meta_pages + 1; info->size = info->pages; info->size <<= PAGE_SHIFT; }
static void snd_sndstat_proc_read(struct snd_info_entry *entry, struct snd_info_buffer *buffer) { snd_iprintf(buffer, "Sound Driver:3.8.1a-980706 (ALSA emulation code)\n"); snd_iprintf(buffer, "Kernel: %s %s %s %s %s\n", init_utsname()->sysname, init_utsname()->nodename, init_utsname()->release, init_utsname()->version, init_utsname()->machine); snd_iprintf(buffer, "Config options: 0\n"); snd_iprintf(buffer, "\nInstalled drivers: \n"); snd_iprintf(buffer, "Type 10: ALSA emulation\n"); snd_iprintf(buffer, "\nCard config: \n"); snd_card_info_read_oss(buffer); snd_sndstat_show_strings(buffer, "Audio devices", SNDRV_OSS_INFO_DEV_AUDIO); snd_sndstat_show_strings(buffer, "Synth devices", SNDRV_OSS_INFO_DEV_SYNTH); snd_sndstat_show_strings(buffer, "Midi devices", SNDRV_OSS_INFO_DEV_MIDI); snd_sndstat_show_strings(buffer, "Timers", SNDRV_OSS_INFO_DEV_TIMERS); snd_sndstat_show_strings(buffer, "Mixers", SNDRV_OSS_INFO_DEV_MIXERS); }
static int __init msg_bind(struct usb_composite_dev *cdev) { struct usb_gadget *gadget = cdev->gadget; int status; /* Allocate string descriptor numbers ... note that string * contents can be overridden by the composite_dev glue. */ /* device descriptor strings: manufacturer, product */ snprintf(manufacturer, sizeof manufacturer, "%s %s with %s", init_utsname()->sysname, init_utsname()->release, gadget->name); status = usb_string_id(cdev); if (status < 0) return status; strings_dev[STRING_MANUFACTURER_IDX].id = status; msg_device_desc.iManufacturer = status; status = usb_string_id(cdev); if (status < 0) return status; strings_dev[STRING_PRODUCT_IDX].id = status; msg_device_desc.iProduct = status; status = usb_string_id(cdev); if (status < 0) return status; strings_dev[STRING_CONFIGURATION_IDX].id = status; msg_config_driver.iConfiguration = status; /* register our second configuration */ status = usb_add_config(cdev, &msg_config_driver); if (status < 0) return status; dev_info(&gadget->dev, DRIVER_DESC ", version: " DRIVER_VERSION "\n"); set_bit(0, &msg_registered); return 0; }
static void ascii_ssetup_strings(char **pbcc_area, struct cifsSesInfo *ses, const struct nls_table *nls_cp) { char *bcc_ptr = *pbcc_area; /* copy user */ /* BB what about null user mounts - check that we do this BB */ /* copy user */ if (ses->userName == NULL) { /* BB what about null user mounts - check that we do this BB */ } else { /* 300 should be long enough for any conceivable user name */ strncpy(bcc_ptr, ses->userName, 300); } /* BB improve check for overflow */ bcc_ptr += strnlen(ses->userName, 300); *bcc_ptr = 0; bcc_ptr++; /* account for null termination */ /* copy domain */ if (ses->domainName != NULL) { strncpy(bcc_ptr, ses->domainName, 256); bcc_ptr += strnlen(ses->domainName, 256); } /* else we will send a null domain name so the server will default to its own domain */ *bcc_ptr = 0; bcc_ptr++; /* BB check for overflow here */ strcpy(bcc_ptr, "Linux version "); bcc_ptr += strlen("Linux version "); strcpy(bcc_ptr, init_utsname()->release); bcc_ptr += strlen(init_utsname()->release) + 1; strcpy(bcc_ptr, CIFS_NETWORK_OPSYS); bcc_ptr += strlen(CIFS_NETWORK_OPSYS) + 1; *pbcc_area = bcc_ptr; }
static int __init Usage(char *line, int *add) { const char **p; printf(usage_string, init_utsname()->release); p = &__uml_help_start; while (p < &__uml_help_end) { printf("%s", *p); p++; } exit(0); return 0; }
static inline int check_header(struct swsusp_info *info) { char *reason = NULL; if (info->version_code != LINUX_VERSION_CODE) reason = "kernel version"; if (info->num_physpages != num_physpages) reason = "memory size"; if (strcmp(info->uts.sysname,init_utsname()->sysname)) reason = "system type"; if (strcmp(info->uts.release,init_utsname()->release)) reason = "kernel release"; if (strcmp(info->uts.version,init_utsname()->version)) reason = "version"; if (strcmp(info->uts.machine,init_utsname()->machine)) reason = "machine"; if (reason) { printk(KERN_ERR "swsusp: Resume mismatch: %s\n", reason); return -EPERM; } return 0; }
static int __init Usage(char *line, int *add) { const char **p; printf(usage_string, init_utsname()->release); p = &__uml_help_start; /* Explicitly use printf() to show help in stdout */ while (p < &__uml_help_end) { printf("%s", *p); p++; } exit(0); return 0; }
void my_dump_stack(void) { unsigned int stack; unsigned int top; unsigned int addr; printk("Pid: %d, comm: %.20s %s %s %.*s\n", current->pid, current->comm, print_tainted(), init_utsname()->release, (int)strcspn(init_utsname()->version, " "), init_utsname()->version); printk("Call Trace:\n"); /* get stack point */ stack = (unsigned int)&stack; /* get stack top point */ top = (unsigned int)current_thread_info() + THREAD_SIZE; for (; stack < top; stack += 4) { addr = *(unsigned int *)stack; if (kernel_text_addressp(addr)) printk(" [<%p>] %pS\n", (void *)addr, (void *)addr); } }