c - How to delete a file in Linux where all I have is the file descriptor -


मेरे पास एक int फ़ाइल डिस्क्रिप्टर है जो पहले खोला गया था ( open ) और मुझे उस फ़ाइल को हटाना होगा।

क्या मुझे पहले फ़ाइल का नाम और कॉल निकालें प्राप्त करना है? (उदाहरण के लिए तकनीक का उपयोग करके)

या क्या कुछ अन्य (लिनक्स विशिष्ट ओके) फाइल डिस्क्रिप्टर के आधार पर पूरी तरह से करने का तरीका है?

मैंने खोज की है और सबसे अच्छा I मिल सकता है उपरोक्त उत्तर।

आप / proc का उपयोग कर देख सकते हैं जो एक खुला एफडी पथ से जुड़ा हुआ है, और सिमलिंक का पूरा पथ प्राप्त करता है।

  # ls -l / proc / 8701 / fd कुल 0 lr-x ------ 1 जड़ रूट 64 अप्रैल 23 22:44 0 - & gt; / Dev / null lrwx ------ 1 रूट रूट 64 अप्रैल 23 22:44 1 - & gt; / Dev / null lrwx ------ 1 रूट रूट 64 अप्रैल 23 22:44 2 - & gt; / Dev / null lrwx ------ 1 रूट रूट 64 अप्रैल 23 23:19 20 - & gt; सॉकेट: [16204] lrwx ------ 1 रूट रूट 64 अप्रैल 23 23:19 21 - & gt; सॉकेट: [16205] lrwx ------ 1 रूट रूट 64 अप्रैल 23 22:44 3 - & gt; सॉकेट: [18743] एल-वाक्स ------ 1 रूट रूट 64 अप्रैल 23 22:44 4 - & gt; /var/lib/dhcp/dhclient-7a30dd46-5058-47aa-b71e-ff77cfbe4194-wlan0. कृपया lrwx ------ 1 रूट रूट 64 अप्रैल 23 22:44 5 - & gt; सॉकेट: [16872] lrwx ------ 1 रूट रूट 64 अप्रैल 23 22:44 6 - & gt; सॉकेट: [18747]    

Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -