?
Solved

File Locking on Solaris

Posted on 1999-01-29
4
Medium Priority
?
488 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
[X]
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
  • 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 200 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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

Introduction Regular patching is part of a system administrator's tasks. However, many patches require that the system be in single-user mode before they can be installed. A cluster patch in particular can take quite a while to apply if the machine…
This tutorial is posted by Aaron Wojnowski, administrator at SDKExpert.net.  To view more iPhone tutorials, visit www.sdkexpert.net. This is a very simple tutorial on finding the user's current location easily. In this tutorial, you will learn ho…
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.
The goal of this video is to provide viewers with basic examples to understand and use switch statements in the C programming language.
Suggested Courses

650 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