The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Differentiate Soft and Hard Link balu_solaris UNIX for Dummies Questions & Answers 2 07-18-2007 11:41 PM
problem with device file sameer017 UNIX for Advanced & Expert Users 1 01-26-2007 05:17 PM
how to differentiate a file from a folder in a FIND? denysQC UNIX for Dummies Questions & Answers 3 06-06-2006 03:02 PM
How to Differentiate Between Files and Folders? dgower2 UNIX for Dummies Questions & Answers 6 04-28-2006 09:10 AM
Is it possible to ufsdump to a file instead of a tape device? PSC UNIX for Dummies Questions & Answers 8 07-21-2004 10:08 AM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 05-29-2008
Registered User
 

Join Date: May 2008
Posts: 4
differentiate between a file and a device

sorry probably a beginner question but i was just wondering how unix does this as device are treated as files?
Reply With Quote
Forum Sponsor
  #2  
Old 05-29-2008
Registered User
 

Join Date: May 2008
Posts: 6
As far as I know, they may be files, but they aren't *regular* files.

But in any case, do you want to understand the inner workings of the operating system just to satisfy your curiosity, or do you actually have a practical problem to which the understanding of this may come in handy?
Reply With Quote
  #3  
Old 05-29-2008
Registered User
 

Join Date: May 2008
Posts: 4
well i have a operating systems module at uni and i noticed this question in an old exam paper and cant find an answer to it anywhere. i thought it might have something to do with the arguments that open the file/device maybe.
Reply With Quote
  #4  
Old 05-29-2008
Registered User
 

Join Date: Mar 2008
Location: /bin/sh
Posts: 352
The very first thing to understand is that these files are NOT the drivers for the devices. Drivers are in the kernel itself (/unix or /xenix or /stand/unix), and the files in /dev do not actually contain anything at all: they are just pointers to where the driver code can be found in the kernel. There is nothing more to it than that. These aren't programs, they aren't drivers, they are just pointers.

That also means that if the device file points at code that isn't in the kernel, it obviously is not going to work. Existence of a device file does not necessarily mean that the device code is in the kernel, and creating a device file (with mknod) does NOT create kernel code.
Reply With Quote
  #5  
Old 06-01-2008
Registered User
 

Join Date: May 2008
Posts: 4
well i found a multiple choice question for this.

Which one of the following allows the Unix version 6 system to differentiate between a file and a device?

a) the arguements to the system call that opens the file or device
b) the mode bits within the inode indetified by the system call
c) the directory entry for the file or device
d) the pathname for the file or device

any thoughts?
Reply With Quote
  #6  
Old 06-01-2008
Perderabo's Avatar
Unix Daemon
 

Join Date: Aug 2001
Location: Washington DC Area
Posts: 8,667
Version 6?!? That is a very old exam you have there. I'm guessing '85 or so.

The answer is b, the mode bits. For a complete explanation see: Unix File Permissions

But in that link, I use the term "block special" and "character special" for what you are collectively calling "device file".
Reply With Quote
  #7  
Old 06-01-2008
Registered User
 

Join Date: May 2008
Posts: 4
Well its basic OS stuff so i guess they just chose whatever they thought would be easiest to teach with, who knows!
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 07:51 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0