Adding IP address in Oracle Linux can be done by editing the network-scripts. While this procedure is tested on Oracle Linux, i'm sure it should work on Redhat Enterprise Linux and other versions of Redhat . Editing network - scripts The network interface configuration files are found in the directory: /etc/sysconfig/network-scripts/ To add an IP address to an interface eth0 # cd /etc/sysconfig/network-scripts/ # vi ifcfg-eth0 Enter the below parameters for static configuration DEVICE="eth0" BOOTPROTO="static" BROADCAST="192.168.2.255" HWADDR="00:0C:29:DS:22:26" IPADDR="192.168.2.2" NETMASK="255.255.255.0" NETWORK="192.168.2.0" ONBOOT="yes" TYPE="Ethernet" Save the file by typing ESC :wq R estart the network service for the changes to take effect. # service network restart
In this post we are going to add a new Linux system call. First off all we need to modify our current kernel so we add our system call and then compile it. First off all lets write the system call, which is a very simple c program. #include <linux/linkage.h> #include <linux/kernel.h> asmlinkage long sys_hello() { printk(“Hello World\n”); return 0; } Then we need to add this system call to our kernel. 1. - Download Linux Kernel : Version 4.5.2 www.kernel.org Lets extract the downloaded file using sudo mv linux-4.5.2 /usr/src command. Then we will create a new folder and name it Hello. In this folder we are going to put our hello.c file and a Makefile which is going to be like this: In the next step we are going to open linux-4.5.2/arch/x86/entry/syscalls/syscall_32.tbl and add our call, like in the p...
/*This program counts the characters in a string and the words in it */ #include<stdio.h> #include<conio.h> int main() { int count_words=0,i; int count_char=0; char str[20]; printf("Enter string: "); gets(str); for(i=0; str[i]!=NULL; i++) { char++; if(str[i]==' ') /*Controlls if the character is a space*/ words++; } printf("\nNumber of characters : %d",char); printf("\nNumber of words: % d",words+1); getch(); return 0; } Output : Enter string : programming geek Number of characters in string : 16 Number of words in string : 2
Comments
Post a Comment