LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Other *NIX Forums > Solaris / OpenSolaris
User Name
Password
Solaris / OpenSolaris This forum is for the discussion of Solaris, OpenSolaris, OpenIndiana, and illumos.
General Sun, SunOS and Sparc related questions also go here. Any Solaris fork or distribution is welcome.

Notices


Reply
  Search this Thread
Old 03-27-2005, 07:29 AM   #1
gajaykrishnan
Member
 
Registered: Jul 2004
Posts: 65

Rep: Reputation: 15
how to use the flock system call in sun os 5.07 ??


how to use the flock system call in sun os 5.07 ??

At the time of compilation it gives the error undefinded function flock ....

Are any flags required at the time of linking,.........
awating a reply..
thanx in advance....
 
Old 03-27-2005, 02:52 PM   #2
technopark02
Member
 
Registered: Feb 2005
Distribution: Solaris 8 - 11, JDS Linux 3.0
Posts: 99

Rep: Reputation: 15
File I/O primitives are part of libc on Solaris. So, make sure your object code is linked with libc (with -lc flag) during linking. In general, C/C++ compiler drivers are smart enough to pass -lc to linker. But you better make sure it is being passed by turning on verbose option during compilation (add -v for C++ or -# for C compiler on compile line if you are using Sun Studio compilers)

If you couldn't resolve the issue with -lc, please post the following:
1) Compiler driver being used ie., GCC/Sun Studio/..
2) A small test case which exhibits the behavior you mentioned in your post
3) Compile line, Error messages, etc.,
 
Old 03-27-2005, 03:08 PM   #3
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris 11.4, Oracle Linux, Mint, Debian/WSL
Posts: 9,789

Rep: Reputation: 492Reputation: 492Reputation: 492Reputation: 492Reputation: 492
Flock used to be a SunOS 4 system call but was obsoleted with SunOS 5, so there's not such a system call with SunOS 5.7 (a.k.a Solaris 7) or any SunOS 5 release. There is however a flock BSD compatibility library function, which use is discouraged unless you are porting BSD code.

"Man flock" will tell you more about that, and "man -s 1b cc" will tell you what options you need to add to your compiling and linking commands to be able to use flock, should you insist using it.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
using system call ej25 Programming 9 11-30-2004 11:45 AM
new system call soul2 Linux - General 1 11-03-2004 02:41 PM
Is it possible to use system() and get the return value from the system call newguy21 Programming 1 08-11-2004 01:37 PM
System call dami Linux - General 0 11-18-2003 11:18 AM
about system call alchen1999 Programming 10 09-01-2003 03:43 AM

LinuxQuestions.org > Forums > Other *NIX Forums > Solaris / OpenSolaris

All times are GMT -5. The time now is 01:59 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration