Files
mono/support/sys-stat.c
T
Jonathan Pryor 37829d3208 * dirent.c, errno.c, fcntl.c, fstab.c, grp.c, macros.c, pwd.c, signal.c,
stdio.c, stdlib.c, string.c, sys-mman.c, sys-sendfile.c, sys-stat.c, 
	  sys-statvfs.c, sys-time.c, sys-xattr.c syslog.c, time.c, unistd.c, 
	  utime.c: Remove structure definitions, and use the
	  create-native-map generated definitions within map.h.  Update function
	  prototypes to match current map.h declarations.
	* map.c, map.h: Flush (current create-native-map output).
	* mph.h: Don't include "map-icalls.h"; "icalls" are now in map.h.
	* create-native-map.exe: Added; cached version of create-native-map.exe
	  used to update map.c, map.h.  (create-native-map.exe source within
	  mono-tools/create-native-map.)
	* Makefile.am: Added update-create-native-map target to update 
	  create-native-map.exe using pkg-config & the create-native-map.pc package. 
		Use create-native-map.exe to generate map.* files instead of make-map.exe.
	* sys-statvfs.c: Add Mono_Posix_ToStatvfs, Mono_Posix_FromStatvfs exports.

svn path=/trunk/mono/; revision=66946
2006-10-24 22:28:25 +00:00

86 lines
1.4 KiB
C

/*
* <sys/stat.h> wrapper functions.
*
* Authors:
* Jonathan Pryor ([email protected])
*
* Copyright (C) 2004-2006 Jonathan Pryor
*/
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif /* ndef _GNU_SOURCE */
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include "map.h"
#include "mph.h"
G_BEGIN_DECLS
gint32
Mono_Posix_Syscall_stat (const char *file_name, struct Mono_Posix_Stat *buf)
{
int r;
struct stat _buf;
if (buf == NULL) {
errno = EFAULT;
return -1;
}
r = stat (file_name, &_buf);
if (r != -1 && Mono_Posix_ToStat (&_buf, buf) == -1)
r = -1;
return r;
}
gint32
Mono_Posix_Syscall_fstat (int filedes, struct Mono_Posix_Stat *buf)
{
int r;
struct stat _buf;
if (buf == NULL) {
errno = EFAULT;
return -1;
}
r = fstat (filedes, &_buf);
if (r != -1 && Mono_Posix_ToStat (&_buf, buf) == -1)
r = -1;
return r;
}
gint32
Mono_Posix_Syscall_lstat (const char *file_name, struct Mono_Posix_Stat *buf)
{
int r;
struct stat _buf;
if (buf == NULL) {
errno = EFAULT;
return -1;
}
r = lstat (file_name, &_buf);
if (r != -1 && Mono_Posix_ToStat (&_buf, buf) == -1)
r = -1;
return r;
}
gint32
Mono_Posix_Syscall_mknod (const char *pathname, guint32 mode, mph_dev_t dev)
{
if (Mono_Posix_FromFilePermissions (mode, &mode) == -1)
return -1;
return mknod (pathname, mode, dev);
}
G_END_DECLS
/*
* vim: noexpandtab
*/