赞
踩
- printk(KERN_DEBUG "Here I am: %s:%i\n", __FILE__, __LINE__);
- printk(KERN_CRIT "I'm trashed; giving up on %p\n", ptr);
- KERN_EMERG
- Used for emergency messages, usually those that precede a crash.
- KERN_ALERT
- A situation requiring immediate action.
- KERN_CRIT
- Critical conditions, often related to serious hardware or software failures.
- KERN_ERR
- Used to report error conditions; device drivers often use KERN_ERR to report hard-
- ware difficulties.
- KERN_WARNING
- Warnings about problematic situations that do not, in themselves, create seri-
- ous problems with the system.
- KERN_NOTICE
- Situations that are normal, but still worthy of note. A number of security-related
- conditions are reported at this level.
- KERN_INFO
- Informational messages. Many drivers print information about the hardware
- they find at startup time at this level.
- KERN_DEBUG
- Used for debugging messages.
- /*
- * setconsole.c -- choose a console to receive kernel messages
- *
- * Copyright (C) 1998,2000,2001 Alessandro Rubini
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
- */
-
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- #include <errno.h>
- #include <unistd.h>
- #include <sys/ioctl.h>
-
- int main(int argc, char **argv)
- {
- char bytes[2] = {11,0}; /* 11 is the TIOCLINUX cmd number */
-
- if (argc==2) bytes[1] = atoi(argv[1]); /* the chosen console */
- else {
- fprintf(stderr, "%s: need a single arg\n",argv[0]); exit(1);
- }
- if (ioctl(STDIN_FILENO, TIOCLINUX, bytes)<0) { /* use stdin */
- fprintf(stderr,"%s: ioctl(stdin, TIOCLINUX): %s\n",
- argv[0], strerror(errno));
- exit(1);
- }
- exit(0);
- }
int printk_ratelimit(void);
- if (printk_ratelimit( ))
- printk(KERN_NOTICE "The printer is still on fire\n");
- int print_dev_t(char *buffer, dev_t dev);
- char *format_dev_t(char *buffer, dev_t dev);
- #define print_dev_t(buffer, dev) \
- sprintf((buffer), "%u:%u\n", MAJOR(dev), MINOR(dev))
-
-
- #define format_dev_t(buffer, dev) \
- ({ \
- sprintf(buffer, "%u:%u", MAJOR(dev), MINOR(dev)); \
- buffer; \
- })
- #include <stdio.h>
-
- int main()
- {
- printf("Hello world!\n");
-
- return 0;
- }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。