Sponsored Content
Top Forums Programming sem_t variable in a C structure???? Post 302595472 by Corona688 on Friday 3rd of February 2012 09:11:14 AM
Old 02-03-2012
It's nothing to do with putting it in a structure. Why would your structure stop sem_init from being defined?

undefined symbol means you're using a function that it can't actually find. What might that mean?

Code:
$ man sem_init

SEM_INIT(3)                Linux Programmer's Manual               SEM_INIT(3)



NAME
       sem_init - initialize an unnamed semaphore

SYNOPSIS
       #include <semaphore.h>

       int sem_init(sem_t *sem, int pshared, unsigned int value);

       Link with -lrt or -pthread.

That's the instructions for linux, anyway. Your system Might have it under something different.
This User Gave Thanks to Corona688 For This Post:
 

10 More Discussions You Might Find Interesting

1. HP-UX

Ram structure

Hi all, I would like know if we can enter a command under UNIX (HPUX 10.xx) to know the hard ram memory structure . Thanks Dorian (1 Reply)
Discussion started by: Dorian
1 Replies

2. UNIX for Dummies Questions & Answers

if then else structure

echo name the file that you want to read read answer if then echo you must enter a file name fi cat $answer im trying to catch the error if user forget to enter the name of the file anyone can help me ? thanks:confused: (4 Replies)
Discussion started by: props
4 Replies

3. Programming

Doubt in structure -- c++

hi, Small sample program #include <iostream> using namespace std; typedef struct vijay { int a; int b; }VIJAY; void main () { VIJAY v; cout << "a=" << v.a<<endl; cout << "b=" << v.b<<endl; if(v) { (5 Replies)
Discussion started by: vijaysabari
5 Replies

4. UNIX for Dummies Questions & Answers

Copying a Directory Structure to a new structure

Hi all Is it possible to copy a structure of a directory only. e.g. I have a file with the following entries that is a result of a find :- /dir1/dir2/file.dbf /dir1/dir2/dir3/file1.dbf /dir1/file.dbf I want to copy these to a directory and keep the structure however starting at a new dir... (8 Replies)
Discussion started by: jhansrod
8 Replies

5. UNIX for Advanced & Expert Users

MV files from one directory structure(multiple level) to other directory structure

Hi, I am trying to write a script that will move all the files from source directory structure(multiple levels might exist) to destination directory structure. If a sub folder is source doesnot exist in destination then I have to skip and goto next level. I also need to delete the files in... (4 Replies)
Discussion started by: srmadab
4 Replies

6. Shell Programming and Scripting

Case structure

Hi, Can anyone help me with the following case structure? echo "Please enter the date for which you want the Report:\c" read dat d1=`echo $dat|cut -c7-8` m1=`echo $dat|cut -c5-6` y1=`echo $dat|cut -c1-4` yr=`expr "$d1" - 1` case "$yr" in 0) MONTH=`expr "$m1" - 1`... (4 Replies)
Discussion started by: kamitsin
4 Replies

7. Programming

Search attributes in one structure using the values from another structure

Hello Groups I am trying to find out ways of comparing a value from a 'c' structure to a value in another 'C' structure. the 'C' structure can be a List or liked list as it contains lot many records. if we loop it in both the structures it is going to consume time. I am looking for a simple... (3 Replies)
Discussion started by: dhanamurthy
3 Replies

8. UNIX for Dummies Questions & Answers

Size of Structure

How can we find size of a structure with out using sizeof operator? Thanks, Harika (2 Replies)
Discussion started by: harikamamidala
2 Replies

9. UNIX for Dummies Questions & Answers

Directory Structure

Hi... I have a directory which has multiple directories and sub directories inside... what command should i use to get a list of all these directories, without the filenames.... (2 Replies)
Discussion started by: saharookiedba
2 Replies

10. Programming

Structure as global variable

I need to use the below global structure defined in code1.c in another code2.c struct memIOptrs { const char *name; unsigned char *virtptr; }MEM_IO_PTRS; I have a header file for the project codes.h, how should the structure be declared here. Also, what if the structure was... (1 Reply)
Discussion started by: dragonpoint
1 Replies
<semaphore.h>(P)					     POSIX Programmer's Manual						  <semaphore.h>(P)

NAME
semaphore.h - semaphores (REALTIME) SYNOPSIS
#include <semaphore.h> DESCRIPTION
The <semaphore.h> header shall define the sem_t type, used in performing semaphore operations. The semaphore may be implemented using a file descriptor, in which case applications are able to open up at least a total of {OPEN_MAX} files and semaphores. The symbol SEM_FAILED shall be defined (see sem_open()). The following shall be declared as functions and may also be defined as macros. Function prototypes shall be provided. int sem_close(sem_t *); int sem_destroy(sem_t *); int sem_getvalue(sem_t *restrict, int *restrict); int sem_init(sem_t *, int, unsigned); sem_t *sem_open(const char *, int, ...); int sem_post(sem_t *); int sem_timedwait(sem_t *restrict, const struct timespec *restrict); int sem_trywait(sem_t *); int sem_unlink(const char *); int sem_wait(sem_t *); Inclusion of the <semaphore.h> header may make visible symbols defined in the headers <fcntl.h> and <sys/types.h>. The following sections are informative. APPLICATION USAGE
None. RATIONALE
None. FUTURE DIRECTIONS
None. SEE ALSO
<fcntl.h> , <sys/types.h> , the System Interfaces volume of IEEE Std 1003.1-2001, sem_destroy(), sem_getvalue(), sem_init(), sem_open(), sem_post(), sem_timedwait(), sem_trywait(), sem_unlink(), sem_wait() COPYRIGHT
Portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1, 2003 Edition, Standard for Information Technol- ogy -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html . IEEE
/The Open Group 2003 <semaphore.h>(P)
All times are GMT -4. The time now is 07:29 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy