Solved

File Locking on Solaris

Posted on 1999-01-29
4
480 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
CPU monthly average? 12 90
Virtualizing TAPE on dual VIOS 3 65
aix tls version 6 150
What are recommended OS for exim mail server? 10 79
My previous tech tip, Installing the Solaris OS From the Flash Archive On a Tape (http://www.experts-exchange.com/articles/OS/Unix/Solaris/Installing-the-Solaris-OS-From-the-Flash-Archive-on-a-Tape.html), discussed installing the Solaris Operating S…
Installing FreeBSD… FreeBSD is a darling of an operating system. The stability and usability make it a clear choice for servers and desktops (for the cunning). Savvy?  The Ports collection makes available every popular FOSS application and packag…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
The goal of this video is to provide viewers with basic examples to understand how to create, access, and change arrays in the C programming language.

772 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now