EmbLogic's Blog

algo for open function

1: define a local device.

2: fetch minor no.

2.a: check for errors.

3: assign previously allocated scull_dev to a local scull_dev.

3.a: check for errors.

3.b: cleanup_module();(if minor no. is wrong)

4: check file open in write mode by && O_ACCMOD with flags.

4.a: truncate the file.

5: preserve the local device into scull_dev.

4 Comments

device driver

today i have done initialising the driver in device driver then i faced a problem in that. in the init_module ,i had not returnned the value beacuse of this on inserting using insmod it will be hanged and the kernel is waiting for the action of module.due to this problem, cntrl+c,cntrl+z were not working n i had to restart my system again n again.

Posted in Uncategorized | Leave a comment

Pseudo driver 2.4 kernel

Starting to write Pseudo Driver using 2.4 kernel ?

Any doughts Please let me know

7 Comments

Read Write driver

Application program for read/write

#include<stdio.h>
#include<fcntl.h>       // For open()
#include<unistd.h>      // For read()
#include<string.h>

int main(int charc, char * argv[])
{
int fd;
char wbuf[40];
char rbuf[40];
ssize_t rd,wr;

strcpy(wbuf,”HELLO KERNEL!!\n”);
strcpy(rbuf,””);
fd = open(argv[1], O_RDWR);
printf(“File Descp. = %d\n”,fd);

wr = write(fd, wbuf, sizeof (wbuf));
printf(“\nData in file is: \n%s\n”,wbuf);

fd = open(argv[1], O_RDWR);
printf(“File Descp. = %d\n”,fd);

rd = read(fd, rbuf, sizeof (rbuf));
printf(“\nrd = %d \n”, rd);
printf(“%s\n”, rbuf);

close(fd);
printf(“File closed”);
return 0;

}

3 Comments

scull

structure of scull is complete..

trying to work on the function recursion part.

Posted in Uncategorized | Leave a comment

Device Driver : Initial Stage

We just used two command “insmod” and “rmmod” to insert and remove the module from the Kernel.

And We also make some Pseudo programs for 2.4 and 2.6 compatible kernels.

What is the benefit of making some program using 2.6 version over 2.4 version and Vice Versa ?

And why we have to study 2.4v program while 2.6v program are more efficient in terms of memory management ???

Posted in Uncategorized | 6 Comments

Atten : Device Driver

Classes of Device Driver will be start on Thursday onwards,

so be there at right time and be regular ….

Posted in Uncategorized | Leave a comment

Client Server using MQ/Semaphores

Posted in Uncategorized | 1 Comment

Poll

Applications that use nonblocking I/O often use the poll, select, and epoll system
calls as well. poll, select, and epoll have essentially the same functionality .each allow
a process to determine whether it can read from or write to one or more open files
without blocking.

Support for any of these calls requires support from the device driver. This support
(for all three calls) is provided through the driver’s poll method. This method has the
following prototype:
unsigned int (*poll) (struct file *filp, poll_table *wait);
The driver method is called whenever the user-space program performs a poll, select,
or epoll system call involving a file descriptor associated with the driver. The device
method is in charge of these two steps:
1. Call poll_wait on one or more wait queues that could indicate a change in the
poll status. If no file descriptors are currently available for I/O, the kernel causes
the process to wait on the wait queues for all file descriptors passed to the sys-
tem call.
2. Return a bit mask describing the operations (if any) that could be immediately
performed without blocking.

Posted in Uncategorized | Leave a comment

Scullpipe

The scullpipe driver is a special form of scull that implements a pipe-like device.

Within a driver, a process blocked in a read call is awakened when data arrives,usu-
ally the hardware issues an interrupt to signal such an event, and the driver awakens
waiting processes as part of handling the interrupt. The scullpipe driver works differ-
ently, so that it can be run without requiring any particular hardware or an interrupt
handler. We chose to use another process to generate the data and wake the reading
process .similarly, reading processes are used to wake writer processes that are wait-
ing for buffer space to become available.

Posted in Uncategorized | Leave a comment

Client Server using fifo

Please give the updates

Posted in Uncategorized | 3 Comments

8051?

8051 has 40 pins on DIP,yet the comparison with z80 microprocessor shows the 8051 has 58 pins function?

Posted in Uncategorized | 2 Comments

Capabilities

Unix systems have traditionally restricted privileged operations to the superuser
account. This meant that privilege was an all-or-nothing thing—the superuser can do
absolutely anything, but all other users are highly restricted. The Linux kernel pro-
vides a more flexible system called capabilities. A capability-based system leaves the
all-or-nothing mode behind and breaks down privileged operations into separate
subgroups. In this way, a particular user (or program) can be empowered to perform
a specific privileged operation without giving away the ability to perform other, unre-
lated operations. The kernel uses capabilities exclusively for permissions manage-
ment and exports two system calls capget and capset, to allow them to be managed
from user space.

Posted in Uncategorized | Leave a comment

Client Server using Pipes

Any updates for client server application using pipes

Posted in Uncategorized | 13 Comments

what is sigpending?

sigpending(sigset_t *set);

sigpending examines that the signals are blocked or pending.

it returns the set of signals  that are pending for delivery to the calling process  i.e.  the siganls while have been raised while blocked. This set of signals are fetched from “sa_mask”.By masking  we set the signals for blocking .

Posted in Uncategorized | Leave a comment