Sponsored Content
Top Forums UNIX for Advanced & Expert Users Close file descriptor without terminating process Post 302663271 by nitj on Wednesday 27th of June 2012 10:42:43 PM
Old 06-27-2012
Close file descriptor without terminating process

Can any help me in finding the way to close opened file descriptor in Solaris ,without killing process. As accidently a file was removed which was opened by a process.

Much thanks in advance Smilie
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Should a UNIX daemon process close open fds?

I have a UNIX daemon process that's been started by a parent process, an application server. The behavior of this daemon process is to inherit and use the app server's file descriptors (ports/sockets). When I shutdown the app server, the daemon continues to run, because there may be other... (1 Reply)
Discussion started by: kunalashar
1 Replies

2. UNIX for Dummies Questions & Answers

File Descriptor Help

What is a file descriptor in Unix?? How to find a file descriptor of a file in Unix?? Does it have anything to do with the Inode numbers?? (3 Replies)
Discussion started by: rahulrathod
3 Replies

3. UNIX for Dummies Questions & Answers

Terminating child script with terminating the parent script

Hi I was working on a shell script with randomly shows a page of text from a randomly selected topic .As soon as the page is displayed it callers a timer script which keeps on running indefinitely until the timer script is killed by the user. This is where I have the problem,if I press... (2 Replies)
Discussion started by: mervin2006
2 Replies

4. Shell Programming and Scripting

How can i terminating expect script without terminating SSH connection.

Hi all , i know i ask a lot of question but these are really hard to solve and important question. I send two scripts: expect.sh: #!/usr/local/bin/expect spawn ssh root@172.30.64.163 expect "login:" send "root\n" expect "password:" send "root\n^M" interact and son.sh: ... (2 Replies)
Discussion started by: fozay
2 Replies

5. Solaris

file open/read/write/close/access by process

Hi want to know what file (descriptor+filename+socket) is being accessed by particular process on solaris. Purpose : while running perf. test, needs to find where is the bottleneck. We are providing concurrnet load for around 1 hr and needs to capture data related to file usage pattern... (1 Reply)
Discussion started by: raxitsheth
1 Replies

6. Shell Programming and Scripting

Usage of NOHUP - How to keep the child process running even if I close the Server connection

Hi. ! When I use the 'NOHUP' along with the '&', the process will be running in the background. Even when I attempt to close (Meaning 'EXIT') the session (say PUTTY in this case), it wont exit unless the process is completed. But, say when I forcefully terminate the session (SHUT DOWN the... (2 Replies)
Discussion started by: WinBarani
2 Replies

7. Programming

when parent process close, how to close the child?

can someone provide an example, where if the parent process quits for any reason, then the child process will also close? (3 Replies)
Discussion started by: omega666
3 Replies

8. AIX

AIX6.1 Remove file descriptor from specified process

Hi, How to release file description area from specified process. Problem is that process started - open one file ( ~2GB ) - file has been removed - process still shown that file is used by process and can't release space on filesystem. It is not allowable to kill process !!! Regs,... (3 Replies)
Discussion started by: KrzysiekPi
3 Replies

9. UNIX for Advanced & Expert Users

Dup2 - for file descriptor opened by a different process

is it possible to duplicate file descriptors(opened by a different process) with the help of dup or dup2. the two process do not share parent child relationship as well. (2 Replies)
Discussion started by: replytoshishir
2 Replies

10. Shell Programming and Scripting

Terminating a process - is this code best practice?

Hi Folks - I am building a process to kill a list of services. Sometimes, there's a service that hangs therefore I need to add an additionla peice of code to kill all instances of a service if it exists. Here is that portion of code: echo... (10 Replies)
Discussion started by: SIMMS7400
10 Replies
POSIX_SPAWN_FILE_ACTIONS_ADDOPEN(3)			   BSD Library Functions Manual 		       POSIX_SPAWN_FILE_ACTIONS_ADDOPEN(3)

NAME
posix_spawn_file_actions_addopen, posix_spawn_file_actions_adddup2, posix_spawn_file_actions_addclose -- add open, dup2 or close action to spawn file actions object LIBRARY
Standard C Library (libc, -lc) SYNOPSIS
#include <spawn.h> int posix_spawn_file_actions_addopen(posix_spawn_file_actions_t * file_actions, int fildes, const char *restrict path, int oflag, mode_t mode); int posix_spawn_file_actions_adddup2(posix_spawn_file_actions_t * file_actions, int fildes, int newfildes); int posix_spawn_file_actions_addclose(posix_spawn_file_actions_t * file_actions, int fildes); DESCRIPTION
These functions add an open, dup2 or close action to a spawn file actions object. A spawn file actions object is of type posix_spawn_file_actions_t (defined in <spawn.h>) and is used to specify a series of actions to be performed by a posix_spawn() or posix_spawnp() operation in order to arrive at the set of open file descriptors for the child process given the set of open file descriptors of the parent. A spawn file actions object, when passed to posix_spawn() or posix_spawnp(), specify how the set of open file descriptors in the calling process is transformed into a set of potentially open file descriptors for the spawned process. This transformation is as if the specified sequence of actions was performed exactly once, in the context of the spawned process (prior to execution of the new process image), in the order in which the actions were added to the object; additionally, when the new process image is executed, any file descriptor (from this new set) which has its FD_CLOEXEC flag set is closed (see posix_spawn()). The posix_spawn_file_actions_addopen() function adds an open action to the object referenced by file_actions that causes the file named by path to be opened (as if open(path, oflag, mode) had been called, and the returned file descriptor, if not fildes, had been changed to fildes) when a new process is spawned using this file actions object. If fildes was already an open file descriptor, it is closed before the new file is opened. The string described by path is copied by the posix_spawn_file_actions_addopen() function. The posix_spawn_file_actions_adddup2() function adds a dup2 action to the object referenced by file_actions that causes the file descriptor fildes to be duplicated as newfildes (as if dup2(fildes, newfildes) had been called) when a new process is spawned using this file actions object. The posix_spawn_file_actions_addclose() function adds a close action to the object referenced by file_actions that causes the file descriptor fildes to be closed (as if close(fildes) had been called) when a new process is spawned using this file actions object. RETURN VALUES
Upon successful completion, these functions return zero; otherwise, an error number is returned to indicate the error. ERRORS
These functions fail if: [EINVAL] The value specified by file_actions is invalid. [EBADF] The value specified by fildes or newfildes is negative. [ENOMEM] Insufficient memory exists to add to the spawn file actions object. SEE ALSO
close(2), dup2(2), open(2), posix_spawn(3), posix_spawn_file_actions_destroy(3), posix_spawn_file_actions_init(3), posix_spawnp(3) STANDARDS
The posix_spawn_file_actions_addopen(), posix_spawn_file_actions_adddup2() and posix_spawn_file_actions_addclose() functions conform to IEEE Std 1003.1-2001 (``POSIX.1''). HISTORY
The posix_spawn_file_actions_addopen(), posix_spawn_file_actions_adddup2() and posix_spawn_file_actions_addclose() functions first appeared in FreeBSD 8.0 and imported for NetBSD 6. AUTHORS
Ed Schouten <ed@FreeBSD.org> BSD
December 20, 2011 BSD
All times are GMT -4. The time now is 02:55 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy