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:
christos 1998-11-12 16:15:17 +00:00
parent b4d3f6c477
commit 7ffe927935
2 changed files with 10 additions and 6 deletions

View File

@ -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>
.\" All rights reserved.
@ -37,7 +37,7 @@
.Fd #include <sys/types.h>
.Fd #include <sys/ipc.h>
.Ft key_t
.Fn ftok "const char *path" "char id" ;
.Fn ftok "const char *path" "int id" ;
.Sh DESCRIPTION
The
.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
same key, given the same
.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
The
.Fn ftok
function will return -1 if
function will return ((ket_t)-1) if
.Fa path
does not exist or if it cannot be accessed by the calling process.
.Sh SEE ALSO

View File

@ -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>
@ -29,7 +29,7 @@
#include <sys/cdefs.h>
#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 */
#include "namespace.h"
@ -44,7 +44,7 @@ __weak_alias(ftok,_ftok);
key_t
ftok(path, id)
const char *path;
char id;
int id;
{
struct stat st;