Linux GRUB 方式切换启动级别(runlevel)
事因修改了某个配置文件,导致系统启动某个服务的时候hold住了,系统启动不起来。这种情况下常常通过修改表启动级别,切换到非xwindow模式下重新启动,一般选取启动级别runlevel为3即可。
参考环境:Redhat Enterprise Linux AS 4
步骤:
1.当Linux启动时,按 e 进去参数选择编辑界面:
2.移动光标选中系统(Red Hat Enterprise Linux AS (2.6.9-55.ELsmp)),按 e:
3.移动光标选中(kernel /vmlinuxz-2.6.9-55.ELsmp ro root=LABEL=/ rhgb quiet):
4.修改rhgb为3,然后按enter键:
5.选中(kernel /vmlinuxz-2.6.9-55.ELsmp ro root=LABEL=/ 3 quiet),按 b, 系统则进去启动程序。
注,当系统reboot时,会自动切换到xwindows启动方式的runlevel(5);
另,如果能进去系统, 或者能启动sshd服务,则通过修改/etc/inittab 文件更改runlevel。
遗憾的是暂时无法上传图片,各个步骤的截图只能搁下了~~
参考:
Runlevel System State
0 Halt the system
1 Single user mode
2 Basic multi user mode
3 Multi user mode
5 Multi user mode with GUI
6 Reboot the system
S, s Single user mode
相关文档:
#include <stdio.h>
#include <stdlib.h>
#include <dirent.h>
#include <errno.h>
#include <string.h>
#define MAX 1024
int get_file_count(char *root)
{
DIR *dir;
struct dirent * ptr;
int total = 0;
char path[MAX];
dir = opendir(root ......
Linux C + + Training
Syllabus
________________________________________
1, Linux Operating System
System Environment: Ubuntu GNU / Linux, RedHat Linux AS5,
FreeBSD
Course Requirements: proficient use of commonly used Linux
/ UNIX commands.
Time: 1 week.
______________________________ ......
#include <stdio.h>
#include <unistd.h>
int main() {
char link[100], path[100];
sprintf(link, "/proc/%d/exe", getpid());
readlink(link, path, sizeof(path));
printf("%s\n.", path);
return 0;
} ......
下面是内核源码分析过程中遇到的问题相关文章的解释。
1. 对container_of的理解
针对内核中有关于list的特殊实现,在遍历链表各元素的时候,为了获取其成员值用到了container_of宏,上面文件是关于该宏实现的详细解释。
--------不断更新------- ......
关于epoll使用方法:
参照: http://linux.die.net/man/4/epoll
实例代码:(来自网上某论坛)
#include <pthread.h>
#include <stdio.h>
#include <sys/timeb.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <sys/epoll.h> ......