QNX RTOS v4 Knowledge Base
  
QNX RTOS v4 Knowledge Base
  
    
      | 
          
            | Title | How do I know where my executables are being loaded from? |  
            | Ref. No. | QNX.000009305 |  
            | Category(ies) | Network, Development, Configuration |  
            | Issue | I find my networked filesystem so transparent that sometimes I'm not even sure where executables are being loaded from! How do I get a better sense of where things are? 
 |  
            | Solution | The fsys_get_mount dev() function returns the physical device that a file resides on. Using this function, I've created my own whereis utility. For example, if you typed whereis /usr/spool, you'd see output similar to: 
 x09/usr/spool is on //18/dev/hd0t77
 
 and if you typed whereis 'which windows' you'd see output similar to:
 
 x09/usr/bin/windows is on //107/dev/hd0t77
 
 x09If you use this command in conjunction with mountlist, you can find out where everything is. For example, if you typed mountlist -n107, you'd see:
 
 x09/dev/hd0t77 mounted as //107/
 
 Here's the source for whereis:
 
 //whereis.c
 
 #include <stdio.h>
 #include <limits.h>
 #include <sys/fsys.h>
 
 main( int argc, char *argv[] ){
 x09char buffer[ _POSIX_NAME_MAX ];
 x09x09if ( fsys_get_mount_dev ( argv[1], buffer ) == 0 )
 x09x09printf ( "%s is on %sn", argv[1], buffer );
 
 x09else
 x09// couldn't resolve ( file/dir doesn't exit, or nonroot mountpoint )
 x09printf ( "don't know... try mountlistn");
 }
 |  |