Change the signature of ftok from (const char *, char) to (const char *, int)
Document that only the 8 least significant bits are used in the key generation and that the return value is (key_t)-1 [this is to fix K&R vs. ansi compilation and lint warnings]
This commit is contained in:
parent
b4d3f6c477
commit
7ffe927935
@ -1,4 +1,4 @@
|
|||||||
.\" $NetBSD: ftok.3,v 1.3 1998/02/05 18:46:21 perry Exp $
|
.\" $NetBSD: ftok.3,v 1.4 1998/11/12 16:15:17 christos Exp $
|
||||||
.\"
|
.\"
|
||||||
.\" Copyright (c) 1994 SigmaSoft, Th. Lockert <tholo@sigmasoft.com>
|
.\" Copyright (c) 1994 SigmaSoft, Th. Lockert <tholo@sigmasoft.com>
|
||||||
.\" All rights reserved.
|
.\" All rights reserved.
|
||||||
@ -37,7 +37,7 @@
|
|||||||
.Fd #include <sys/types.h>
|
.Fd #include <sys/types.h>
|
||||||
.Fd #include <sys/ipc.h>
|
.Fd #include <sys/ipc.h>
|
||||||
.Ft key_t
|
.Ft key_t
|
||||||
.Fn ftok "const char *path" "char id" ;
|
.Fn ftok "const char *path" "int id" ;
|
||||||
.Sh DESCRIPTION
|
.Sh DESCRIPTION
|
||||||
The
|
The
|
||||||
.Fn ftok
|
.Fn ftok
|
||||||
@ -57,10 +57,14 @@ must specify an existing file that is accessible to the calling process
|
|||||||
or the call will fail. Also, note that links to files will return the
|
or the call will fail. Also, note that links to files will return the
|
||||||
same key, given the same
|
same key, given the same
|
||||||
.Fa id .
|
.Fa id .
|
||||||
|
.Pp
|
||||||
|
Only the 8 least significant bits of
|
||||||
|
.Fa id
|
||||||
|
are used in the key generation; the rest of the bits are ignored.
|
||||||
.Sh RETURN VALUES
|
.Sh RETURN VALUES
|
||||||
The
|
The
|
||||||
.Fn ftok
|
.Fn ftok
|
||||||
function will return -1 if
|
function will return ((ket_t)-1) if
|
||||||
.Fa path
|
.Fa path
|
||||||
does not exist or if it cannot be accessed by the calling process.
|
does not exist or if it cannot be accessed by the calling process.
|
||||||
.Sh SEE ALSO
|
.Sh SEE ALSO
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: ftok.c,v 1.5 1997/07/21 14:07:00 jtc Exp $ */
|
/* $NetBSD: ftok.c,v 1.6 1998/11/12 16:15:17 christos Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1994 SigmaSoft, Th. Lockert <tholo@sigmasoft.com>
|
* Copyright (c) 1994 SigmaSoft, Th. Lockert <tholo@sigmasoft.com>
|
||||||
@ -29,7 +29,7 @@
|
|||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
#if defined(LIBC_SCCS) && !defined(lint)
|
#if defined(LIBC_SCCS) && !defined(lint)
|
||||||
__RCSID("$NetBSD: ftok.c,v 1.5 1997/07/21 14:07:00 jtc Exp $");
|
__RCSID("$NetBSD: ftok.c,v 1.6 1998/11/12 16:15:17 christos Exp $");
|
||||||
#endif /* LIBC_SCCS and not lint */
|
#endif /* LIBC_SCCS and not lint */
|
||||||
|
|
||||||
#include "namespace.h"
|
#include "namespace.h"
|
||||||
@ -44,7 +44,7 @@ __weak_alias(ftok,_ftok);
|
|||||||
key_t
|
key_t
|
||||||
ftok(path, id)
|
ftok(path, id)
|
||||||
const char *path;
|
const char *path;
|
||||||
char id;
|
int id;
|
||||||
{
|
{
|
||||||
struct stat st;
|
struct stat st;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user