194d9eb318
* fhandler.h (fhandler_virtual::fstat): Remove useless declaration. * fhandler_virtual.cc: Remove _COMPILING_NEWLIB define. * ipc.cc (ftok): Use stat64. * syscalls.cc (_fstat64): Remove alias. (_fstat): Ditto. (_stat): Ditto. (_fstat64_r): New function. (_fstat_r): Ditto. (_stat64_r): Ditto. (stat_r): Ditto. * crt0.o: New file, moved from newlib. * include/sys/param.h: Ditto. * include/sys/utime.h: Ditto. * include/sys/utmp.h: Ditto. * include/sys/dirent.h: Ditto. Expose different struct dirent, dependening of the environment.
40 lines
925 B
C++
40 lines
925 B
C++
/* ipc.cc: Single unix specification IPC interface for Cygwin
|
|
|
|
Copyright 2001, 2002 Red Hat, Inc.
|
|
|
|
Originally written by Robert Collins <robert.collins@hotmail.com>
|
|
|
|
This file is part of Cygwin.
|
|
|
|
This software is a copyrighted work licensed under the terms of the
|
|
Cygwin license. Please consult the file "CYGWIN_LICENSE" for
|
|
details. */
|
|
|
|
#include "winsup.h"
|
|
#include <cygwin/ipc.h>
|
|
#include <sys/stat.h>
|
|
|
|
extern "C"
|
|
{
|
|
|
|
/* Notes: we return a valid key even if id's low order 8 bits are 0. */
|
|
key_t
|
|
ftok (const char *path, int id)
|
|
{
|
|
struct __stat64 statbuf;
|
|
if (stat64 (path, &statbuf))
|
|
{
|
|
/* stat set the appropriate errno for us */
|
|
return (key_t) -1;
|
|
}
|
|
|
|
/* dev_t is short for cygwin
|
|
* ino_t is long for cygwin
|
|
* and we need 8 bits for the id.
|
|
* thus key_t is long long.
|
|
*/
|
|
return ((long long) statbuf.st_dev << (5*8)) | (statbuf.st_ino << (8) ) | (id & 0x00ff);
|
|
}
|
|
|
|
}
|