EmbLogic's Blog

Character_Device Driver

RCS file: application.c,v
Working file: application.c
head: 1.7
branch:
locks: strict
emblogic: 1.7
access list:
symbolic names:
keyword substitution: kv
total revisions: 7; selected revisions: 7
description:
This is a application.c file
In this file control the all applications(read,write,lseek)
And calling the all function.
—————————-
revision 1.7 locked by: emblogic;
date: 2016/01/28 07:48:54; author: emblogic; state: Exp; lines: +2 -2
*** empty log message ***
—————————-
revision 1.6
date: 2016/01/28 07:43:24; author: emblogic; state: Exp; lines: +1 -1
mainmenu call in loop
—————————-
revision 1.5
date: 2016/01/28 07:40:08; author: emblogic; state: Exp; lines: +3 -3
first call the writer
—————————-
revision 1.4
date: 2016/01/28 07:37:16; author: emblogic; state: Exp; lines: +2 -2
*** empty log message ***
—————————-
revision 1.3
revision 1.2
date: 2016/01/28 06:55:43; author: emblogic; state: Exp; lines: +2 -2
*** empty log message ***
—————————-
revision 1.1
date: 2016/01/28 06:28:04; author: emblogic; state: Exp;
Initial revision
=============================================================================

RCS file: clean.c,v
Working file: clean.c
head: 1.35
branch:
locks: strict
emblogic: 1.35
access list:
symbolic names:
keyword substitution: kv
total revisions: 36; selected revisions: 36
description:
This is a clean.c file.
In this file unregister the driver in the kernel.
—————————-
revision 1.35 locked by: emblogic;
date: 2016/01/22 04:33:11; author: emblogic; state: Exp; lines: +0 -2
remove the comments
—————————-
revision 1.34
date: 2016/01/21 09:07:11; author: emblogic; state: Exp; lines: +1 -1
*** empty log message ***
—————————-
revision 1.33
date: 2016/01/21 08:36:40; author: emblogic; state: Exp; lines: +2 -0
revision 1.12
date: 2016/01/08 11:08:26; author: emblogic; state: Exp; lines: +1 -1
Disconnect the struct cdev from device table by cdev_del(struct cdev*).
—————————-
revision 1.11
date: 2016/01/08 08:26:06; author: emblogic; state: Exp; lines: +1 -1
put the camments
—————————-
revision 1.10
date: 2016/01/08 07:50:20; author: emblogic; state: Exp; lines: +3 -3
use datatype in extern statement
—————————-
revision 1.9
date: 2016/01/08 07:46:56; author: emblogic; state: Exp; lines: +14 -1
replace the unregister _chrdev function to unregister_chrdev_region
—————————-
revision 1.8
date: 2016/01/07 12:05:47; author: emblogic; state: Exp; lines: +1 -1
*** empty log message ***
—————————-
revision 1.7
date: 2016/01/07 12:01:14; author: emblogic; state: Exp; lines: +1 -0
printk statement in if condition
—————————-
revision 1.6
date: 2016/01/07 10:47:07; author: emblogic; state: Exp; lines: +1 -1
Add the macro DEV_NAME.
,
—————————-
Add the macro DEV_NAME.
,
—————————-
revision 1.5
date: 2016/01/07 09:50:39; author: emblogic; state: Exp; lines: +1 -1
use extern in major_no
,
—————————-
revision 1.4
date: 2016/01/07 09:38:17; author: emblogic; state: Exp; lines: +1 -1
declare the mojor_no in declaration.h file using extern.
—————————-
revision 1.3
date: 2016/01/07 06:50:54; author: emblogic; state: Exp; lines: +1 -1
remove the spelling mistake
—————————-
revision 1.2
date: 2016/01/07 06:48:38; author: emblogic; state: Exp; lines: +1 -1
remove the spelling mistake
—————————-
revision 1.1
date: 2016/01/07 06:21:38; author: emblogic; state: Exp;
Initial revision
—————————-
revision 1.31.1.1
date: 2016/01/10 10:30:20; author: root; state: Exp; lines: +1 -1
*** empty log message ***
RCS file: create_scull.c,v
Working file: create_scull.c
head: 1.11
branch:
locks: strict
emblogic: 1.11
access list:
symbolic names:
keyword substitution: kv
total revisions: 11; selected revisions: 11
description:
This is a creatr_scull.c file
in this file allcate the linklist foe Qset(number of items)
and return the address of linklist(starding address of linklist)
—————————-
revision 1.11 locked by: emblogic;
date: 2016/01/24 06:42:02; author: emblogic; state: Exp; lines: +1 -1
*** empty log message ***
—————————-
revision 1.10
date: 2016/01/24 06:40:10; author: emblogic; state: Exp; lines: +3 -5
*** empty log message ***
—————————-
revision 1.9
date: 2016/01/24 05:44:57; author: emblogic; state: Exp; lines: +0 -3
*** empty log message ***
—————————-
revision 1.8
date: 2016/01/24 05:40:28; author: emblogic; state: Exp; lines: +3 -3
*** empty log message ***
revision 1.4
date: 2016/01/22 04:33:40; author: emblogic; state: Exp; lines: +1 -1
calculate the number of itom and design the scull
firstly create itoms then after create the qsetarray and in qsetarray create the quantum for each
—————————-
revision 1.3
date: 2016/01/21 08:36:42; author: emblogic; state: Exp; lines: +29 -13
*** empty log message ***
—————————-
revision 1.2
date: 2016/01/21 07:17:28; author: emblogic; state: Exp; lines: +85 -44
create the scull
—————————-
revision 1.1
date: 2016/01/17 12:00:45; author: emblogic; state: Exp;
Initial revision
=============================================================================

RCS file: declaration.h,v
Working file: declaration.h
head: 1.26
branch:
locks: strict
emblogic: 1.26
access list:
symbolic names:
keyword substitution: kv
total revisions: 26; selected revisions: 26
description:
This file is declaration.h file.
This file is containing the variables and constant.
—————————-
revision 1.26 locked by: emblogic;
date: 2016/01/29 06:35:30; author: emblogic; state: Exp; lines: +1 -0
For syschonization operation use samaphore .
Add the semaphore structure in Dev
—————————-
revision 1.25
date: 2016/01/25 09:42:33; author: emblogic; state: Exp; lines: +2 -0
Add the llseek prototype
—————————-
revision 1.24
date: 2016/01/25 07:06:58; author: emblogic; state: Exp; lines: +0 -1
romove the extern qset because use only dev
—————————-
revision 1.23
date: 2016/01/25 04:16:24; author: emblogic; state: Exp; lines: +1 -1
*** empty log message ***
—————————-
revision 1.22
date: 2016/01/24 12:09:00; author: emblogic; state: Exp; lines: +1 -0
extern the Qset variable
—————————-
revision 1.21
date: 2016/01/24 10:10:37; author: emblogic; state: Exp; lines: +1 -0
Add the prototype of read call
—————————-
revision 1.20
date: 2016/01/22 04:35:45; author: emblogic; state: Exp; lines: +3 -15
revision 1.23
date: 2016/01/25 04:16:24; author: emblogic; state: Exp; lines: +1 -1
*** empty log message ***
—————————-
revision 1.22
date: 2016/01/24 12:09:00; author: emblogic; state: Exp; lines: +1 -0
extern the Qset variable
—————————-
revision 1.21
date: 2016/01/24 10:10:37; author: emblogic; state: Exp; lines: +1 -0
Add the prototype of read call
—————————-
revision 1.20
date: 2016/01/22 04:35:45; author: emblogic; state: Exp; lines: +3 -15
remove the comments and sequence the all lines
add the create scull prototype and write_dev prototype
—————————-
revision 1.15
date: 2016/01/11 08:32:24; author: emblogic; state: Exp; lines: +2 -2
constant structure pass in open_dec(inode,file)
—————————-
revision 1.14
date: 2016/01/11 07:35:11; author: emblogic; state: Exp; lines: +2 -0
declare the open_dev function for open the device
—————————-
revision 1.13
date: 2016/01/11 06:30:14; author: emblogic; state: Exp; lines: +1 -1
*** empty log message ***
—————————-
revision 1.12
date: 2016/01/11 04:14:02; author: emblogic; state: Exp; lines: +2 -2
add the NOD and NOD_T variables for take the input from terminal.
—————————-
revision 1.11
date: 2016/01/10 05:18:28; author: emblogic; state: Exp; lines: +1 -1
*** empty log message ***
—————————-
revision 1.10
date: 2016/01/10 05:13:42; author: emblogic; state: Exp; lines: +1 -1
remove the dev_t type variable(new_devid)
—————————-
revision 1.9
date: 2016/01/08 13:41:23; author: emblogic; state: Exp; lines: +4 -0
revision 1.8
date: 2016/01/08 13:08:50; author: emblogic; state: Exp; lines: +1 -0
declare the new kernel datatype dev_t new_devid.
—————————-
revision 1.7
date: 2016/01/08 10:24:38; author: emblogic; state: Exp; lines: +3 -1
*** empty log message ***
—————————-
revision 1.6
date: 2016/01/08 10:17:54; author: emblogic; state: Exp; lines: +1 -1
*** empty log message ***
—————————-
revision 1.5
date: 2016/01/08 10:09:25; author: emblogic; state: Exp; lines: +1 -1
*** empty log message ***
—————————-
revision 1.4
date: 2016/01/08 09:56:38; author: emblogic; state: Exp; lines: +10 -0
taking the structure(Qset,DEV)for scull mapping
—————————-
revision 1.3
date: 2016/01/08 07:19:38; author: emblogic; state: Exp; lines: +1 -0
Add the dev_t type variable for alloc_chrdev_region
—————————-
revision 1.2
date: 2016/01/07 09:40:29; author: emblogic; state: Exp; lines: +1 -0
declare the major_no.
—————————-
revision 1.1
date: 2016/01/07 06:25:49; author: emblogic; state: Exp;
RCS file: file_operation.h,v
Working file: file_operation.h
head: 1.6
branch:
locks: strict
emblogic: 1.6
access list:
symbolic names:
keyword substitution: kv
total revisions: 6; selected revisions: 6
description:
This file is file operation file .
Its containing the all operation read,write,delete,open….
—————————-
revision 1.6 locked by: emblogic;
date: 2016/01/25 09:42:59; author: emblogic; state: Exp; lines: +2 -1
Add the llseek call
—————————-
revision 1.5
date: 2016/01/24 11:24:20; author: emblogic; state: Exp; lines: +2 -1
Add the read call and maping own call
—————————-
revision 1.4
date: 2016/01/22 04:36:36; author: emblogic; state: Exp; lines: +0 -1
add the trim dev function for flush the data
revision 1.5
date: 2016/01/24 11:24:20; author: emblogic; state: Exp; lines: +2 -1
Add the read call and maping own call
—————————-
revision 1.4
date: 2016/01/22 04:36:36; author: emblogic; state: Exp; lines: +0 -1
add the trim dev function for flush the data
—————————-
revision 1.3
date: 2016/01/21 07:18:21; author: emblogic; state: Exp; lines: +1 -1
*** empty log message ***
—————————-
revision 1.2
date: 2016/01/17 12:04:17; author: emblogic; state: Exp; lines: +3 -2
add the more operation like write
—————————-
revision 1.1
date: 2016/01/15 09:42:07; author: emblogic; state: Exp;
Initial revision
RCS file: header_apps.h,v
Working file: header_apps.h
head: 1.3
branch:
locks: strict
emblogic: 1.3
access list:
symbolic names:
keyword substitution: kv
total revisions: 3; selected revisions: 3
description:
This file is header_apps,c
In this file put the all header for application
—————————-
revision 1.3 locked by: emblogic;
date: 2016/01/30 05:45:05; author: emblogic; state: Exp; lines: +1 -1
set the arguments in lseek functin
—————————-
revision 1.2
date: 2016/01/28 06:55:53; author: emblogic; state: Exp; lines: +1 -0
include the header stdlib for exit function
—————————-
revision 1.1
date: 2016/01/28 06:29:34; author: emblogic; state: Exp;
Initial revision
=============================================================================
RCS file: header.h,v
Working file: header.h
head: 1.26
branch:
locks: strict
emblogic: 1.26
access list:
symbolic names:
keyword substitution: kv
total revisions: 26; selected revisions: 26
description:
This file is a header.h file.
This file is containing the all require header file and macro.
—————————-
revision 1.26 locked by: emblogic;
date: 2016/01/29 06:36:53; author: emblogic; state: Exp; lines: +1 -0
include the header linex/semaphore
—————————-
revision 1.25
date: 2016/01/27 11:37:39; author: emblogic; state: Exp; lines: +1 -1
*** empty log message ***
—————————-
revision 1.24
date: 2016/01/22 05:07:58; author: emblogic; state: Exp; lines: +1 -0
include the header file asm-gereric/uaccess.h for copy from user
—————————-
revision 1.23
date: 2016/01/22 04:37:02; author: emblogic; state: Exp; lines: +3 -3
Maintain the sequence the header file
revision 1.22
date: 2016/01/11 08:33:37; author: emblogic; state: Exp; lines: +2 -0
include the open and release operations
—————————-
revision 1.21
date: 2016/01/11 04:14:50; author: emblogic; state: Exp; lines: +2 -2
*** empty log message ***
—————————-
revision 1.20
date: 2016/01/11 03:48:46; author: emblogic; state: Exp; lines: +1 -4
remove the macro PRINT
—————————-
revision 1.19
date: 2016/01/11 03:44:31; author: emblogic; state: Exp; lines: +1 -1
*** empty log message ***
—————————-
revision 1.18
date: 2016/01/10 11:58:02; author: emblogic; state: Exp; lines: +1 -1
*** empty log message ***
—————————-
revision 1.17
date: 2016/01/10 06:08:14; author: emblogic; state: Exp; lines: +2 -1
*** empty log message ***
—————————-
revision 1.16
date: 2016/01/09 11:33:15; author: emblogic; state: Exp; lines: +2 -1
*** empty log message ***
—————————-
revision 1.15
date: 2016/01/09 11:17:00; author: emblogic; state: Exp; lines: +1 -1
*** empty log message ***
—————————-
revision 1.14
date: 2016/01/09 09:00:55; author: emblogic; state: Exp; lines: +1 -1
nod is 5
;
—————————-
revision 1.13
date: 2016/01/09 08:59:22; author: emblogic; state: Exp; lines: +13 -1
include the macro for cdev structure
—————————-
revision 1.12
date: 2016/01/09 05:34:29; author: emblogic; state: Exp; lines: +1 -1
for one NOD
—————————-
revision 1.11
date: 2016/01/09 04:18:45; author: emblogic; state: Exp; lines: +1 -1
*** empty log message ***
—————————-
revision 1.10
date: 2016/01/08 11:13:43; author: emblogic; state: Exp; lines: +1 -1
*** empty log message ***
—————————-
revision 1.9
date: 2016/01/08 11:09:52; author: emblogic; state: Exp; lines: +1 -0
include the moduleparam header file for cdev_init()function.
—————————-
revision 1.8
date: 2016/01/08 09:57:32; author: emblogic; state: Exp; lines: +2 -0
Include the header file for kmalloc(slab.h)
Include the header file for scull (cdev.h)
revision 1.6
date: 2016/01/07 12:06:41; author: emblogic; state: Exp; lines: +1 -1
*** empty log message ***
—————————-
revision 1.5
date: 2016/01/07 12:04:05; author: emblogic; state: Exp; lines: +1 -1
*** empty log message ***
—————————-
revision 1.4
date: 2016/01/07 12:02:11; author: emblogic; state: Exp; lines: +3 -0
Add the PRINT macro
—————————-
revision 1.3
date: 2016/01/07 10:32:19; author: emblogic; state: Exp; lines: +2 -2
Add n
—————————-
revision 1.2
date: 2016/01/07 10:23:27; author: emblogic; state: Exp; lines: +6 -0
Use the macros DEV_NAME and MINOR_NO.
—————————-
revision 1.1
date: 2016/01/07 06:33:30; author: emblogic; state: Exp;
Initial revision
=============================================================================

RCS file: init.c,v
Working file: init.c
head: 1.62
branch:
locks: strict
emblogic: 1.62
access list:
symbolic names:
keyword substitution: kv
total revisions: 62; selected revisions: 62
description:
This file is init.c file.
In this file, insert and register the driver in the kernal.
—————————-
revision 1.62 locked by: emblogic;
date: 2016/01/29 11:30:00; author: emblogic; state: Exp; lines: +1 -1
*** empty log message ***
—————————-
revision 1.61
date: 2016/01/29 11:21:21; author: emblogic; state: Exp; lines: +1 -1
*** empty log message ***
—————————-
revision 1.60
date: 2016/01/29 06:37:34; author: emblogic; state: Exp; lines: +1 -0
declaration and initization the semaphote
—————————-
revision 1.59
date: 2016/01/22 04:37:42; author: emblogic; state: Exp; lines: +4 -3
recall the value of devid
—————————-
revision 1.58
date: 2016/01/21 09:10:57; author: emblogic; state: Exp; lines: +1 -1
*** empty log message ***
—————————-
revision 1.57
date: 2016/01/21 09:10:14; author: emblogic; state: Exp; lines: +2 -2
*** empty log message ***
—————————-
revision 1.56
date: 2016/01/21 09:07:13; author: emblogic; state: Exp; lines: +7 -5
*** empty log message ***
—————————-
revision 1.55
date: 2016/01/11 06:53:44; author: emblogic; state: Exp; lines: +2 -3
*** empty log message ***
—————————-
revision 1.54
date: 2016/01/11 06:35:30; author: emblogic; state: Exp; lines: +3 -2
*** empty log message ***
—————————-
revision 1.53
date: 2016/01/11 06:33:49; author: emblogic; state: Exp; lines: +2 -2
*** empty log message ***
—————————-
revision 1.52
date: 2016/01/11 06:30:17; author: emblogic; state: Exp; lines: +2 -3
*** empty log message ***
—————————-
revision 1.34
date: 2016/01/09 09:43:25; author: emblogic; state: Exp; lines: +2 -2
replace new_devid to devid
—————————-
revision 1.33
date: 2016/01/09 08:37:40; author: emblogic; state: Exp; lines: +11 -3
add the structure elements(cdev
—————————-
revision 1.32
date: 2016/01/09 04:22:11; author: emblogic; state: Exp; lines: +1 -1
correct the third arguments of cdev_add by 1
—————————-
revision 1.31
date: 2016/01/09 04:18:50; author: emblogic; state: Exp; lines: +1 -1
*** empty log message ***
—————————-
revision 1.30
date: 2016/01/08 13:42:02; author: emblogic; state: Exp; lines: +17 -15
use the number of device more then one.
using for loop.
—————————-
revision 1.29
date: 2016/01/08 13:13:27; author: emblogic; state: Exp; lines: +4 -0
*** empty log message ***
—————————-
revision 1.28
date: 2016/01/08 13:09:56; author: emblogic; state: Exp; lines: +5 -0
use the MKDEV macro for find out the new minor and major no.
—————————-
revision 1.27
date: 2016/01/08 12:14:17; author: emblogic; state: Exp; lines: +1 -1
*** empty log message ***
revision 1.26
date: 2016/01/08 12:11:52; author: emblogic; state: Exp; lines: +1 -0
add the cdev_init ()
—————————-
revision 1.25
date: 2016/01/08 11:55:57; author: emblogic; state: Exp; lines: +1 -2
*** empty log message ***
—————————-
revision 1.24
date: 2016/01/08 11:54:03; author: emblogic; state: Exp; lines: +4 -0
*** empty log message ***
—————————-
revision 1.23
date: 2016/01/08 11:32:48; author: emblogic; state: Exp; lines: +1 -1
*** empty log message ***
—————————-
revision 1.22
date: 2016/01/08 11:24:02; author: emblogic; state: Exp; lines: +2 -1
*** empty log message ***
—————————-
revision 1.21
date: 2016/01/08 11:11:01; author: emblogic; state: Exp; lines: +10 -1
added the struct cdev in device table by cdev_add() function.
—————————-
revision 1.20
date: 2016/01/08 10:38:07; author: emblogic; state: Exp; lines: +1 -1
*** empty log message ***added the struct cdev in device table by cdev_add() function.
—————————-
revision 1.20
date: 2016/01/08 10:38:07; author: emblogic; state: Exp; lines: +1 -1
*** empty log message ***
—————————-
revision 1.19
date: 2016/01/08 10:33:14; author: emblogic; state: Exp; lines: +1 -0
useing memset for flush the scull
—————————-
revision 1.18
date: 2016/01/08 10:24:40; author: emblogic; state: Exp; lines: +9 -1
*** empty log message ***
—————————-
revision 1.17
date: 2016/01/08 10:12:54; author: emblogic; state: Exp; lines: +1 -1
*** empty log message ***
—————————-
revision 1.16
date: 2016/01/08 10:06:00; author: emblogic; state: Exp; lines: +2 -1
decl. the struct Dev *dev
—————————-
revision 1.15
date: 2016/01/08 09:59:20; author: emblogic; state: Exp; lines: +1 -0
Get the memory in kernel by kmalloc with GFP_kernel(get memory page in kernel);
revision 1.14
date: 2016/01/08 08:26:17; author: emblogic; state: Exp; lines: +11 -9
put the camments
—————————-
revision 1.13
date: 2016/01/08 08:06:54; author: emblogic; state: Exp; lines: +0 -1
*** empty log message ***
—————————-
revision 1.12
date: 2016/01/08 07:51:50; author: emblogic; state: Exp; lines: +1 -1
print the minor_no
—————————-
revision 1.11
date: 2016/01/08 07:23:55; author: emblogic; state: Exp; lines: +27 -2
Change the register_chrdev to alloc_chrdev_region due to some region
1>in the alloc_chrdev_region no required file operation(fops) arguments.
2>Register_chrdev not cheak the preinstall driver.
3>so alwayes register the driver
register_chrdev perform in all kernel version but allco_chrdev perform only 2.6.1 to up to date kernial version.
—————————-
revision 1.10
date: 2016/01/07 12:05:50; author: emblogic; state: Exp; lines: +2 -2
*** empty log message ***
—————————-
revision 1.9
date: 2016/01/07 12:02:32; author: emblogic; state: Exp; lines: +3 -0
printk statement in if condition
—————————-
revision 1.8
date: 2016/01/07 11:19:17; author: emblogic; state: Exp; lines: +7 -0
print the error message
revision 1.9
date: 2016/01/07 12:02:32; author: emblogic; state: Exp; lines: +3 -0
printk statement in if condition
—————————-
revision 1.8
date: 2016/01/07 11:19:17; author: emblogic; state: Exp; lines: +7 -0
print the error message
—————————-
revision 1.7
date: 2016/01/07 10:47:32; author: emblogic; state: Exp; lines: +0 -1
*** empty log message ***
—————————-
revision 1.6
date: 2016/01/07 10:24:20; author: emblogic; state: Exp; lines: +2 -1
Put the macro DEV_NAME,and MOJOR_NO.
—————————-
revision 1.5
date: 2016/01/07 10:09:50; author: emblogic; state: Exp; lines: +2 -1
use __init in initization function
—————————-
revision 1.4
date: 2016/01/07 09:48:06; author: emblogic; state: Exp; lines: +1 -0
Add the declaration header file.
—————————-
revision 1.3
date: 2016/01/07 09:40:49; author: emblogic; state: Exp; lines: +1 -1
declare the major_no in declaretion.h file using extern.
—————————-
revision 1.2
date: 2016/01/07 06:44:44; author: emblogic; state: Exp; lines: +1 -1
Add the file_operation header file
RCS file: lseek.c,v
Working file: lseek.c
head: 1.7
branch:
locks: strict
emblogic: 1.7
access list:
symbolic names:
keyword substitution: kv
total revisions: 7; selected revisions: 7
description:
This is a lseek.c file
in this file chande the cursior position in reqire position
—————————-
revision 1.7 locked by: emblogic;
date: 2016/01/30 05:58:42; author: emblogic; state: Exp; lines: +0 -3
*** empty log message ***
—————————-
revision 1.6
date: 2016/01/30 05:56:29; author: emblogic; state: Exp; lines: +17 -14
*** empty log message ***
—————————-
revision 1.5
date: 2016/01/30 05:45:35; author: emblogic; state: Exp; lines: +21 -12
catch the fd in arguments
—————————-
RCS file: main_menu.c,v
Working file: main_menu.c
head: 1.4
branch:
locks: strict
emblogic: 1.4
access list:
symbolic names:
keyword substitution: kv
total revisions: 4; selected revisions: 4
description:
This file is main_menu.c
In this file collect the choice from user and rand applicaion file
—————————-
revision 1.4 locked by: emblogic;
date: 2016/01/28 07:19:19; author: emblogic; state: Exp; lines: +1 -1
return choice
—————————-
RCS file: open.c,v
Working file: open.c
head: 1.13
branch:
locks: strict
emblogic: 1.13
access list:
symbolic names:
keyword substitution: kv
total revisions: 13; selected revisions: 13
description:
This is open.c file
In this file try to open the application own manor
—————————-
revision 1.13 locked by: emblogic;
date: 2016/01/29 11:08:04; author: emblogic; state: Exp; lines: +1 -1
*** empty log message ***
—————————-
revision 1.12
date: 2016/01/23 12:55:07; author: emblogic; state: Exp; lines: +2 -2
*** empty log message ***
—————————-
revision 1.11
date: 2016/01/22 04:38:11; author: emblogic; state: Exp; lines: +3 -2
calling the trim_dev function
—————————-
revision 1.7
date: 2016/01/17 12:04:42; author: emblogic; state: Exp; lines: +8 -0
calling the function trim_dev for removing the previous data in device file and cheak the condition on device that data is avilable in device
—————————-
revision 1.6
date: 2016/01/11 11:49:22; author: emblogic; state: Exp; lines: +1 -1
*** empty log message ***
—————————-
revision 1.5
date: 2016/01/11 11:12:25; author: emblogic; state: Exp; lines: +1 -1
*** empty log message ***
—————————-
revision 1.4
date: 2016/01/11 10:00:11; author: emblogic; state: Exp; lines: +8 -1
*** empty log message ***
—————————-
revision 1.3
date: 2016/01/11 09:39:21; author: emblogic; state: Exp; lines: +4 -1
use container_of macro .
—————————-
revision 1.2
date: 2016/01/11 08:34:13; author: emblogic; state: Exp; lines: +4 -3
RCS file: reader.c,v
Working file: reader.c
head: 1.27
branch:
locks: strict
emblogic: 1.27
access list:
symbolic names:
keyword substitution: kv
total revisions: 27; selected revisions: 27
description:
This is a reader .c file
revision 1.2
date: 2016/01/11 09:41:25; author: emblogic; state: Exp; lines: +16 -6
this ia application file
open the node in readonly made and print the fd
—————————-
RCS file: reader_dev.c,v
Working file: reader_dev.c
head: 1.51
branch:
locks: strict
emblogic: 1.51
access list:
symbolic names:
keyword substitution: kv
total revisions: 51; selected revisions: 51
description:
This is a reader_dev.c file
In this file read the data from kernel and stor the data in user space in reader.c file
—————————-
revision 1.51 locked by: emblogic;
date: 2016/01/30 05:56:34; author: emblogic; state: Exp; lines: +2 -2
*** empty log message ***
—————————-
revision 1.50
date: 2016/01/30 05:46:17; author: emblogic; state: Exp; lines: +1 -1
use return ERESTARTSYS
—————————-
revision 1.49
date: 2016/01/30 05:16:14; author: emblogic; state: Exp; lines: +1 -1
remove the if in semaphore
—————————-
revision 1.48
date: 2016/01/30 04:55:38; author: emblogic; state: Exp; lines: +3 -3
*** empty log message ***
————————–revision 1.42
date: 2016/01/29 06:38:21; author: emblogic; state: Exp; lines: +2 -0
use the semaphore and release the variable
—————————-
revision 1.41
date: 2016/01/28 08:07:56; author: emblogic; state: Exp; lines: +3 -3
*** empty log message ***
—————————-
revision 1.40
date: 2016/01/27 11:53:17; author: emblogic; state: Exp; lines: +1 -0
catch the data from private data to ldev
and link with dev structure qset variable
and fatch the data from dev->data_size and put in lsize
maintain the while loop according to nocsw
—————————-
revision 1.8
date: 2016/01/25 07:34:44; author: emblogic; state: Exp; lines: +9 -4
catch the address from private data to ldev and pass in copy to suer macro
—————————-
RCS file: release.c,v
Working file: release.c
head: 1.3
branch:
locks: strict
emblogic: 1.3
access list:
symbolic names:
keyword substitution: kv
total revisions: 3; selected revisions: 3
description:
This file is release.c file
In this file release the application own manor
—————————-
RCS file: seek_dev.c,v
Working file: seek_dev.c
head: 1.3
branch:
locks: strict
emblogic: 1.3
access list:
symbolic names:
keyword substitution: kv
total revisions: 3; selected revisions: 3
description:
This is seek_dev file
In this file llseek operation perform
—————————-
revision 1.3 locked by: emblogic;
date: 2016/01/25 09:52:04; author: emblogic; state: Exp; lines: +1 -1
Add the formal arguments
—————————-
revision 1.2
date: 2016/01/25 09:47:03; author: emblogic; state: Exp; lines: +1 -1
*** empty log message ***
—————————-
revision 1.1
date: 2016/01/25 09:45:06; author: emblogic; state: Exp;
Initial revision
=============================================================================RCS file: trim_dev.c,v
Working file: trim_dev.c
head: 1.20
branch:
locks: strict
emblogic: 1.20
access list:
symbolic names:
keyword substitution: kv
total revisions: 20; selected revisions: 20
description:
this is a trim_dev.c file
In this file removing the previous data in device
triming started
In this file dealocate the memory (scull)
—————————-
revision 1.4
date: 2016/01/22 04:39:25; author: emblogic; state: Exp; lines: +12 -11
Put the header file on top and remove the undeclaration error
—————————-
RCS file: writer.c,v
Working file: writer.c
head: 1.24
branch:
locks: strict
emblogic: 1.24
access list:
symbolic names:
keyword substitution: kv
total revisions: 24; selected revisions: 24
description:
This file is writer .c
file
in this file open the node for connect the application and vfs
revision 1.3
date: 2016/01/11 09:42:32; author: emblogic; state: Exp; lines: +15 -6
This is a application file
open the node in write only mode and print the fd
—————————-
revision 1.2
date: 2016/01/11 08:38:17; author: emblogic; state: Exp; lines: +2 -1
*** empty log message ***
—————————-
revision 1.1
date: 2016/01/11 06:54:51; author: emblogic; state: Exp;
Initial revision
RCS file: writer_dev.c,v
Working file: writer_dev.c
head: 1.46
branch:
locks: strict
emblogic: 1.46
access list:
symbolic names:
keyword substitution: kv
total revisions: 46; selected revisions: 46
description:
chang the write routine and use the macro copy from user for copy the data from user space to kernel space
—————————-
revision 1.46 locked by: emblogic;
date: 2016/01/30 05:56:35; author: emblogic; state: Exp; lines: +2 -2
*** empty log message ***
—————————-
revision 1.45
date: 2016/01/30 05:46:43; author: emblogic; state: Exp; lines: +1 -1
use ERESTARTSYS
—————————-
revision 1.44
date: 2016/01/30 05:16:32; author: emblogic; state: Exp; lines: +1 -1
remove the if condition in semaphore
—————————-
revision 1.37
date: 2016/01/27 11:56:13; author: emblogic; state: Exp; lines: +1 -0
fatch the address from private data in ldev and
catch the return address by scull in dev->Qset stracture variable
revision 1.22
date: 2016/01/25 07:07:41; author: emblogic; state: Exp; lines: +5 -4
fatch the value private data and stor in local variable and pass in copy form user
—————————-
revision 1.21
revision 1.5
date: 2016/01/22 05:15:07; author: emblogic; state: Exp; lines: +3 -5
catch the data from copy from user macro and use header hile for this
,
—————————-
revision 1.4
date: 2016/01/2

Posted in Uncategorized | Leave a comment

Project 01: Multiple data compression and encryption using iterative techniques

access list:
symbolic names:
keyword substitution: kv
total revisions: 1; selected revisions: 1
description:
—————————-
revision 1.1 locked by: reena;
date: 2016/01/14 09:36:22; author: reena; state: Exp;
Initial revision
=============================================================================

RCS file: prototype.c,v
Working file: prototype.c
head: 1.1
branch:
locks: strict
reena: 1.1
access list:
symbolic names:
keyword substitution: kv
total revisions: 1; selected revisions: 1
description:
/
—————————-
revision 1.1 locked by: reena;
date: 2016/01/14 09:37:23; author: reena; state: Exp;
Initial revision
=============================================================================

RCS file: header.h,v
Working file: header.h
head: 1.1
97,1 18%

Posted in Uncategorized | Leave a comment

fgets – scanning string with spaces

Prototype : -

#include <stdio.h>

char *fgets(char *s, int size, FILE *stream);

Defination :-

fgets() reads in at most one less than size characters from stream and stores them into the buffer pointed to by s.  Reading  stops  after an EOF or a newline.  If a newline is read, it is stored into the buffer.  A terminating null byte (”) is stored after the last charac?
ter in the buffer.
Use :-

It is used to scan a string with spaces until a new line character or EOF character is inserted.

It takes input until enter is pressed.

It is used in place of scanf();

Posted in Data Structures with C | Tagged , , | 1 Comment

INSERTION_SORT

/* Insertion sorting is a sorting technique in which every element will be placed at their position in such a way that they will be sorted*/
#include
int main ()
{
int n,i,j,k,c;
int a[30];

printf(“Enter size of array: \n”);
scanf(“%d”,&n);

printf(“Enter %d elements of array: \n”,n);
for (i=0; i<n; i++)
scanf("%d",&a[i]);

printf("Unsorted Array is: \n");
for (i=0; i<n; i++)
printf("%d ",a[i]);
//sorting begins

for (i=1; i<n; i++)
{
for (j=0; j<i; j++)
{
if (a[i]=j; c–)
a[c+1] = a[c];
a[c+1] = k;
}
}
}

printf(“\nSorted array is\n”);
for (i=0; i<n; i++)
printf("%d ",a[i]);

return 0;
}
– INSERT —

Posted in Uncategorized | 1 Comment

Bubble sorting using function

#include<stdio.h>
//Program for Bubble Sorting
int * bubblesort(int*,int);
int display(int *,int);
int main()
{
int i,j,a[100],N,temp;

printf(“Enter no.of elements you want to sort:\t”);
scanf(“%d”,&N);//Max. no. of elements
printf(“Enter %d elements you want to sort:\n”,N);
for(i=0;i<N;i++)
scanf(“%d”,(a+i));
printf(“\nBefore sorting:\t”);
display(a,N);
//Sorting Starts
bubblesort(a,N);
//Sorting Ends
printf(“\nAfter sorting:\t”);
display(a,N);
}

int * bubblesort(int *a,int N)
{
int i,j,temp;
for(i=0;i<N-1;i++)
for(j=0;j<N-i-1;j++)
if(a[j]>a[j+1])
{
temp = a[j];
a[j]=a[j+1];
a[j+1]=temp;
}
return a;

}
int display(int* a,int N)
{
int i;
for(i=0;i<N;i++)
printf(“%d\t”,*(a+i));

return 0;
}

Posted in Data Structures with C | Tagged , , , , , , | Leave a comment

Basic linklist operations

RCS file: header.h,v
Working file: header.h
head: 1.1
branch:
locks: strict
a: 1.1
access list:
symbolic names:
keyword substitution: kv
total revisions: 1;    selected revisions: 1
description:
stdio.h and stdlib.h are added.
—————————-
revision 1.1    locked by: a;
date: 2015/07/02 08:03:30;  author: a;  state: Exp;
Initial revision
=============================================================================

RCS file: prototypes.h,v
Working file: prototypes.h
head: 1.12
branch:
locks: strict
a: 1.12
access list:
symbolic names:
keyword substitution: kv
total revisions: 12;    selected revisions: 12
description:
struct node is defined.
—————————-
revision 1.12    locked by: a;
date: 2015/07/02 13:26:00;  author: a;  state: Exp;  lines: +1 -1
*** empty log message ***
—————————-
revision 1.11
date: 2015/07/02 12:33:04;  author: a;  state: Exp;  lines: +1 -1
*** empty log message ***
—————————-
revision 1.10
date: 2015/07/02 12:06:18;  author: a;  state: Exp;  lines: +1 -1
*** empty log message ***
—————————-
revision 1.9
date: 2015/07/02 11:53:38;  author: a;  state: Exp;  lines: +4 -2
display_list() added.
—————————-
revision 1.8
date: 2015/07/02 10:23:57;  author: a;  state: Exp;  lines: +1 -1
*** empty log message ***
—————————-
revision 1.7
date: 2015/07/02 10:14:17;  author: a;  state: Exp;  lines: +1 -1
*** empty log message ***
—————————-
revision 1.6
date: 2015/07/02 10:12:21;  author: a;  state: Exp;  lines: +1 -1
*** empty log message ***
—————————-
revision 1.5
date: 2015/07/02 10:08:38;  author: a;  state: Exp;  lines: +1 -1
*** empty log message ***
—————————-
revision 1.4
date: 2015/07/02 09:52:43;  author: a;  state: Exp;  lines: +2 -2
*** empty log message ***
—————————-
revision 1.3
date: 2015/07/02 09:25:49;  author: a;  state: Exp;  lines: +2 -2
int i i.e position is added to insert_element().
—————————-
revision 1.2
date: 2015/07/02 08:43:09;  author: a;  state: Exp;  lines: +1 -0
*** empty log message ***
—————————-
revision 1.1
date: 2015/07/02 08:03:30;  author: a;  state: Exp;
Initial revision
=============================================================================

RCS file: delete_menu.c,v
Working file: delete_menu.c
head: 1.1
branch:
locks: strict
root: 1.1
access list:
symbolic names:
keyword substitution: kv
total revisions: 1;    selected revisions: 1
description:
delete menu created.
—————————-
revision 1.1    locked by: root;
date: 2015/07/08 06:45:44;  author: root;  state: Exp;
Initial revision
=============================================================================

RCS file: display_list.c,v
Working file: display_list.c
head: 1.1
branch:
locks: strict
access list:
symbolic names:
keyword substitution: kv
total revisions: 1;    selected revisions: 1
description:
—————————-
revision 1.1
date: 2015/07/02 12:45:04;  author: a;  state: Exp;
Initial revision
=============================================================================

RCS file: exit_list.c,v
Working file: exit_list.c
head: 1.2
branch:
locks: strict
a: 1.2
access list:
symbolic names:
keyword substitution: kv
total revisions: 2;    selected revisions: 2
description:
exit function created.
—————————-
revision 1.2    locked by: a;
date: 2015/07/02 08:48:07;  author: a;  state: Exp;  lines: +2 -3
*** empty log message ***
—————————-
revision 1.1
date: 2015/07/02 08:38:15;  author: a;  state: Exp;
Initial revision
=============================================================================

RCS file: insert_element.c,v
Working file: insert_element.c
head: 1.22
branch:
locks: strict
a: 1.22
access list:
symbolic names:
keyword substitution: kv
total revisions: 22;    selected revisions: 22
description:
insert_element() is created.
—————————-
revision 1.22    locked by: a;
date: 2015/07/02 15:32:22;  author: a;  state: Exp;  lines: +10 -5
Differentiate between first node and other nodes.
—————————-
revision 1.21
date: 2015/07/02 13:38:04;  author: a;  state: Exp;  lines: +5 -1
*** empty log message ***
—————————-
revision 1.20
date: 2015/07/02 13:26:02;  author: a;  state: Exp;  lines: +2 -2
*** empty log message ***
—————————-
revision 1.19
date: 2015/07/02 13:11:31;  author: a;  state: Exp;  lines: +3 -2
*** empty log message ***
—————————-
revision 1.18
date: 2015/07/02 13:09:32;  author: a;  state: Exp;  lines: +5 -4
local is used .
—————————-
revision 1.17
date: 2015/07/02 11:54:24;  author: a;  state: Exp;  lines: +1 -3
*** empty log message ***
—————————-
revision 1.16
date: 2015/07/02 10:24:00;  author: a;  state: Exp;  lines: +5 -3
*** empty log message ***
—————————-
revision 1.15
date: 2015/07/02 10:17:12;  author: a;  state: Exp;  lines: +0 -1
*** empty log message ***
—————————-
revision 1.14
date: 2015/07/02 10:08:41;  author: a;  state: Exp;  lines: +7 -5
*** empty log message ***
—————————-
revision 1.13
date: 2015/07/02 09:58:31;  author: a;  state: Exp;  lines: +2 -3
*** empty log message ***
—————————-
revision 1.12
date: 2015/07/02 09:41:45;  author: a;  state: Exp;  lines: +2 -2
*** empty log message ***
—————————-
revision 1.11
date: 2015/07/02 09:36:08;  author: a;  state: Exp;  lines: +5 -6
*** empty log message ***
—————————-
revision 1.10
date: 2015/07/02 09:26:44;  author: a;  state: Exp;  lines: +1 -1
i is the position in link list.
—————————-
revision 1.9
date: 2015/07/02 08:28:19;  author: a;  state: Exp;  lines: +1 -1
*** empty log message ***
—————————-
revision 1.8
date: 2015/07/02 08:26:28;  author: a;  state: Exp;  lines: +1 -1
*** empty log message ***
—————————-
revision 1.7
date: 2015/07/02 08:25:31;  author: a;  state: Exp;  lines: +1 -1
*** empty log message ***
—————————-
revision 1.6
date: 2015/07/02 08:24:00;  author: a;  state: Exp;  lines: +4 -4
*** empty log message ***
—————————-
revision 1.5
date: 2015/07/02 08:18:27;  author: a;  state: Exp;  lines: +1 -1
*** empty log message ***
—————————-
revision 1.4
date: 2015/07/02 08:16:51;  author: a;  state: Exp;  lines: +1 -2
elment is corrected
—————————-
revision 1.3
date: 2015/07/02 08:14:33;  author: a;  state: Exp;  lines: +1 -0
*** empty log message ***
—————————-
revision 1.2
date: 2015/07/02 08:10:59;  author: a;  state: Exp;  lines: +7 -5
Element is inserted.
—————————-
revision 1.1
date: 2015/07/02 08:04:28;  author: a;  state: Exp;
Initial revision
=============================================================================

RCS file: insert_end.c,v
Working file: insert_end.c
head: 1.8
branch:
locks: strict
root: 1.8
access list:
symbolic names:
keyword substitution: kv
total revisions: 8;    selected revisions: 8
description:
Element is inserted at end .
—————————-
revision 1.8    locked by: root;
date: 2015/07/08 07:16:45;  author: root;  state: Exp;  lines: +2 -2
*** empty log message ***
—————————-
revision 1.7
date: 2015/07/08 07:11:46;  author: root;  state: Exp;  lines: +1 -0
*** empty log message ***
—————————-
revision 1.6
date: 2015/07/08 07:10:10;  author: root;  state: Exp;  lines: +3 -0
*** empty log message ***
—————————-
revision 1.5
date: 2015/07/08 07:08:11;  author: root;  state: Exp;  lines: +1 -1
*** empty log message ***
—————————-
revision 1.4
date: 2015/07/08 07:07:12;  author: root;  state: Exp;  lines: +1 -1
*** empty log message ***
—————————-
revision 1.3
date: 2015/07/08 07:04:12;  author: root;  state: Exp;  lines: +1 -1
*** empty log message ***
—————————-
revision 1.2
date: 2015/07/08 06:49:24;  author: root;  state: Exp;  lines: +1 -0
Macro is printed
—————————-
revision 1.1
date: 2015/07/08 06:46:19;  author: root;  state: Exp;
Initial revision
=============================================================================

RCS file: insert_menu.c,v
Working file: insert_menu.c
head: 1.1
branch:
locks: strict
root: 1.1
access list:
symbolic names:
keyword substitution: kv
total revisions: 1;    selected revisions: 1
description:
Insert menu created.
—————————-
revision 1.1    locked by: root;
date: 2015/07/08 06:45:31;  author: root;  state: Exp;
Initial revision
=============================================================================

RCS file: insert_node.c,v
Working file: insert_node.c
head: 1.7
branch:
locks: strict
root: 1.7
access list:
symbolic names:
keyword substitution: kv
total revisions: 7;    selected revisions: 7
description:
Insert node is now creating a random node temp only .
—————————-
revision 1.7    locked by: root;
date: 2015/07/08 07:18:30;  author: root;  state: Exp;  lines: +1 -0
*** empty log message ***
—————————-
revision 1.6
date: 2015/07/08 07:16:43;  author: root;  state: Exp;  lines: +1 -0
*** empty log message ***
—————————-
revision 1.5
date: 2015/07/08 07:10:09;  author: root;  state: Exp;  lines: +1 -1
*** empty log message ***
—————————-
revision 1.4
date: 2015/07/08 06:59:35;  author: root;  state: Exp;  lines: +1 -1
*** empty log message ***
—————————-
revision 1.3
date: 2015/07/08 06:57:05;  author: root;  state: Exp;  lines: +1 -1
Prototype is corrected.
—————————-
revision 1.2
date: 2015/07/08 06:55:14;  author: root;  state: Exp;  lines: +27 -4
Cases created and respective functions are called.
—————————-
revision 1.1
date: 2015/07/08 06:45:52;  author: root;  state: Exp;
Initial revision
=============================================================================

RCS file: linklist.c,v
Working file: linklist.c
head: 1.11
branch:
locks: strict
a: 1.11
access list:
symbolic names:
keyword substitution: kv
total revisions: 11;    selected revisions: 11
description:
Element is inserted
—————————-
revision 1.11    locked by: a;
date: 2015/07/02 15:26:31;  author: a;  state: Exp;  lines: +1 -1
*** empty log message ***
—————————-
revision 1.10
date: 2015/07/02 15:25:39;  author: a;  state: Exp;  lines: +3 -1
*** empty log message ***
—————————-
revision 1.9
date: 2015/07/02 13:41:59;  author: a;  state: Exp;  lines: +1 -1
*** empty log message ***
—————————-
revision 1.8
date: 2015/07/02 13:40:18;  author: a;  state: Exp;  lines: +8 -2
*** empty log message ***
—————————-
revision 1.7
date: 2015/07/02 12:23:58;  author: a;  state: Exp;  lines: +1 -2
*** empty log message ***
—————————-
revision 1.6
date: 2015/07/02 11:53:51;  author: a;  state: Exp;  lines: +6 -5
*** empty log message ***
—————————-
revision 1.5
date: 2015/07/02 09:48:46;  author: a;  state: Exp;  lines: +6 -2
*** empty log message ***
—————————-
revision 1.4
date: 2015/07/02 09:26:25;  author: a;  state: Exp;  lines: +2 -1
position i.e i is added.
—————————-
revision 1.3
date: 2015/07/02 08:43:11;  author: a;  state: Exp;  lines: +2 -2
*** empty log message ***
—————————-
revision 1.2
date: 2015/07/02 08:38:12;  author: a;  state: Exp;  lines: +1 -1
*** empty log message ***
—————————-
revision 1.1
date: 2015/07/02 08:03:30;  author: a;  state: Exp;
Initial revision
=============================================================================

RCS file: main_choice.c,v
Working file: main_choice.c
head: 1.2
branch:
locks: strict
a: 1.2
access list:
symbolic names:
keyword substitution: kv
total revisions: 2;    selected revisions: 2
description:
Chices are given.
—————————-
revision 1.2    locked by: a;
date: 2015/07/02 11:53:57;  author: a;  state: Exp;  lines: +1 -1
choice for display is added.
—————————-
revision 1.1
date: 2015/07/02 08:03:54;  author: a;  state: Exp;
Initial revision
=============================================================================

RCS file: perform.c,v
Working file: perform.c
head: 1.22
branch:
locks: strict
a: 1.22
access list:
symbolic names:
keyword substitution: kv
total revisions: 22;    selected revisions: 22
description:
perform() is created.
—————————-
revision 1.22    locked by: a;
date: 2015/07/02 15:35:42;  author: a;  state: Exp;  lines: +1 -1
node is now inserted in new.
—————————-
revision 1.21
date: 2015/07/02 15:19:02;  author: a;  state: Exp;  lines: +1 -1
*** empty log message ***
—————————-
revision 1.20
date: 2015/07/02 13:50:48;  author: a;  state: Exp;  lines: +2 -1
*** empty log message ***
—————————-
revision 1.19
date: 2015/07/02 13:35:40;  author: a;  state: Exp;  lines: +1 -1
*** empty log message ***
—————————-
revision 1.18
date: 2015/07/02 13:34:54;  author: a;  state: Exp;  lines: +2 -2
*** empty log message ***
—————————-
revision 1.17
date: 2015/07/02 13:33:44;  author: a;  state: Exp;  lines: +1 -1
*** empty log message ***
—————————-
revision 1.16
date: 2015/07/02 13:30:45;  author: a;  state: Exp;  lines: +1 -1
start is replaced by new.
—————————-
revision 1.15
date: 2015/07/02 13:26:03;  author: a;  state: Exp;  lines: +8 -5
*** empty log message ***
—————————-
revision 1.14
date: 2015/07/02 12:35:41;  author: a;  state: Exp;  lines: +1 -1
*** empty log message ***
—————————-
revision 1.13
date: 2015/07/02 12:33:58;  author: a;  state: Exp;  lines: +0 -1
*** empty log message ***
—————————-
revision 1.12
date: 2015/07/02 11:54:26;  author: a;  state: Exp;  lines: +5 -1
*** empty log message ***
—————————-
revision 1.11
date: 2015/07/02 10:24:00;  author: a;  state: Exp;  lines: +1 -1
*** empty log message ***
—————————-
revision 1.10
date: 2015/07/02 10:08:42;  author: a;  state: Exp;  lines: +1 -2
*** empty log message ***
—————————-
revision 1.9
date: 2015/07/02 09:48:48;  author: a;  state: Exp;  lines: +1 -1
*** empty log message ***
—————————-
revision 1.8
date: 2015/07/02 09:44:54;  author: a;  state: Exp;  lines: +1 -1
*** empty log message ***
—————————-
revision 1.7
date: 2015/07/02 09:41:46;  author: a;  state: Exp;  lines: +6 -3
*** empty log message ***
—————————-
revision 1.6
date: 2015/07/02 09:36:09;  author: a;  state: Exp;  lines: +2 -0
*** empty log message ***
—————————-
revision 1.5
date: 2015/07/02 09:27:00;  author: a;  state: Exp;  lines: +2 -2
i is added.
—————————-
revision 1.4
date: 2015/07/02 08:43:11;  author: a;  state: Exp;  lines: +1 -2
..
—————————-
revision 1.3
date: 2015/07/02 08:38:14;  author: a;  state: Exp;  lines: +1 -0
*** empty log message ***
—————————-
revision 1.2
date: 2015/07/02 08:24:02;  author: a;  state: Exp;  lines: +1 -1
*** empty log message ***
—————————-
revision 1.1
date: 2015/07/02 08:05:00;  author: a;  state: Exp;
Initial revision
=============================================================================

Posted in Data Structures with C | Tagged , , , , , , , , | Leave a comment

bubble sort with less complexity than O(n2)

#include
main()
{
int n=10;
int a[10]={89,22,20,2,11,39,32,21,87,98},swap=1,j,i,temp;
printf(“this is a bubble sorting technique\n”);
for(i=0;i<n&&swap==1;i++)
{
swap=0;
for(j=0;j=a[j+1])
{
swap=1;
temp=a[j];
a[j]=a[j+1];
a[j+1]=temp;
}
else
printf(“element sorted\n”);
}
}
for(i=0;i<n;i++)
{
printf("a[%d]=%d\n",i,a[i]);
}
return 0;
}

Posted in Data Structures with C | Leave a comment

How to Send a signal -Using Kill command

Send a signal by Kill command
=======================
- To send a signal to a process other than current task.
- It has prototype :-
int kill(pid_t pid, int signo);
- It is included using header :-
#include<signal.h>
- The system data type pid_t is defined in header :-
#include<sys/types.h>
- signo is the signal number of signal to be send.
- pid is the PID of the process to which signal is to be send.
- pid can take value:-
* 0 –> To send signo signal to every process in invoking process’ process group
* -1 –>To send signo signal to every process for which invoking process has permission to send a signal, except itself and init
* n(<-1) –> All process in process group
* n(>0)  –> process with PID n is signalled.
- This take an optional signal name or number and the PID to send the signal.

- For eg. To send ‘hangup’ signal to shell running on PID 1001, we use command :-
kill(1001,HUP);
- killall is used to send signal to all the processes running.

Posted in Linux Internals and System Programming, Project 03: Client Server Communication using Linux and IPC | Tagged , , , , , , , , | 1 Comment

How to register a signal

Register a signal
==================
- Program can handle a signal using signal library function signal().
- signal() is used to register the signal handler function with kernel on behalf of current process.
- It is included in header :-
#include<header.h>
- Prototype of function is :-
void* (signal(int signo,void(*func)(int)))(int);
- signal() function takes 2 parameters, signo and func.
- The signal to be caught or ignored is given as argument signo.
- The function to be called when the specified signal is received is given as func.
- The function must take a single int argument (the signal received) and has return type void.

- The signal() command can be used in 3 modes :-
(i) Default mode (Terminate the process)
SIG_DFL –> is used in place of func.
(ii) Ignore the signal
SIG_IGN –> is used in place of func.
(iii) User defined mode
User defined function is used in place of func.

- The signal command returns the function which is setup to handle the signal, SIG_DFL or SIG_IGN in 3rd, 1st and 2nd cases respectively.

Posted in Linux Internals and System Programming, Project 03: Client Server Communication using Linux and IPC | Tagged , , , , , , , | Leave a comment

About Signals

Signals
========
- A signal is an event generated by UNIX/LINUX system in response to some condition.
- On receipt of a signal, process may in turn take some action.
- Signals are generated by some error conditions such as:-
* Memory Segment Violation
* Floating Point Processor error
* Illegal Instruction etc.
- They are generated by shell and terminal handlers.
- They cause interrupts.

- They can also be used to sent from one process to another as a way of passing information or modifying behaviour.

- As default, if a process receives any signal, process will be terminated immediately.
- Usually a core dump file is created.

- The signals are defined by including header file signal.h
- They all begn with “SIG”.
- There are 64 signals in LINUX.
- The can be listed using command :-
kill -l
- Some of the signals are :-

Signal Name       Description
SIGABORT          Process Abort
SIGALRM           Alarm Clock
SIGFPE            Floating Point Exception
SIGHUP            Hangup
SIGILL            Illegal Instruction
SIGINT            Terminal Interrupt
SIGKILL           Kill (can’t be caught or ignored)
SIGPIPE           Write on a pipe with no reader
SIGQUIT           Terminal Quit
SIGSEGV           Invalid memory segment access (Segmentation Fault)
SIGTERM           Termination
SIGUSR1           User-defined signal 1
SIGUSR2           User-defined signal 2

SIGCHLD           Child process has stopped or exited
SIGCONT           Continue exexuting, if stopped
SIGSTOP           Stop Executing (Can’t be caught or ignored)
SIGTSTP           Terminal stop signal
SIGTTIN           Background process trying to read
SIGTTOU           Background process trying to write

- SIGINT can be called using Ctrl-C
- A signal has 3 steps:-
1) raise
2) catch
3) ignore/handle

Posted in Linux Internals and System Programming, Project 03: Client Server Communication using Linux and IPC | Tagged , , , , | Leave a comment

Replacing a Process Image

Replacing a Process Image
=========================
- The exec function replaces current process with a new process.
- The path of new process is specified as argument to exec.
- It is defined in header :
#include<unistd.h>
- Last argument of function should be NULL.
- It has 6 types of functions, whose prototype are :-
(i) Complete path is specified
int execl(const char * path, const char * arg0,const char * arg1,…,NULL);
(ii) If file is at one of default paths
int execlp(const char * file, const char * arg0,const char * arg1,…,NULL);
(iii) If arguments are given as an vector(array)
int execv(const char *path,char *const argv[]);
(iv) If arguments are given as an vector(array) and file is at one of default paths
int execvp(const char* file, char *const argv[]);
(v) int execle(const char *path, const char * arg0, const char * arg1,…,NULL, char *const envp[]);
(vi) int execve(const char *path, char *const argv[],char *const envp[] );

- The suffix p means to search PATH environmental variable.

- If the exec is executed successfully the statements after it will not be executed.
- It is because the current process is replaced.
- The arguments given to exec are used by main() function of new process as command line argument.
- If exec fails, it returns -1
- The open file descriptors remain open after the exec command.
- These file descriptors can be passed to exec as command and can be used by the replaced process to read/write from opened file.
- The argument is passed to exec as character.
- For this sprintf() is used.
- And for getting the file descriptors back , atoi() or integer typecasting can be used on the arguments of main().

Posted in Linux Internals and System Programming, Project 03: Client Server Communication using Linux and IPC | Tagged , , , , , , , | Leave a comment

Orphan Process

Orphan Process
===============
If in a process, the parent process is terminated before the child process, the child process become orphan
- It takes the lowest possible process as its parent
- And its PPID is changed to the PID of its new parent process.
- Mostly the new parent process in init process (PID = 1).
- It is because init adopts the orphan process.
- The child is then terminated normally by the init process.

Posted in Linux Internals and System Programming, Project 03: Client Server Communication using Linux and IPC | Tagged , , , , , | Leave a comment

Zombie or Defunct Process

Zombie or Defunct Process
==========================
If a child proces tries to teminate,its association with parent remains until the parent terminates normally or calls wait.
- The child process entry in process table is therfore not freed up immediately.
- Althougth the process is no longer active, the child remains still in system because its exit code is needed to be stored in case of parent subsequently

calls wait.
- The process becomes defunct or zombie process.
- It is shown by ‘Z’ or ‘Z+’ in process table.

- If the parent is terminated abnormally, the zombie child process will not be terminated (which is not good).

Posted in Linux Internals and System Programming, Project 03: Client Server Communication using Linux and IPC | Tagged , , , , , , | Leave a comment

waiting for a process

Waiting For a Process
=====================
- Sometime we would like to find out when a child process has finished.
- It is needed for parent process to wait until the child finishes before continuing by calling wait.
- It has prototype :
pid_t wait(int *stat_loc);
- It is declared in header :
#include<sys/wait.h>
- It has a return type pid_t which is declared in header :
#include<sys/types.h>
- The wait system call causes a parent process to pause until one of its child processes is stopped.
- The wait returns PID of child process which is terminated.
- The status information determine the exit status of child process (i.e  value returned from main or passed to exit)
- If stat_loc is not a null pointer, the status information will be written to location to which it points.
- The status information can be determined by using macros defined in header sys/wait.h

Macro                                        Defination
WIFEXITED(stat_val)          Nonzero if child terminated normally
WEXITSTATUS(stat_val)    If WIFEXITED is nonzero, this returns child exit code

WIFSIGNALED(stat_val)    Nonzero if child is terminated on an uncaught signal
WTERMSIG(stat_val)           If WIFSIGNALED is nonzero, this returns signal number

WIFSTOPPED(stat_val)       Nonzero if the child has stopped
WSTOPSIG(stat_val)            If WIFSTOPPED is nonzero, this returns signal number

- The wait() is used when a result of process done by child is used by the parent for further processing.
- For eg :-
In a program child process write to file1 and parent has to read from (the written data of)file1.
If the scheduler runs read() command of the parent process before the write() command of child process, it reads nothing.
- So, wait() is used before read() statement in parent process to avoid the unnecessory error.

Posted in Linux Internals and System Programming, Project 03: Client Server Communication using Linux and IPC | Tagged , , , , , | Leave a comment

Process Duplication using fork

Process Duplication using system call fork
==============================
- A new process is created using fork().
- fork() is a system call.
- fork duplicates the current process.
- It creates a new entry in the process table with many of same

attributes as current process.
- The new process (known as child process) is almost identical to

original process (known as parent process).
- PPID (Parent Process Identification) of new process is PID of

original process.
- PID (Process Identification) of new process is lowest PID

available after the PID of original process .Mostly it is 1 greater

than the original process(If available).
- Prototype of fork :-
pid_t fork(void);
- Function fork() is declared in header:
#include<unistd.h>
- It has a return type pid_t .
- System type pid_t is declared in header :
#include<sys/types.h>
- The Process counter of new process starts from fork() statement.
- So, fork() is executed twice.
- When fork() is executed by parent, it returns PID of child

process on success.
- When fork() is executed by child, it returns 0 for success.
- If fork fails, it returns -1.
- Falure may be due to :-
* Limit on the number of child processes that a parent may

have (CHILD_MAX), in which errno will be set to “EAGAIN”

* If process table or virtual memory is filled (not enough

space), errno variable will be set to “ENOMEM”.
- The return value of fork() can be used to determine whether child

or parent is executing.
- For eg. :-
#include<stdio.h>
#include<unistd.h>
#include<sys/types.h>
int main()
{
pid_t fret;
printf(“Only parent execute\n”);
fret = fork();//Fork statement
printf(“Both parent and child execute this statement.\n”);
switch(fork)
{
case -1 :
perror(“fork”);
exit(EXIT_FAILURE);
break;
case 0 :
printf(“Child executing\n”);
break;
default :
printf(“Parent executing\n”);
break;
}
return 0;
}

Posted in Linux Internals and System Programming, Project 03: Client Server Communication using Linux and IPC | Tagged , , , , | Leave a comment