Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7958025
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T04:21:23+00:00 2026-06-04T04:21:23+00:00

Is there anyway in Linux (or more generally in a POSIX OS) to guarantee

  • 0

Is there anyway in Linux (or more generally in a POSIX OS) to guarantee that during the execution of a program, no file descriptors will be reused, even if a file is closed and another opened? My understanding is that this situation would usually lead to the file descriptor for the closed file being reassigned to the newly opened file.

I’m working on an I/O tracing project and it would make life simpler if I could assume that after an open()/fopen() call, all subsequent I/O to that file descriptor is to the same file.

I’ll take either a compile-time or run-time solution.

If it is not possible, I could do my own accounting when I process the trace file (noting the location of all open and close calls), but I’d prefer to squash the problem during execution of the traced program.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T04:21:24+00:00Added an answer on June 4, 2026 at 4:21 am

    Note that POSIX requires:

    The open() function shall return a file descriptor for the named file
    that is the lowest file descriptor not currently open for that
    process.

    So in the strictest sense, your request will change the program’s environment to be no longer POSIX compliant.

    That said, I think your best bet is to use the LD_PRELOAD trick to intercept calls to close and ignore them.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using UNIX socket APIs on Linux, is there any way to guarantee that I
Is there any way to store file creation time in linux? May be filesystem
Is there anyway or any addin for VS2010 that can remove all the comments
I would like to use a mirror with my screen, is there anyway that
I have a program that runs fine on MacOS and Linux and cross-compiles to
I have a linux server which I have FTP access to. Is there anyway
I'm working on an app that will run on linux with an NVIDIA graphics
Is there any way under linux/terminal to count, how many times the char f
Is there anyway to highlight the initial text in a textbox on a web
Is there anyway to get the Facebook ID of a user without forcing them

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.