Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win


data fork problem

Posted on 2004-11-02
Medium Priority
Last Modified: 2013-12-26

Hi All,
I have an  application that locks a file by puting some informations at the beginning of its data fork.
so it can,t be open by another application.
My question is :
I s there any way to prevent  the application from doing so?


Question by:bachra04
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3

Author Comment

ID: 12475662
This does not resolve the problem because my purpose is to eliminate the locking mechanism implemented by this application (of course I dispose only with the executable of this application).
So is it it possible to protect only one part (let's say the first 256 bits) of data fork from writing.
and make them read only.
LVL 23

Expert Comment

ID: 12478120
Both lockf() and fcntl() provide for locking regions of files - specified as a range of bytes 256 bits == 64 bytes.

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!


Author Comment

ID: 12487701
Thank you for your comments ,
As you've said lockf and fcntl provide locking region but this didn't help me prevent the locking action of the application.
What I think is that application uses flock () to provide exclusif access.
My last action :
Is there a way to prevent or to fail the action of flock() programmatically ?
At the documentation I see that flock may be failed  by signals
"Processes blocked awaiting a lock may be awakened by signals."
So is it possible to do that by programming.

In conclusion:
The first application open a data file and locks it for its exclusif use.
I want my application to open the same file at this moment and remove the locking so I can write on it Is this possible?

Thank you again


LVL 23

Accepted Solution

brettmjohnson earned 1500 total points
ID: 12496903
I you lock the file yourself (before the other application does so), using the same locking mechanism,
you will prevent the other app from locking the file.  However that will probably adversely affect
the application in question ( it will probably either wait for the lock to be released, or generate
and error, or simply exit).   Your posts indicate that your goal is to "fool" the application into thinking
it locked the file without actually doing so.  Keep in mind that the application likely uses file locking to
coordinate activity and/or prevent data corruption.

You have apparently asked us how to do something that seems unwise.  Perhaps we need to understand
what the greater goal is.   Why do you wish to disable application file locking?  What are you trying
to accomplish?

Author Comment

ID: 12498852
#Your posts indicate that your goal is to "fool" the application into thinking
#it locked the file without actually doing so.  

yes this is exactely what I want to do.

#Keep in mind that the application likely uses file locking to
#coordinate activity and/or prevent data corruption.

I agree with you but I planned to take care of that from my application.

My Goal is to convert a standalone application to pseudo centralized application.
But it seems impossible

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…

618 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question