Apple2: implement stat(2) and statvfs(3)
This commit is contained in:
committed by
Oliver Schmidt
parent
4343eebe67
commit
75461e1319
@@ -2,7 +2,7 @@
|
||||
/* */
|
||||
/* stat.h */
|
||||
/* */
|
||||
/* Constants for the mode argument of open and creat */
|
||||
/* stat(2) definition */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
@@ -11,6 +11,9 @@
|
||||
/* D-70794 Filderstadt */
|
||||
/* EMail: uz@cc65.org */
|
||||
/* */
|
||||
/* (C) 2023 Colin Leroy-Mira */
|
||||
/* EMail: colin@colino.net */
|
||||
/* */
|
||||
/* */
|
||||
/* This software is provided 'as-is', without any expressed or implied */
|
||||
/* warranty. In no event will the authors be held liable for any damages */
|
||||
@@ -36,6 +39,10 @@
|
||||
#ifndef _STAT_H
|
||||
#define _STAT_H
|
||||
|
||||
#include <time.h>
|
||||
#include <target.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
@@ -47,6 +54,30 @@
|
||||
#define S_IREAD 0x01
|
||||
#define S_IWRITE 0x02
|
||||
|
||||
#define S_IFMT 0x03
|
||||
|
||||
struct stat {
|
||||
dev_t st_dev;
|
||||
ino_t st_ino;
|
||||
mode_t st_mode;
|
||||
nlink_t st_nlink;
|
||||
uid_t st_uid;
|
||||
gid_t st_gid;
|
||||
off_t st_size;
|
||||
struct timespec st_atim;
|
||||
struct timespec st_ctim;
|
||||
struct timespec st_mtim;
|
||||
#ifdef __APPLE2__
|
||||
unsigned char st_access;
|
||||
unsigned char st_type;
|
||||
unsigned int st_auxtype;
|
||||
unsigned char st_storagetype;
|
||||
unsigned int st_blocks;
|
||||
struct datetime st_mtime;
|
||||
struct datetime st_ctime;
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
@@ -55,5 +86,9 @@
|
||||
|
||||
|
||||
|
||||
int __fastcall__ stat (const char* pathname, struct stat* statbuf);
|
||||
|
||||
|
||||
|
||||
/* End of stat.h */
|
||||
#endif
|
||||
|
||||
74
include/sys/statvfs.h
Normal file
74
include/sys/statvfs.h
Normal file
@@ -0,0 +1,74 @@
|
||||
/*****************************************************************************/
|
||||
/* */
|
||||
/* statvfs.h */
|
||||
/* */
|
||||
/* statvfs(3) definition */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* (C) 2023 Colin Leroy-Mira */
|
||||
/* EMail: colin@colino.net */
|
||||
/* */
|
||||
/* */
|
||||
/* This software is provided 'as-is', without any expressed or implied */
|
||||
/* warranty. In no event will the authors be held liable for any damages */
|
||||
/* arising from the use of this software. */
|
||||
/* */
|
||||
/* Permission is granted to anyone to use this software for any purpose, */
|
||||
/* including commercial applications, and to alter it and redistribute it */
|
||||
/* freely, subject to the following restrictions: */
|
||||
/* */
|
||||
/* 1. The origin of this software must not be misrepresented; you must not */
|
||||
/* claim that you wrote the original software. If you use this software */
|
||||
/* in a product, an acknowledgment in the product documentation would be */
|
||||
/* appreciated but is not required. */
|
||||
/* 2. Altered source versions must be plainly marked as such, and must not */
|
||||
/* be misrepresented as being the original software. */
|
||||
/* 3. This notice may not be removed or altered from any source */
|
||||
/* distribution. */
|
||||
/* */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
|
||||
#ifndef _STATVFS_H
|
||||
#define _STATVFS_H
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Data */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
|
||||
struct statvfs {
|
||||
unsigned long f_bsize;
|
||||
unsigned long f_frsize;
|
||||
fsblkcnt_t f_blocks;
|
||||
fsblkcnt_t f_bfree;
|
||||
fsblkcnt_t f_bavail;
|
||||
fsfilcnt_t f_files;
|
||||
fsfilcnt_t f_ffree;
|
||||
fsfilcnt_t f_favail;
|
||||
unsigned long f_fsid;
|
||||
unsigned long f_flag;
|
||||
unsigned long f_namemax;
|
||||
};
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Code */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
|
||||
int __fastcall__ statvfs (const char* pathname, struct statvfs* buf);
|
||||
|
||||
|
||||
|
||||
/* End of statvfs.h */
|
||||
#endif
|
||||
@@ -50,6 +50,46 @@
|
||||
typedef long int off_t;
|
||||
#endif
|
||||
|
||||
#ifndef _HAVE_dev_t
|
||||
#define _HAVE_dev_t
|
||||
typedef unsigned long int dev_t;
|
||||
#endif
|
||||
|
||||
#ifndef _HAVE_ino_t
|
||||
#define _HAVE_ino_t
|
||||
typedef unsigned long int ino_t;
|
||||
#endif
|
||||
|
||||
#ifndef _HAVE_nlink_t
|
||||
#define _HAVE_nlink_t
|
||||
typedef unsigned long int nlink_t;
|
||||
#endif
|
||||
|
||||
#ifndef _HAVE_uid_t
|
||||
#define _HAVE_uid_t
|
||||
typedef unsigned char uid_t;
|
||||
#endif
|
||||
|
||||
#ifndef _HAVE_gid_t
|
||||
#define _HAVE_gid_t
|
||||
typedef unsigned char gid_t;
|
||||
#endif
|
||||
|
||||
#ifndef _HAVE_mode_t
|
||||
#define _HAVE_mode_t
|
||||
typedef unsigned char mode_t;
|
||||
#endif
|
||||
|
||||
#ifndef _HAVE_fsblkcnt_t
|
||||
#define _HAVE_fsblkcnt_t
|
||||
typedef unsigned long int fsblkcnt_t;
|
||||
#endif
|
||||
|
||||
#ifndef _HAVE_fsfilcnt_t
|
||||
#define _HAVE_fsfilcnt_t
|
||||
typedef unsigned long int fsfilcnt_t;
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
@@ -60,6 +100,3 @@ typedef long int off_t;
|
||||
|
||||
/* End of types.h */
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user