| T.R | Title | User | Personal Name
 | Date | Lines | 
|---|
| 9912.1 | smmap() in bsd/kern_mman.c | RHETT::PARKER |  | Wed May 21 1997 15:26 | 10 | 
|  |     
    Hi, John.
    
    It's in kern_mman.c and it's smmap(). Now, I hope you don't have
    a lot more questions about it because I'm not an expert! :-)
    
    Hope this helps!
    
    Lee
    
 | 
| 9912.2 | Thanx. | NNTPD::"[email protected]" | John McDonald | Wed May 21 1997 15:49 | 8 | 
|  | thanx, Lee - I should have asked you first!
Actually, do you know how the mmap() in the libc gets xlated into
smmap()? It's not a big deal, but I hate not knowing.
John
[Posted by WWW Notes gateway]
 | 
| 9912.3 | First guess :-) | RHETT::PARKER |  | Wed May 21 1997 16:11 | 28 | 
|  |     
    Hi, John. 
    
    Well, I think it switches through spec_vnops.c - the spec_mmap()
    routine. Since it could be a driver's mmap instead of the
    sysdev_mmap().
    
    From vfs/spec_vnops.c :
    
    spec_mmap(register struct vnode *vp,
    
    ....
    
            if (vp->v_type != VCHR) return ENODEV;
            ap->a_mapfunc = cdevsw[major(vp->v_rdev)].d_mmap;
    
    If it's the system call (not a driver's mmap rtn) it will find :
    
    { sysdev_open,  sysdev_close,   nodev,          nodev,      /*15*/
            nodev,          nodev,          nulldev,        0,
            nodev,          sysdev_mmap,    DEV_FUNNEL_NULL, NULL, NULL },
     
    in cdevsw[] / devsw[] or something like that. I'm sure someone will
    correct me if I'm a little off here! ;-)
    
    Hope this helps!
    
    Lee
 | 
| 9912.4 | I forgot the first part | RHETT::PARKER |  | Wed May 21 1997 17:09 | 13 | 
|  |     
    Hi, John.
    
    I looked into it a little more - since it's a syscall, # 71, it
    switches through the syscall_sw.c & syscall_subr.c - routine
    map_fd(), which winds up calling smmap(). This happens before
    the htg(honest to god)_unix_syscall() stuff. That's about as far
    as I can (wanna) take it! :-) htg
    
    Hth, 
    
    Lee
    
 | 
| 9912.5 |  | SMURF::SCOTT |  | Wed May 21 1997 18:23 | 14 | 
|  | Perhaps this will help. 
Your mmap call gets translated in libc to SYS_mmap, which is 71.  The 71st
entry in the syscall table references the function which is actually named
"smmap".  (See init_sysent.c, which is a file generated at kernel build
time, based on syscalls.master.)
  (dbx) sysent[71].sy_call/i
    [smmap:590, 0xfffffc0000262ef0]       lda     r16, 16383(r31)
The entries in syscall_sw.c are actually for mach traps.
Hope this helps.
 | 
| 9912.6 | Crystal clear now! | RHETT::PARKER |  | Thu May 22 1997 09:16 | 23 | 
|  |     
    Thanks Larry, that does help clear it up for me at least. I was
    kinda fuzzy on the syscall switch stuff and the mach factor makes
    it a little harder to follow. 
    
    I also didn't know that the init_sysent.c gets generated at build
    time based on syscalls.master - cool!
    
    Should have looked at the Makefile :
    
    init_sysent.c syscalls.c syscall.h: conf/makesyscalls.ksh \
                    conf/syscalls.master
            ksh conf/makesyscalls.ksh \
                    -hk . conf/syscalls.master
            rm -f ../include/sys/syscall.h
            mv ./syscall.h ../include/sys/syscall.h
    
    That's really good to know.
    
    Thanks, 
    
    Lee
    
 | 
| 9912.7 | Thanx... | NNTPD::"[email protected]" | John McDonald | Thu May 22 1997 13:11 | 7 | 
|  | Thanx for all of the info. It's been a while and the system call
switching completely slipped my mind. Thanx for all the info.
John McDonald
Atlanta CSC
[Posted by WWW Notes gateway]
 |