![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Rules & FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Wild card in find perm | braindrain | Shell Programming and Scripting | 1 | 04-12-2007 03:24 PM |
| perm bits | mpang_ | Shell Programming and Scripting | 1 | 02-10-2007 06:17 AM |
| find -perm query | napolayan | UNIX for Dummies Questions & Answers | 1 | 11-28-2006 10:28 AM |
| Semaphore | vjsony | UNIX for Dummies Questions & Answers | 3 | 04-07-2003 11:06 AM |
| semaphore | yls177 | UNIX for Dummies Questions & Answers | 1 | 10-08-2002 08:18 PM |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
change semaphore perm
Hi,
I've a problem with this simple code about of semaphore: Code:
#include<stdio.h>
#include<stdlib.h>
#include<unistd.h>
#include<semaphore.h>
#include<sys/types.h>
#include<sys/mman.h>
#include<sys/fcntl.h>
#define SemName "/SEM_1"
int main (int argc, char **argv)
{
char name[20];
sem_t *semdes;
sprintf(name, SemName);
printf("\nSto creando il semaforo %s...\t", name);
semdes = sem_open(name, O_CREAT | O_EXCL, 0666, 1); // crea il semaforo
printf("Semaforo %s creato!\n\n", name);
}
Can anyone show me a way to do it...? |
| Forum Sponsor | ||
|
|
|
|||
|
There is some confusion here. sem_open creates the semaphore in memory using it's own rules. The named semaphore can be accessed as long as the other process knows the name of the semaphore.
If you want to change things, then you will have to created shared memory, like you get with shmget then maybe calling shmat, and create your own mutex or semphore there. You can't change protection on the memory allocated with sem_open and it's family of calls. |
|||
| Google UNIX.COM |