LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 03-01-2007, 06:37 AM   #1
hegdeshashi
Member
 
Registered: Dec 2005
Posts: 73
Blog Entries: 3

Rep: Reputation: 15
client-server for shared memory...


Hi,

I am running client-server program for shared memory.

When I compile.
gcc -o server_shm server_shm.c

like this...
I am getting this errors:
================================================
/tmp/cccuk2D3.o(.text+0x4a): In function `main':
: undefined reference to `err_sys'
/tmp/cccuk2D3.o(.text+0x7e): In function `main':
: undefined reference to `err_sys'
/tmp/cccuk2D3.o(.text+0x90): In function `main':
: undefined reference to `sem_create'
/tmp/cccuk2D3.o(.text+0xae): In function `main':
: undefined reference to `err_sys'
/tmp/cccuk2D3.o(.text+0xc0): In function `main':
: undefined reference to `sem_create'
/tmp/cccuk2D3.o(.text+0xde): In function `main':
: undefined reference to `err_sys'
/tmp/cccuk2D3.o(.text+0x112): In function `main':
: undefined reference to `err_sys'
/tmp/cccuk2D3.o(.text+0x145): In function `main':
: undefined reference to `err_sys'
/tmp/cccuk2D3.o(.text+0x156): In function `main':
: undefined reference to `sem_close'
/tmp/cccuk2D3.o(.text+0x167): In function `main':
: undefined reference to `sem_close'
/tmp/cccuk2D3.o(.text+0x189): In function `server':
: undefined reference to `sema_wait'
/tmp/cccuk2D3.o(.text+0x1d9): In function `server':
: undefined reference to `sys_err_str'
/tmp/cccuk2D3.o(.text+0x237): In function `server':
: undefined reference to `sem_signal'
/tmp/cccuk2D3.o(.text+0x24: In function `server':
: undefined reference to `sem_wait'
/tmp/cccuk2D3.o(.text+0x28f): In function `server':
: undefined reference to `sem_signal'
/tmp/cccuk2D3.o(.text+0x2a0): In function `server':
: undefined reference to `sem_wait'
/tmp/cccuk2D3.o(.text+0x2ec): In function `server':
: undefined reference to `sem_signal'
collect2: ld returned 1 exit status

===================================================


Can anyone help me regarding this....
 
Old 03-02-2007, 05:29 PM   #2
wjevans_7d1@yahoo.co
Member
 
Registered: Jun 2006
Location: Mariposa
Distribution: Slackware 9.1
Posts: 938

Rep: Reputation: 31
Who defines these functions? Are they ones that you wrote? Are they in a "helper" .c file that you compiled separately? What?
  • err_sys()
  • sys_err_str()
  • sem_create()
  • sem_close()
  • sem_wait()
  • sema_wait()
  • sem_signal()
 
Old 03-05-2007, 12:40 AM   #3
hegdeshashi
Member
 
Registered: Dec 2005
Posts: 73

Original Poster
Blog Entries: 3

Rep: Reputation: 15
* err_sys()
* sys_err_str()
* sem_create()
* sem_close()
* sem_wait()
* sema_wait()
* sem_signal()
These system calls are defined in different header files like sys/shm.h,sys/ipc.h

And I already included.
But I am getting this strange result when I am compiling.
I think,this is the compiler problem.So I need to reinstall the gcc ? or upgrade it?

can any one give me the hint??????
 
Old 03-07-2007, 09:08 PM   #4
wjevans_7d1@yahoo.co
Member
 
Registered: Jun 2006
Location: Mariposa
Distribution: Slackware 9.1
Posts: 938

Rep: Reputation: 31
I could be wrong, but I'm thinking that you might be gathering different semaphore-handling functions from different sets of such functions.

My advice (which may be worthless) is that you pick one set of such semaphore-handling functions and remain with that set. You can find one such set by doing:

Code:
man sem_init
You can find another such set by doing:

Code:
man semctl
man semget
man semop
It doesn't sound like this is answering your questions, but I suspect that if you follow this advice, your problem will disappear.

Semaphores can be tricky. If your program blows up, often you have extra semaphores lying around which no one is using. So I'd go with (and have gone with) file record locking instead.

Hope this helps a little.
 
  


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
Shared memory yhus Programming 1 09-28-2006 02:24 PM
is shared memory expandable in memory size? Thinking Programming 4 08-16-2005 09:57 AM
How much memory. Need Oracle server and client and dev tools deanbrown3d Linux - Newbie 2 06-15-2004 08:19 AM
shared memory socket9001 Programming 4 02-06-2004 02:08 PM
shared Memory versus the total amount of RAM on the server ashley75 Linux - General 1 08-25-2003 11:21 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 10:24 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