Sponsored Content
Full Discussion: ftok system call
Top Forums UNIX for Advanced & Expert Users ftok system call Post 302406433 by jimmyuk on Tuesday 23rd of March 2010 12:24:32 AM
Old 03-23-2010
ftok system call

In the system call msgget(key,mode) for the argument key i want to use ftok call . I am really confused with the argument pathname in ftok call. I want to know the pathname of which file I want to specify over there. I am just a beginer to advanced unix plz help me out.

Last edited by jimmyuk; 03-23-2010 at 01:57 AM..
 

10 More Discussions You Might Find Interesting

1. Programming

semclt system call ???

hi mates, What is the : semctl system call for? any example will be helpful and be appreciated. cya and thanx abdul (2 Replies)
Discussion started by: abdul
2 Replies

2. 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

3. 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

4. Programming

c system call

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

5. 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

6. 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

7. 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

8. 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

9. 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

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
ftok(3C)						   Standard C Library Functions 						  ftok(3C)

NAME
ftok - generate an IPC key SYNOPSIS
#include <sys/ipc.h> key_t ftok(const char *path, int id); DESCRIPTION
The ftok() function returns a key based on path and id that is usable in subsequent calls to msgget(2), semget(2) and shmget(2). The path argument must be the pathname of an existing file that the process is able to stat(2). The ftok() function will return the same key value for all paths that name the same file, when called with the same id value, and will return different key values when called with different id values. If the file named by path is removed while still referred to by a key, a call to ftok() with the same path and id returns an error. If the same file is recreated, then a call to ftok() with the same path and id is likely to return a different key. Only the low order 8-bits of id are significant. The behavior of ftok() is unspecified if these bits are 0. RETURN VALUES
Upon successful completion, ftok() returns a key. Otherwise, ftok() returns (key_t)-1 and sets errno to indicate the error. ERRORS
The ftok() function will fail if: EACCES Search permission is denied for a component of the path prefix. ELOOP Too many symbolic links were encountered in resolving path. ENAMETOOLONG The length of the path argument exceeds {PATH_MAX} or a pathname component is longer than {NAME_MAX}. ENOENT A component of path does not name an existing file or path is an empty string. ENOTDIR A component of the path prefix is not a directory. The ftok() function may fail if: ENAMETOOLONG Pathname resolution of a symbolic link produced an intermediate result whose length exceeds {PATH_MAX} . USAGE
For maximum portability, id should be a single-byte character. Another way to compose keys is to include the project ID in the most significant byte and to use the remaining portion as a sequence num- ber. There are many other ways to form keys, but it is necessary for each system to define standards for forming them. If some standard is not adhered to, it will be possible for unrelated processes to unintentionally interfere with each other's operation. It is still possible to interfere intentionally. Therefore, it is strongly suggested that the most significant byte of a key in some sense refer to a project so that keys do not conflict across a given system. NOTES
Since the ftok() function returns a value based on the id given and the file serial number of the file named by path in a type that is no longer large enough to hold all file serial numbers, it may return the same key for paths naming different files on large filesystems. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Interface Stability |Standard | +-----------------------------+-----------------------------+ |MT-Level |MT-Safe | +-----------------------------+-----------------------------+ SEE ALSO
msgget(2), semget(2), shmget(2), stat(2), attributes(5), standards(5) SunOS 5.11 24 Jul 2002 ftok(3C)
All times are GMT -4. The time now is 09:35 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy