Solved

File Locking on Solaris

Posted on 1999-01-29
4
483 Views
Last Modified: 2013-12-05
Hi !

I am trying to use file locking under Solaris 2.51 on a Sun Ultra machine.  I can not get it to compile, I have included all the required header files.  The only thing that I am not sure of is if I am suppose to put some linking in my Makefile

My call to flock is :-

  FILE fp;
  .....
  flock(fp,LOCK_EX);

flock is shown as an undefined symbol.

Please could anybody help.

Marvin.
0
Comment
Question by:checkin
  • 2
4 Comments
 
LVL 10

Expert Comment

by:viktornet
ID: 1258531
Do you have the source code for the flock() function? I didn't find it in my function listings...

-Viktor
--Ivanov
0
 

Accepted Solution

by:
mih earned 100 total points
ID: 1258532
Which C compiler are you using?

Are you actually having a compile problem or is it at the link stage?
- I guess it is a link problem - so, you might want to try adding -L/usr/ucb/lib -lucb (I think they are right, I don't have access to my Solaris machine today).

You may also want to consider using fcntl() rather than flock(), particularly if the file system can be accessed remotely (A lock applied with flock() is not visible from remote file system access such as NFS).

0
 

Author Comment

by:checkin
ID: 1258533
The compiler I use is gcc.  I tried linking the ucb file in, it compiled ad linked but just died when trying to run it but no core dump.
0
 

Expert Comment

by:mih
ID: 1258534
I'm a little confused by your program dying without a core-dump. What do you mean by dying? Did it hang? Did you get any error code at all?

Make sure you set your coredump size to be unlimited (use the following command):
limit coredumpsize unlimited

If you can give me a little more of your code, I might be able to help some more.
Have you got access to a debugger?

0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying 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

An Outlet in Cocoa is a persistent reference to a GUI control; it connects a property (a variable) to a control.  For example, it is common to create an Outlet for the text field GUI control and change the text that appears in this field via that Ou…
Java performance on Solaris - Managing CPUs There are various resource controls in operating system which directly/indirectly influence the performance of application. one of the most important resource controls is "CPU".   In a multithreaded…
The goal of this video is to provide viewers with basic examples to understand and use pointers in the C programming language.
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use while-loops in the C programming language.

839 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