LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 03-01-2006, 08:58 AM   #1
kshkid
Member
 
Registered: Dec 2005
Distribution: RHEL3, FC3
Posts: 383

Rep: Reputation: 30
File Descriptor 63


Hi All,

When going through the VFS /proc in Solaris,

i noticed the following files for each of the login which spawned a shell($$)

/proc/$$/fd/ - dir

i could notice the file /proc/$$/fd/63 which acts as a exact replica of the .sh_history in $HOME directory.

Why two files are maintained?

Though with enough permissions i couldnt change the permissions set for the file-63.

Has the above file got any other significance in VFS.

Thanks
 
Old 03-01-2006, 09:55 AM   #2
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris 11.4, Oracle Linux, Mint, Debian/WSL
Posts: 9,789

Rep: Reputation: 492Reputation: 492Reputation: 492Reputation: 492Reputation: 492
Quote:
Originally Posted by kshkid
Hi All,

When going through the VFS /proc in Solaris,

i noticed the following files for each of the login which spawned a shell($$)

/proc/$$/fd/ - dir

i could notice the file /proc/$$/fd/63 which acts as a exact replica of the .sh_history in $HOME directory.

Why two files are maintained?
There aren't two files but a single one.

/proc/$$/fd/63 is representing file descriptor 63 which happens to be .sh_history, as the korn shell keep this file open.

"man -s 4 proc" for details
 
Old 03-02-2006, 12:49 AM   #3
kshkid
Member
 
Registered: Dec 2005
Distribution: RHEL3, FC3
Posts: 383

Original Poster
Rep: Reputation: 30
That was gr8, amazing.

One more to go with as an addition.

So the .sh_history file as that many file descriptors pointing to it .. as that many logins are invoked from the same user with common HOME directory.

the file-63 is under the control of the user, but we are unable to change the permissions of the file.
Why is that so?
 
Old 03-02-2006, 11:41 AM   #4
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris 11.4, Oracle Linux, Mint, Debian/WSL
Posts: 9,789

Rep: Reputation: 492Reputation: 492Reputation: 492Reputation: 492Reputation: 492
Yes, the history file is, by default, shared between every sessions open by the same user. This is a korn shell feature, and it's often convenient to be able to replay a command picked from the history coming from a different window than the one which first fire it.

Why do you want to change this file's permissions ?

If you really want to, which you shouldn't, do it on the user home directory, the /proc is not there to allow you doing that so chmod isn't implemented for the proc filesystem.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Get the absolute path of file using file descriptor. appas Programming 7 01-19-2012 11:47 AM
File Descriptor Limit rbd Linux - General 3 10-11-2004 01:57 PM
apt-file returns nothing; 'bad file descriptor' overbored Debian 3 10-03-2004 09:13 PM
[c++] How can I get a file descriptor from a c++ i/o stream? chuanyung Programming 8 03-08-2004 11:23 PM
File descriptor lido Linux - Newbie 5 07-17-2003 11:58 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 08:54 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration