From owner-freebsd-standards Thu Mar 6 17:24:52 2003 Delivered-To: freebsd-standards@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 3B7E937B401; Thu, 6 Mar 2003 17:24:44 -0800 (PST) Received: from espresso.bsdmike.org (espresso.bsdmike.org [65.39.129.122]) by mx1.FreeBSD.org (Postfix) with ESMTP id 2CE6343FB1; Thu, 6 Mar 2003 17:24:43 -0800 (PST) (envelope-from mike@espresso.bsdmike.org) Received: by espresso.bsdmike.org (Postfix, from userid 1002) id DC9A29C4C; Thu, 6 Mar 2003 20:11:45 -0500 (EST) Date: Thu, 6 Mar 2003 20:11:45 -0500 From: Mike Barcroft To: standards@freebsd.org, corecode@corecode.ath.cx Cc: markm@freebsd.org Subject: Re: cvs commit: src/sys/sys stat.h Message-ID: <20030306201145.M70629@espresso.bsdmike.org> References: <200302262010.h1QKAsMT007004@repoman.freebsd.org> <20030306194945.126c092f.corecode@corecode.ath.cx> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="bg08WKrSYDhXBjb5" Content-Disposition: inline In-Reply-To: <20030306194945.126c092f.corecode@corecode.ath.cx>; from corecode@corecode.ath.cx on Thu, Mar 06, 2003 at 07:49:45PM +0100 Organization: The FreeBSD Project Sender: owner-freebsd-standards@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG --bg08WKrSYDhXBjb5 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Simon 'corecode' Schubert writes: > Lately Mike Barcroft told: > > > mike 2003/02/26 12:10:54 PST > > > > Modified files: > > sys/sys stat.h > > Log: > > Change spelling of `u_int' to `unsigned int' in the POSIX case. > > if this catched the POSIX case it would be good. bad thing is it doesn't > catch it. imagine: [...] Yes, I know, it was just a quick fix to unbreak world. Here's a patch I haven't committed yet (I want to review the specification again). Best regards, Mike Barcroft --bg08WKrSYDhXBjb5 Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="stat.diff" Add missing types, update standard namespaces, and use variable types that don't require . Index: stat.h =================================================================== RCS file: /work/repo/src/sys/sys/stat.h,v retrieving revision 1.32 diff -u -r1.32 stat.h --- stat.h 26 Feb 2003 20:10:54 -0000 1.32 +++ stat.h 27 Feb 2003 16:17:18 -0000 @@ -45,11 +45,48 @@ #include #include +/* XXX missing blkcnt_t, blksize_t, dev_t. */ + #ifndef _FFLAGS_T_DECLARED -typedef __fflags_t fflags_t; /* file flags */ +typedef __fflags_t fflags_t; #define _FFLAGS_T_DECLARED #endif +#ifndef _GID_T_DECLARED +typedef __gid_t gid_t; +#define _GID_T_DECLARED +#endif + +#ifndef _INO_T_DECLARED +typedef __ino_t ino_t; +#define _INO_T_DECLARED +#endif + +#ifndef _MODE_T_DECLARED +typedef __mode_t mode_t; +#define _MODE_T_DECLARED +#endif + +#ifndef _NLINK_T_DECLARED +typedef __nlink_t nlink_t; +#define _NLINK_T_DECLARED +#endif + +#ifndef _OFF_T_DECLARED +typedef __off_t off_t; +#define _OFF_T_DECLARED +#endif + +#ifndef _TIME_T_DECLARED +typedef __time_t time_t; +#define _TIME_T_DECLARED +#endif + +#ifndef _UID_T_DECLARED +typedef __uid_t uid_t; +#define _UID_T_DECLARED +#endif + #if !defined(_KERNEL) && !defined(_POSIX_SOURCE) /* * XXX we need this for struct timespec. We get miscellaneous namespace @@ -62,31 +99,31 @@ #include #endif -#ifdef _KERNEL +#ifdef _KERNEL /* XXX __dev_t should be in . */ #define __dev_t udev_t #else #define __dev_t dev_t #endif -#ifndef _POSIX_SOURCE +#if __BSD_VISIBLE struct ostat { - u_int16_t st_dev; /* inode's device */ + __uint16_t st_dev; /* inode's device */ ino_t st_ino; /* inode's number */ mode_t st_mode; /* inode protection mode */ nlink_t st_nlink; /* number of hard links */ - u_int16_t st_uid; /* user ID of the file's owner */ - u_int16_t st_gid; /* group ID of the file's group */ - u_int16_t st_rdev; /* device type */ - int32_t st_size; /* file size, in bytes */ + __uint16_t st_uid; /* user ID of the file's owner */ + __uint16_t st_gid; /* group ID of the file's group */ + __uint16_t st_rdev; /* device type */ + __int32_t st_size; /* file size, in bytes */ struct timespec st_atimespec; /* time of last access */ struct timespec st_mtimespec; /* time of last data modification */ struct timespec st_ctimespec; /* time of last file status change */ - int32_t st_blksize; /* optimal blocksize for I/O */ - int32_t st_blocks; /* blocks allocated for file */ + __int32_t st_blksize; /* optimal blocksize for I/O */ + __int32_t st_blocks; /* blocks allocated for file */ fflags_t st_flags; /* user defined flags for file */ - u_int32_t st_gen; /* file generation number */ + __uint32_t st_gen; /* file generation number */ }; -#endif /* !_POSIX_SOURCE */ +#endif /* __BSD_VISIBLE */ struct stat { __dev_t st_dev; /* inode's device */ @@ -96,7 +133,7 @@ uid_t st_uid; /* user ID of the file's owner */ gid_t st_gid; /* group ID of the file's group */ __dev_t st_rdev; /* device type */ -#ifndef _POSIX_SOURCE +#if __BSD_VISIBLE struct timespec st_atimespec; /* time of last access */ struct timespec st_mtimespec; /* time of last data modification */ struct timespec st_ctimespec; /* time of last file status change */ @@ -109,12 +146,12 @@ long st_ctimensec; /* nsec of last file status change */ #endif off_t st_size; /* file size, in bytes */ - int64_t st_blocks; /* blocks allocated for file */ - u_int32_t st_blksize; /* optimal blocksize for I/O */ + __int64_t st_blocks; /* blocks allocated for file */ + __uint32_t st_blksize; /* optimal blocksize for I/O */ fflags_t st_flags; /* user defined flags for file */ - u_int32_t st_gen; /* file generation number */ - int32_t st_lspare; -#ifndef _POSIX_SOURCE + __uint32_t st_gen; /* file generation number */ + __int32_t st_lspare; +#if __BSD_VISIBLE struct timespec st_birthtimespec; /* time of file creation */ /* * Explicitly pad st_birthtimespec to 16 bytes so that the size of @@ -124,8 +161,8 @@ * to cover up to 64 bits on 32-bit machines. We assume that * CHAR_BIT is 8... */ - u_int :(8 / 2) * (16 - (int)sizeof(struct timespec)); - u_int :(8 / 2) * (16 - (int)sizeof(struct timespec)); + unsigned int :(8 / 2) * (16 - (int)sizeof(struct timespec)); + unsigned int :(8 / 2) * (16 - (int)sizeof(struct timespec)); #else time_t st_birthtime; /* time of file creation */ long st_birthtimensec; /* nsec of file creation */ @@ -134,12 +171,12 @@ #endif }; -#ifndef _POSIX_SOURCE +#if __BSD_VISIBLE struct nstat { __dev_t st_dev; /* inode's device */ ino_t st_ino; /* inode's number */ - u_int32_t st_mode; /* inode protection mode */ - u_int32_t st_nlink; /* number of hard links */ + __uint32_t st_mode; /* inode protection mode */ + __uint32_t st_nlink; /* number of hard links */ uid_t st_uid; /* user ID of the file's owner */ gid_t st_gid; /* group ID of the file's group */ __dev_t st_rdev; /* device type */ @@ -147,22 +184,22 @@ struct timespec st_mtimespec; /* time of last data modification */ struct timespec st_ctimespec; /* time of last file status change */ off_t st_size; /* file size, in bytes */ - int64_t st_blocks; /* blocks allocated for file */ - u_int32_t st_blksize; /* optimal blocksize for I/O */ + __int64_t st_blocks; /* blocks allocated for file */ + __uint32_t st_blksize; /* optimal blocksize for I/O */ fflags_t st_flags; /* user defined flags for file */ - u_int32_t st_gen; /* file generation number */ + __uint32_t st_gen; /* file generation number */ struct timespec st_birthtimespec; /* time of file creation */ /* * See above about the following padding. */ - u_int :(8 / 2) * (16 - (int)sizeof(struct timespec)); - u_int :(8 / 2) * (16 - (int)sizeof(struct timespec)); + unsigned int :(8 / 2) * (16 - (int)sizeof(struct timespec)); + unsigned int :(8 / 2) * (16 - (int)sizeof(struct timespec)); }; #endif #undef __dev_t -#ifndef _POSIX_SOURCE +#if __BSD_VISIBLE #define st_atime st_atimespec.tv_sec #define st_mtime st_mtimespec.tv_sec #define st_ctime st_ctimespec.tv_sec @@ -171,7 +208,7 @@ #define S_ISUID 0004000 /* set user id on execution */ #define S_ISGID 0002000 /* set group id on execution */ -#ifndef _POSIX_SOURCE +#if __BSD_VISIBLE #define S_ISTXT 0001000 /* sticky bit */ #endif @@ -180,7 +217,7 @@ #define S_IWUSR 0000200 /* W for owner */ #define S_IXUSR 0000100 /* X for owner */ -#ifndef _POSIX_SOURCE +#if __BSD_VISIBLE #define S_IREAD S_IRUSR #define S_IWRITE S_IWUSR #define S_IEXEC S_IXUSR @@ -196,7 +233,7 @@ #define S_IWOTH 0000002 /* W for other */ #define S_IXOTH 0000001 /* X for other */ -#ifndef _POSIX_SOURCE +#if __XSI_VISIBLE #define S_IFMT 0170000 /* type of file mask */ #define S_IFIFO 0010000 /* named pipe (fifo) */ #define S_IFCHR 0020000 /* character special */ @@ -205,22 +242,26 @@ #define S_IFREG 0100000 /* regular */ #define S_IFLNK 0120000 /* symbolic link */ #define S_IFSOCK 0140000 /* socket */ -#define S_IFWHT 0160000 /* whiteout */ #define S_ISVTX 0001000 /* save swapped text even after use */ #endif +#if __BSD_VISIBLE +#define S_IFWHT 0160000 /* whiteout */ +#endif #define S_ISDIR(m) (((m) & 0170000) == 0040000) /* directory */ #define S_ISCHR(m) (((m) & 0170000) == 0020000) /* char special */ #define S_ISBLK(m) (((m) & 0170000) == 0060000) /* block special */ #define S_ISREG(m) (((m) & 0170000) == 0100000) /* regular file */ #define S_ISFIFO(m) (((m) & 0170000) == 0010000) /* fifo or socket */ -#ifndef _POSIX_SOURCE +#if __POSIX_VISIBLE >= 200112 #define S_ISLNK(m) (((m) & 0170000) == 0120000) /* symbolic link */ #define S_ISSOCK(m) (((m) & 0170000) == 0140000) /* socket */ +#endif +#if __XSI_VISIBLE #define S_ISWHT(m) (((m) & 0170000) == 0160000) /* whiteout */ #endif -#ifndef _POSIX_SOURCE +#if __BSD_VISIBLE #define ACCESSPERMS (S_IRWXU|S_IRWXG|S_IRWXO) /* 0777 */ /* 7777 */ #define ALLPERMS (S_ISUID|S_ISGID|S_ISTXT|S_IRWXU|S_IRWXG|S_IRWXO) @@ -260,27 +301,31 @@ #define NOUNLINK (UF_NOUNLINK | SF_NOUNLINK) #endif -#endif /* !_POSIX_SOURCE */ +#endif /* __BSD_VISIBLE */ #ifndef _KERNEL __BEGIN_DECLS -int chmod(const char *, mode_t); -int fstat(int, struct stat *); -int mkdir(const char *, mode_t); -int mkfifo(const char *, mode_t); -int stat(const char *, struct stat *); -mode_t umask(mode_t); - -#ifndef _POSIX_SOURCE +#if __BSD_VISIBLE int chflags(const char *, unsigned long); -int lchflags(const char *, int); +#endif +int chmod(const char *, mode_t); +#if __BSD_VISIBLE int fchflags(int, unsigned long); int fchmod(int, mode_t); +#endif +int fstat(int, struct stat *); +#if __BSD_VISIBLE +int lchflags(const char *, int); int lchmod(const char *, mode_t); +#endif +#if __POSIX_VISIBLE >= 200112 int lstat(const char *, struct stat *); #endif +int mkdir(const char *, mode_t); +int mkfifo(const char *, mode_t); +int stat(const char *, struct stat *); +mode_t umask(mode_t); __END_DECLS - #endif /* !_KERNEL */ #endif /* !_SYS_STAT_H_ */ --bg08WKrSYDhXBjb5-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-standards" in the body of the message