09-23-2011
are you trying to close a file descriptor of another process?
10 More Discussions You Might Find Interesting
1. Cybersecurity
/* Linux Slackware */
Nmap shows the following ports open on the gateway.
21/tcp ftp
22/tcp ssh
23/tcp telnet
25/tcp smtp
37/tcp time
80/tcp http
113/tcp auth
515/tcp printer
587/tcp submission
1024/tcp kdm
6000/tcp x11
-------------------------------
i would like to close as... (10 Replies)
Discussion started by: LowOrderBit
10 Replies
2. UNIX for Advanced & Expert Users
I have set the maximum no of file descriptors open in a process to the value 8192 using the following lines
set rlim_fd_max=8192
set rlim_fd_cur=8192
in the /etc/system file.
I rebooted the machine and the command ulimit -n / -Hn both display the limits as 8192. However when I run my... (2 Replies)
Discussion started by: lakshmankumar12
2 Replies
3. Cybersecurity
Hi!
I've a Java socket server program that is listening for requests, and using netstat, I can see that the connection is already open.
However as the process name (from ps -ef) is very long and I can't grep the program name. Can anyone advise how I find out the PID of the process? Can... (5 Replies)
Discussion started by: swing
5 Replies
4. Red Hat
hi,
i hav a query abt reading the contents of /proc/pid/maps file.is there any system apis or functions available to get the data from dat file and parse according to my need. i need name of the .so,Create date of the .so file.,Location of .so file etc.
please provide a good source.
yes i hav... (3 Replies)
Discussion started by: sanjaykhuntia
3 Replies
5. Shell Programming and Scripting
Below is a test script to illustrate a problem from a larger script I am writing.
$ cat /tmp/loggingtest
#!/bin/bash
lvcreate -s -l 100%FREE -n var-data-snapshot vg00/var-data 2> >(logger -t "loggingtest.crit") 1> >(logger -t "loggingtest.info")
sync &
wait
lvremove -f... (1 Reply)
Discussion started by: jelloir
1 Replies
6. Shell Programming and Scripting
i have a text file i.e file1.txt which shows open ports on particular system. i have another text file i.e file2.txt which shows a list of allowed ports on a system. for eg:
file2.txt
22/tcp ssh
23/tcp telnet.
can i have a script which would compare these text files ,file1 and file2 ... (1 Reply)
Discussion started by: anand121
1 Replies
7. Shell Programming and Scripting
Hi all,
I'm reading <advanced bash scripting> and there is a example to kill a background process in a limited time,as shown below:
#! /bin/bash
#set -n
TIMEOUT=$1
count=0
hanging_jobs & {
while ((count < TIMEOUT));do
eval ' && ((count = TIMEOUT))'
((count++))
sleep 1... (6 Replies)
Discussion started by: homeboy
6 Replies
8. UNIX for Dummies Questions & Answers
I think the libc.so is shared between processes, because it is a shared library and OS is engaged for saving memory.
But, below, the maps of bash, shows r-xp and r--p rw-p attributes to libc.so which mean private memory space.
Can anybody explain this for me?
:)cat /proc/$$/maps... (4 Replies)
Discussion started by: vistastar
4 Replies
9. Solaris
Hello all,
I have been tasked with finding the current open file descriptors versus the limit set. In Linux, this can be done like so:
cat /proc/sys/fs/file-nr
3391 969 52427
| | |
| | |
| | maximum open file descriptors
| total free allocated... (2 Replies)
Discussion started by: LinuxRacr
2 Replies
10. Shell Programming and Scripting
Hi all,
I have a small graphical application whose only purpose is to pop up certain types of messages. Currently, I'm using it in a Bash script like this:
./MyProg "this is my message"
while
do
... do things ...
done
What I want to do is after the while loop is over (it does... (4 Replies)
Discussion started by: Zel2008
4 Replies
CLOSE(2) BSD System Calls Manual CLOSE(2)
NAME
close -- delete a descriptor
LIBRARY
Standard C Library (libc, -lc)
SYNOPSIS
#include <unistd.h>
int
close(int d);
DESCRIPTION
The close() system call deletes a descriptor from the per-process object reference table. If this is the last reference to the underlying
object, the object will be deactivated. For example, on the last close of a file the current seek pointer associated with the file is lost;
on the last close of a socket(2) associated naming information and queued data are discarded; on the last close of a file holding an advisory
lock the lock is released (see flock(2)).
When a process exits, all associated descriptors are freed, but since there is a limit on active descriptors per processes, the close() sys-
tem call is useful when a large quantity of file descriptors are being handled.
When a process calls fork(2), all descriptors for the new child process reference the same objects as they did in the parent before the
fork(). If a new process is then to be run using execve(2), the process would normally inherit these descriptors. Most of the descriptors
can be rearranged with dup2(2) or deleted with close() before the execve() is attempted, but if some of these descriptors will still be
needed if the execve() fails, it is necessary to arrange for them to be closed only if the execve() succeeds. For this reason, the system
call
fcntl(d, F_SETFD, 1);
is provided, which arranges that a descriptor ``d'' will be closed after a successful execve(); the system call
fcntl(d, F_SETFD, 0);
restores the default, which is to not close descriptor ``d''.
RETURN VALUES
Upon successful completion, a value of 0 is returned. Otherwise, a value of -1 is returned and errno is set to indicate the error.
ERRORS
close() will fail if:
[EBADF] d is not an active descriptor.
[EINTR] An interrupt was received.
SEE ALSO
accept(2), execve(2), fcntl(2), flock(2), open(2), pipe(2), socket(2), socketpair(2)
STANDARDS
The close() function conforms to ISO/IEC 9945-1:1990 (``POSIX.1'').
BSD
April 19, 1994 BSD