Sponsored Content
Full Discussion: semclt system call ???
Top Forums Programming semclt system call ??? Post 7046 by LivinFree on Tuesday 18th of September 2001 07:30:54 AM
Old 09-18-2001
semctl - semaphore control operations

Try the command: man semctl.
 

10 More Discussions You Might Find Interesting

1. Programming

Problem in system call

Dear Friends, I write a c program to list the directories recursively. For this I write a function called my_readdir to read the content of directory. For this I use read system call it returns -1, then I use readdir system call it gives comment terminated error or segmentation... (1 Reply)
Discussion started by: spmlingam
1 Replies

2. UNIX for Advanced & Expert Users

how to differentiate system call from library call

Hi, Ho do I differentiate system call from library call? for example if I am using chmod , how do I find out if it is a system call or library call? Thanks Muru (2 Replies)
Discussion started by: muru
2 Replies

3. Programming

c system call

How the c compiler differentiates the system calls and function calls? (1 Reply)
Discussion started by: rangaswamy
1 Replies

4. Shell Programming and Scripting

system call

Hi, How to write a system calls in a script ? > cd $HOME > ls -ltr thanks in advance.. (10 Replies)
Discussion started by: hegdeshashi
10 Replies

5. Programming

C:system call

Hi I'm studing the system call. I've written a small program that return the time spent in doing some operations. Now I'd like to write one that return the time spent in user mode of a process. I'm reading that i should use the tms struct: clock_t times(struct tms *buf); struct tms {... (2 Replies)
Discussion started by: Dedalus
2 Replies

6. Programming

system call

I have a cgi script which is called after certain time interval, which has this: system ("ls -l /tmp/cgic* | grep -v \"cgicsave.env\" | awk '{print $5}'"); During the execution of this script,the output is 0 sometimes. But due to this the system call is not working at all and doesnt o/p... (2 Replies)
Discussion started by: xs2punit
2 Replies

7. Programming

need help with system call

hi everyone i wrote a system call and compiled the kernel succesfully... my system call is in a file in the kernel folder named my_syscall1.c (kernel/my_syscall1.c) the header file for this system call i added it in the folder include like this include/my_syscall1/my_syscall1.h my problem is... (2 Replies)
Discussion started by: demis87
2 Replies

8. Shell Programming and Scripting

system call

Trying to figure out a load issue with a webserver. I have traced a php script and noticed the following connect(4, {sa_family=AF_INET, sin_port=htons(3306), sin_addr=inet_addr("XX.XX.XX.XX")}, 16) = -1 EINPROGRESS (Operation now in progress) <0.000035> poll(, 1, 2000) = 1 () <0.000120>... (5 Replies)
Discussion started by: rajan007
5 Replies

9. Programming

[C] exec system call

Hi again ;) Now I want to make a program that will execute the programs with exec, asking the user if he wants the program to run in background or foreground. scanf("%c",&caracter); if (caracter=='y'){ printf("Has decidido ejecutarlo en background\n"); if((pid=fork())==0) {// fork para... (3 Replies)
Discussion started by: lamachejo
3 Replies

10. Programming

c programming system call

newPerm = oldPerm & ~0100; where oldPerm holds the value of st_mode from the system call stat(). When I try and compile every line where ive attempted to do these operations gives the warning "parameter names without declaration types in function declaration". what could be the problem? the... (2 Replies)
Discussion started by: bjhum33
2 Replies
SEMCTL(2)						      BSD System Calls Manual							 SEMCTL(2)

NAME
semctl -- control operations on a semaphore set LIBRARY
Standard C Library (libc, -lc) SYNOPSIS
#include <sys/types.h> #include <sys/ipc.h> #include <sys/sem.h> int semctl(int semid, int semnum, int cmd, ...); DESCRIPTION
The semctl() system call performs the operation indicated by cmd on the semaphore set indicated by semid. A fourth argument, a union semun arg, is required for certain values of cmd. For the commands that use the arg argument, union semun is defined as follows: union semun { int val; /* value for SETVAL */ struct semid_ds *buf; /* buffer for IPC_STAT & IPC_SET */ u_short *array; /* array for GETALL & SETALL */ }; Commands are performed as follows: IPC_STAT Fetch the semaphore set's struct semid_ds, storing it in the memory pointed to by arg.buf. IPC_SET Changes the sem_perm.uid, sem_perm.gid, and sem_perm.mode members of the semaphore set's struct semid_ds to match those of the struct pointed to by arg.buf. The calling process's effective uid must match either sem_perm.uid or sem_perm.cuid, or it must have superuser privileges. IPC_RMID Immediately removes the semaphore set from the system. The calling process's effective uid must equal the semaphore set's sem_perm.uid or sem_perm.cuid, or the process must have superuser privileges. GETVAL Return the value of semaphore number semnum. SETVAL Set the value of semaphore number semnum to arg.val. Outstanding adjust on exit values for this semaphore in any process are cleared. GETPID Return the pid of the last process to perform an operation on semaphore number semnum. GETNCNT Return the number of processes waiting for semaphore number semnum's value to become greater than its current value. GETZCNT Return the number of processes waiting for semaphore number semnum's value to become 0. GETALL Fetch the value of all of the semaphores in the set into the array pointed to by arg.array. SETALL Set the values of all of the semaphores in the set to the values in the array pointed to by arg.array. Outstanding adjust on exit values for all semaphores in this set, in any process are cleared. The struct semid_ds is defined as follows: struct semid_ds { struct ipc_perm sem_perm; /* operation permission struct */ struct sem *sem_base; /* pointer to first semaphore in set */ u_short sem_nsems; /* number of sems in set */ time_t sem_otime; /* last operation time */ long sem_pad1; /* SVABI/386 says I need this here */ time_t sem_ctime; /* last change time */ /* Times measured in secs since */ /* 00:00:00 GMT, Jan. 1, 1970 */ long sem_pad2; /* SVABI/386 says I need this here */ long sem_pad3[4]; /* SVABI/386 says I need this here */ }; RETURN VALUES
On success, when cmd is one of GETVAL, GETPID, GETNCNT or GETZCNT, semctl() returns the corresponding value; otherwise, 0 is returned. On failure, -1 is returned, and errno is set to indicate the error. ERRORS
The semctl() system call will fail if: [EINVAL] No semaphore set corresponds to semid. [EINVAL] The semnum argument is not in the range of valid semaphores for given semaphore set. [EPERM] The calling process's effective uid does not match the uid of the semaphore set's owner or creator. [EACCES] Permission denied due to mismatch between operation and mode of semaphore set. [ERANGE] SETVAL or SETALL attempted to set a semaphore outside the allowable range [0 .. SEMVMX]. SEE ALSO
semget(2), semop(2) BUGS
SETALL may update some semaphore elements before returning an error. BSD
September 12, 1995 BSD
All times are GMT -4. The time now is 11:07 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy