11-21-2006
I don't think you'll be able to get the file name. As suggested above, you can get information about the file (with the fstat() function call), but that doesn't help you because it won't give you a name.
What it will give you, however, is the device and id information about where the file is stored. My guess is that this information should be sufficient to unlink the file from the file system, however, if you *really* need to do this you'll have to start looking for the source code to "unlink" for your system. Then you'll need to piece together an unlink that can take the data from a file handle rather than a file name, and this will certainly be non-portable.
Regardless, methinks this is a tough nut to crack without having the file name available to you when you want to delete it.
10 More Discussions You Might Find Interesting
1. UNIX for Advanced & Expert Users
How can I kill mount connection(NFS , made by automount) if remote filesystem is down?
I tried:
fuser -ku /auto
/auto:
umount /auto
nfs umount: ERROR: /auto is busy
If I try cd /auto - I get - /auto: Stale remote file handle.
I know that reboot will help but I cannot reboot this... (2 Replies)
Discussion started by: kazimir
2 Replies
2. UNIX for Advanced & Expert Users
Hi, I get an error saying "Stale NFS file handle"
how can I solve this? Is it possible to do this with a umount/ mount command? (5 Replies)
Discussion started by: rein
5 Replies
3. UNIX and Linux Applications
There are a filesystem /GWD/appbase/projects/GRIDDB
Under this filesystem there is a directory called backup.
But When I am trying to access the backup directory ,it is showing me the following error:
# cd /GWD/appbase/projects/GRIDDB
# cd backup
-bash: cd: backup: Stale NFS file handle
... (3 Replies)
Discussion started by: alphasahoo
3 Replies
4. Shell Programming and Scripting
I have a FILE a.txt which has the following data
113901.94,113901.94,56950.97,56950.97,NOT MATCHING,NOT MATCHING
10693.04,10693.04,5346.52,5346.52,NOT MATCHING,NOT MATCHING
1901.94,1901.94,550.97,550.97,NOT MATCHING,NOT MATCHING
103.04,103.04,53.52,53.52,NOT MATCHING,NOT MATCHING
#### This... (2 Replies)
Discussion started by: ksmbabu
2 Replies
5. Linux
Hello All,
I have a small question regarding the NFS file handles.
Suppose I have a NFS client who has requested for a particular file from the NFS server.Now lets assume that I am using a NFS v2 server. So I get the filehandle for that file and I can use it. Suppose later I upgrade the server to... (0 Replies)
Discussion started by: prathamesh
0 Replies
6. AIX
I need to change how a posting procedure currently works in order to improve load balancing but I am hitting a potential file contention problem that I was wondering if someone here could assist me with...
In a directory called FilePool I would have a bunch of files that are constantly coming in... (3 Replies)
Discussion started by: philplasma
3 Replies
7. Shell Programming and Scripting
Hi,
I want to write a shell script which handle an oracle alert log so that when it changes month, the script generates a new file with month in the filename.
Thanks in advance.
Leim (4 Replies)
Discussion started by: leim
4 Replies
8. Solaris
I know how to check if any file has a unix process using a file by looking at 'lsof <fullpath/filename>' command.
I think using lsof is very expensive. Also to make it accurate we need to inlcude fullpath of the file.
Is there another command that can tell if a file has a truely active... (12 Replies)
Discussion started by: kchinnam
12 Replies
9. UNIX for Advanced & Expert Users
Hi Experts,
Any idea how to decode file handle in HP-UX? I am getting the following error continously in my HP-UX 11.31 box :mad:
Apr 26 07:15:00 host62 su: + tty?? root-bb
Apr 26 07:15:00 host62 su: + tty?? root-abcadm
Apr 26 07:15:01 host62 vmunix: NFS write error on host peq9vs:... (1 Reply)
Discussion started by: vipinable
1 Replies
10. UNIX for Dummies Questions & Answers
This question might be silly but its confusing me a bit:
What is the difference between handle to the thread HANDLE and thread identifier pthread_t?
---------- Post updated at 01:52 PM ---------- Previous update was at 01:48 PM ----------
Sorry I saw details and HANDLE is in windows and... (0 Replies)
Discussion started by: rupeshkp728
0 Replies
close(n) Tcl Built-In Commands close(n)
__________________________________________________________________________________________________________________________________________________
NAME
close - Close an open channel
SYNOPSIS
close channelId
_________________________________________________________________
DESCRIPTION
Closes the channel given by channelId.
ChannelId must be an identifier for an open channel such as a Tcl standard channel (stdin, stdout, or stderr), the return value from an
invocation of open or socket, or the result of a channel creation command provided by a Tcl extension.
All buffered output is flushed to the channel's output device, any buffered input is discarded, the underlying file or device is closed,
and channelId becomes unavailable for use.
If the channel is blocking, the command does not return until all output is flushed. If the channel is nonblocking and there is unflushed
output, the channel remains open and the command returns immediately; output will be flushed in the background and the channel will be
closed when all the flushing is complete.
If channelId is a blocking channel for a command pipeline then close waits for the child processes to complete.
If the channel is shared between interpreters, then close makes channelId unavailable in the invoking interpreter but has no other effect
until all of the sharing interpreters have closed the channel. When the last interpreter in which the channel is registered invokes close,
the cleanup actions described above occur. See the interp command for a description of channel sharing.
Channels are automatically closed when an interpreter is destroyed and when the process exits. Channels are switched to blocking mode, to
ensure that all output is correctly flushed before the process exits.
The command returns an empty string, and may generate an error if an error occurs while flushing output. If a command in a command pipe-
line created with open returns an error, close generates an error (similar to the exec command.)
EXAMPLE
This illustrates how you can use Tcl to ensure that files get closed even when errors happen by combining catch, close and return:
proc withOpenFile {filename channelVar script} {
upvar 1 $channelVar chan
set chan [open $filename]
catch {
uplevel 1 $script
} result options
close $chan
return -options $options $result
}
SEE ALSO
file(n), open(n), socket(n), eof(n), Tcl_StandardChannels(3)
KEYWORDS
blocking, channel, close, nonblocking
Tcl 7.5 close(n)