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)							System Calls Manual							 semctl(2)

NAME
semctl - Performs semaphore control operations SYNOPSIS
#include <sys/sem.h> int semctl( int semid, int semnum, int cmd, ...); Application developers may want to specify #include statements for <sys/types.h> and <sys/ipc.h> before the one for <sys/sem.h> if programs are being developed for multiple platforms. The additional #include statements are not required on Tru64 UNIX systems or by ISO or X/Open standards, but may be required on other vendors' systems that conform to these standards. STANDARDS
Interfaces documented on this reference page conform to industry standards as follows: semctl(): XSH4.2 Refer to the standards(5) reference page for more information about industry standards and associated tags. PARAMETERS
Specifies the ID of the semaphore set. Specifies the number of the semaphore to be processed. Specifies the type of command. See the DESCRIPTION section for a list of available commands. The fourth argument is optional and depends on the operation requested. If required, it is of the type union semun, which the application program must explicitly declare as follows: union semun { int val; struct semid_ds *buf; u_short *array; } arg ); The members of this structure are described as follows: Contains the semaphore value to which semval is set when the SETVAL command is performed. Points to a structure of type semid_ds. (For information about this structure, semid_ds(4).) When you specify the IPC_STAT command, semctl() copies the contents of the semid_ds struc- ture identified by semid into arg.buf. When you specify the IPC_SET command, semctl() copies the contents of the arg.buf parameter into the semid_ds structure identified by the semid parameter. Points to an array of semval values. These semval values are returned by the GETALL command and set by the SETALL command. DESCRIPTION
The semctl() function allows a process to perform various operations on an individual semaphore within a semaphore set, on all semaphores within a semaphore set, and on the semid_ds structure associated with the semaphore set. It also allows a process to remove the semaphore set's ID and its associated semid_ds structure. The cmd value determines which operation is performed. The following commands operate on the specified semaphore (that is, the one speci- fied by the semnum parameter) within the semaphore set identified by semid: Returns the value of semval. This command requires read permission. Sets the value of semval to arg.val. When this command successfully executes, the kernel clears the semaphore's adjust-on-exit value in all processes. This command requires modify permission. Returns the value of sempid. This command requires read permission. Returns the value of semncnt. This command requires read permission. Returns the value of semzcnt. This command requires read permission. The following commands operate on all the semaphores in the semaphore set: Returns all the semval values and places them in the array pointed to by arg.array. This command requires read permission. Sets all the semval values according to the array pointed to by arg.array. When this command successfully executes, the kernel clears the semaphore's adjust-on-exit value in all processes. This command requires modify permission. You can also use the following IPC commands: Queries the semaphore ID by copying the contents of its associated semid_ds structure into the structure pointed to by arg.buf. This com- mand requires read permission. Sets the semaphore set by copying the values in the arg.buf structure into corresponding fields in the semid_ds structure associated with the semaphore ID. This operation is restricted. The effective user ID of the calling process must have superuser privilege or must be equal to the value of sem_perm.cuid or sem_perm.uid in the structure associated with the semaphore ID. The fields are set as follows: The sem_perm.uid field is set to the owner's user ID. The sem_perm.gid field is set to the owner's group ID. The sem_perm.mode field is set to the access modes for the semaphore set. Only the low-order nine bits are set. Removes the semaphore ID and destroys the set of semaphores and the semid_ds data structure associated with it. This operation is restricted. The effective user ID of the calling process must have superuser privilege or equal to the value of sem_perm.cuid or sem_perm.uid in the associated semid_ds structure. RETURN VALUES
Upon successful completion, the value returned depends on the cmd parameter as follows: Returns the value of semval. Returns the value of sempid. Returns the value of semncnt. Returns the value of semzcnt. All other commands return a value of 0 (zero). If the semctl() function fails, it returns a value of -1 and sets errno to indicate the error. ERRORS
The semctl() function sets errno to the specified values for the following conditions: The calling process does not have the required per- mission. [Tru64 UNIX] The cmd parameter is IPC_STAT or IPC_SET and an error occurred in accessing the arg structure. The semid parameter is not a valid semaphore ID; the value of semnum is less than 0 (zero) or greater than sem_nsems; or cmd is not a valid command. [Tru64 UNIX] The system does not have enough memory to complete the function. Either the cmd parameter is equal to IPC_RMID and the effective user ID of the calling process does not have appropriate privilege, or the cmd parameter is equal to IPC_SET and the effective user ID of the calling process is not equal to the value of sem_perm.cuid or sem_perm.uid in the semid_ds structure associated with the semaphore ID. The cmd parameter is SETVAL or SETALL and the value to which semval is to be set is greater than the system-defined maximum. RELATED INFORMATION
Functions: semget(2), semop(2) Data structures: semid_ds(4) Standards: standards(5) delim off semctl(2)
All times are GMT -4. The time now is 05:21 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy