Sponsored Content
Full Discussion: Entry Points Routine
Top Forums Programming Entry Points Routine Post 29783 by Perderabo on Friday 11th of October 2002 09:00:53 AM
Old 10-11-2002
Quote:
Originally posted by S.P.Prasad
I just cannot figure it out then why,as I have stated "The declaration within the table contains information in the structure "see dev switch" has a member variable of type pointer to struct streamtab.
As far as I know, it doesn't; and you are in error if you think it does. Here is cdevsw from HP-UX 11.0:
Code:
 
/*
 * Character device switch.
 */
struct cdevsw
{
        d_open_t        d_open;
        d_close_t       d_close;
        d_read_t        d_read;
        d_write_t       d_write;
        d_ioctl_t       d_ioctl;
        d_select_t      d_select;
        d_option1_t     d_option1;
        int             d_flags;       /* C_MGR_IS_MP is valid for this field */
        void            *d_drv_info;
        pfilter_t       *d_pfilter_s;
        aio_ops_t       *d_aio_ops;
};

To use d_read as an example, The type of d_read is:
typedef int (*d_read_t) __((dev_t dev, struct uio *uio));
And that typedef does not magically change into a pointer to a qinit structure if the current entry happens to be a streams based driver. Any time the read or readv system call invokes the read routine of a character driver, that read routine is passed a device and a uio structure. Every read of a character device is treated this way. No there no exception for streams-based character drivers.

The cdevsw for osf1 is similiar but with much less type checking:
Code:
struct cdevsw
{
        int     (*d_open)();
        int     (*d_close)();
        int     (*d_read)();
        int     (*d_write)();
        int     (*d_ioctl)();
        int     (*d_stop)();
        int     (*d_reset)();
        struct tty *d_ttys;
        int     (*d_select)();
        int     (*d_mmap)();
        int     d_funnel;       /* serial code compatibility */
        int     (*d_segmap)();          /* xxx_segmap() entry point */
        int     d_flags;                /* if (C_DDIDKI), driver follows
                                           SVR4 DDI/DKI interfaces*/
};

Without strong typechecking it's hard to prove exactly what d_read is. But that DDI/DKI stands for Device Driver Interface/Driver Kernel Interface. You can be sure that a system that supports that standard is not going to turn d_read into a pointer to a qinit structure.

If you post again claiming that your cdevsw has pointers to qinit (or other stream) structures, please also post some evidence as well. I would also like to know which stream structure you think that your d_ioctl points to.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

sub routine call

in windows machine... C:\2\test>perl -version This is perl, v5.6.1 built for MSWin32-x86-multi-thread (with 1 registered patch, see perl -V for more detail) ------------------------------------------ what is the difference b\w subroutine calls: sub_routine_name("-----"); and ... (2 Replies)
Discussion started by: sekar sundaram
2 Replies

2. UNIX and Linux Applications

Gnuplot question: how to plot 3D points as colored points in map view?

I have a simple gnuplot question. I have a set of points (list of x,y,z values; irregularly spaced, i.e. no grid) that I want to plot. I want the plot to look like this: - points in map view (no 3D view) - color of each point should depend on its z-value. - I want to define my own color scale -... (0 Replies)
Discussion started by: karman
0 Replies

3. UNIX for Advanced & Expert Users

how to cp files to dir,using routine?

hi all, I wanted to know how we can copy files to dirs, through a routine and when the file and the dir are specified as parameters for that routine and explicitly called? Eg: suppose i want to copy file1 to /tmp then myproc() { . . } myproc /path/file1 /tmp/ These parameters when... (1 Reply)
Discussion started by: wrapster
1 Replies

4. Shell Programming and Scripting

how to cp files to dir,using routine?

hi all, I wanted to know how we can copy files to dirs, through a routine and when the file and the dir are specified as parameters for that routine and explicitly called? Eg: suppose i want to copy file1 to /tmp then myproc() { . . } myproc /path/file1 /tmp/ These parameters when... (4 Replies)
Discussion started by: wrapster
4 Replies

5. Shell Programming and Scripting

File exists routine

Hello experts, I need some help here.. I've written the following routine to check for existence of files. The routine does the following. It will look for a compressed ( .Z ) file and if it exists, then it will uncompress it, if it is already uncompressed, then it will just diplay a message... (9 Replies)
Discussion started by: kamathg
9 Replies

6. Shell Programming and Scripting

awk routine help

Hi, I use awk but not as a programming language. Just generally in piplelines to split things out by fields. I am trying to accomplish this one thing that I think a short awk routine would do great for, but can't figure it out. Lets say I have a file that contains database columns. The file... (25 Replies)
Discussion started by: fwellers
25 Replies

7. Shell Programming and Scripting

Do not find the mistake in a small routine!!!

Have a textfile (regular updated) with informations about datafiles . Each line is describing a datafile. Now I am trying to delete several specific lines in this textfile, which are defined before in a kind of removal list. Can not find the mistake I have done in the script because in the... (5 Replies)
Discussion started by: jurgen
5 Replies

8. How to Post in the The UNIX and Linux Forums

Help me, write a bash script to delete parent entry with all their child entry in LDAP UNIX server

Hi All, Please help me and guide me to write a bash/shell script on Linux box to delete parent entry with all their child entries. example: Parent is : ---------- dn: email=yogesh.kumar@wipro.com, o=wipro, o=in child is: ---------- dn: cn: yogesh kumar, email=yogesh.kumar@wipro.com,... (1 Reply)
Discussion started by: Chand
1 Replies

9. Shell Programming and Scripting

Trying to Parse An Inherited Command/Routine

I am am one of these people that it isn't good enough just to say, "Here, try this...". it is important for me to understand how and why something works (or doesn't work.) All that being said, I am trying to parse out a command that we use that was handed down to me by someone I can no longer... (3 Replies)
Discussion started by: he204035
3 Replies

10. Shell Programming and Scripting

How to replace multiple "&nbsp;" entry with in <td> tag into single entry using sed?

I have the input file like this. Input file: 12.txt 1) There are one or more than one <tr> tags in same line. 2) Some tr tags may have one <td> or more tna one <td> tags within it. 3) Few <td> tags having "<td> &nbsp; </td>". Few having more than one "&nbsp;" entry in it. <tr> some td... (4 Replies)
Discussion started by: thomasraj87
4 Replies
strategy(9E)							Driver Entry Points						      strategy(9E)

NAME
strategy - perform block I/O SYNOPSIS
#include <sys/types.h> #include <sys/buf.h> #include <sys/ddi.h> #include <sys/sunddi.h> int prefixstrategy(struct buf *bp); INTERFACE LEVEL
Architecture independent level 1 (DDI/DKI). This entry point is required for block devices. PARAMETERS
bp Pointer to the buf(9S) structure. DESCRIPTION
The strategy() routine is called indirectly (through cb_ops(9S)) by the kernel to read and write blocks of data on the block device. strat- egy() may also be called directly or indirectly to support the raw character interface of a block device (read(9E), write(9E) and ioctl(9E)). The strategy() routine's responsibility is to set up and initiate the transfer. In general, strategy() should not block. It can, however, perform a kmem_cache_alloc(9F) with both the KM_PUSHPAGE and KM_SLEEP flags set, which might block, without causing deadlock in low memory situations. RETURN VALUES
The strategy() function must return 0. On an error condition, it should call bioerror(9f) to set b_flags to the proper error code, and call biodone(9f). Note that a partial transfer is not considered to be an error. SEE ALSO
ioctl(9E), read(9E), write(9E), biodone(9F), bioerror(9F), buf(9S), cb_ops(9S), kmem_cache_alloc(9F) Writing Device Drivers SunOS 5.10 6 Nov 2003 strategy(9E)
All times are GMT -4. The time now is 08:04 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy