aboutsummaryrefslogtreecommitdiff
path: root/sys/sys
diff options
context:
space:
mode:
authorDavid Schultz <das@FreeBSD.org>2005-03-22 01:19:18 +0000
committerDavid Schultz <das@FreeBSD.org>2005-03-22 01:19:18 +0000
commit3eea66586b6524d6bf76902b9075d6740bb6e7e7 (patch)
tree87aa2b0c0dfa25a01d68ae0f08668be118b8faf9 /sys/sys
parent3edf7a78b76a275c0212c939687e479f17aa86ab (diff)
downloadsrc-3eea66586b6524d6bf76902b9075d6740bb6e7e7.tar.gz
src-3eea66586b6524d6bf76902b9075d6740bb6e7e7.zip
- Declare mknod in stat.h (in addition to unistd.h), as per XSI.
- Use blksize_t and blkcnt_t in struct stat. - Hide non-standard fields in stat.h when !__BSD_VISIBLE. - Add restrict qualifiers in stat.h.
Notes
Notes: svn path=/head/; revision=143952
Diffstat (limited to 'sys/sys')
-rw-r--r--sys/sys/_types.h2
-rw-r--r--sys/sys/stat.h34
-rw-r--r--sys/sys/types.h10
3 files changed, 35 insertions, 11 deletions
diff --git a/sys/sys/_types.h b/sys/sys/_types.h
index 3047e985337b..cde80d949392 100644
--- a/sys/sys/_types.h
+++ b/sys/sys/_types.h
@@ -35,6 +35,8 @@
/*
* Standard type definitions.
*/
+typedef __uint32_t __blksize_t; /* file block size */
+typedef __int64_t __blkcnt_t; /* file block count */
typedef __int32_t __clockid_t; /* clock_gettime()... */
typedef __uint32_t __fflags_t; /* file flags */
typedef __uint64_t __fsblkcnt_t;
diff --git a/sys/sys/stat.h b/sys/sys/stat.h
index 0f7e349404b5..10a3739cc440 100644
--- a/sys/sys/stat.h
+++ b/sys/sys/stat.h
@@ -41,7 +41,15 @@
#include <sys/cdefs.h>
#include <sys/_types.h>
-/* XXX missing blkcnt_t, blksize_t. */
+#ifndef _BLKSIZE_T_DECLARED
+typedef __blksize_t blksize_t;
+#define _BLKSIZE_T_DECLARED
+#endif
+
+#ifndef _BLKCNT_T_DECLARED
+typedef __blkcnt_t blkcnt_t;
+#define _BLKCNT_T_DECLARED
+#endif
#ifndef _DEV_T_DECLARED
typedef __dev_t dev_t;
@@ -134,15 +142,15 @@ struct stat {
struct timespec st_ctimespec; /* time of last file status change */
#else
time_t st_atime; /* time of last access */
- long st_atimensec; /* nsec of last access */
+ long __st_atimensec; /* nsec of last access */
time_t st_mtime; /* time of last data modification */
- long st_mtimensec; /* nsec of last data modification */
+ long __st_mtimensec; /* nsec of last data modification */
time_t st_ctime; /* time of last file status change */
- long st_ctimensec; /* nsec of last file status change */
+ 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 */
- __uint32_t st_blksize; /* optimal blocksize for I/O */
+ blkcnt_t st_blocks; /* blocks allocated for file */
+ blksize_t st_blksize; /* optimal blocksize for I/O */
fflags_t st_flags; /* user defined flags for file */
__uint32_t st_gen; /* file generation number */
__int32_t st_lspare;
@@ -179,8 +187,8 @@ struct nstat {
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 */
- __uint32_t st_blksize; /* optimal blocksize for I/O */
+ blkcnt_t st_blocks; /* blocks allocated for file */
+ blksize_t st_blksize; /* optimal blocksize for I/O */
fflags_t st_flags; /* user defined flags for file */
__uint32_t st_gen; /* file generation number */
struct timespec st_birthtimespec; /* time of file creation */
@@ -250,7 +258,7 @@ struct nstat {
#define S_ISLNK(m) (((m) & 0170000) == 0120000) /* symbolic link */
#define S_ISSOCK(m) (((m) & 0170000) == 0140000) /* socket */
#endif
-#if __XSI_VISIBLE
+#if __BSD_VISIBLE
#define S_ISWHT(m) (((m) & 0170000) == 0160000) /* whiteout */
#endif
@@ -312,11 +320,15 @@ int lchflags(const char *, int);
int lchmod(const char *, mode_t);
#endif
#if __POSIX_VISIBLE >= 200112
-int lstat(const char *, struct stat *);
+int lstat(const char * __restrict, struct stat * __restrict);
#endif
int mkdir(const char *, mode_t);
int mkfifo(const char *, mode_t);
-int stat(const char *, struct stat *);
+#if !defined(_MKNOD_DECLARED) && __XSI_VISIBLE
+int mknod(const char *, mode_t, dev_t);
+#define _MKNOD_DECLARED
+#endif
+int stat(const char * __restrict, struct stat * __restrict);
mode_t umask(mode_t);
__END_DECLS
#endif /* !_KERNEL */
diff --git a/sys/sys/types.h b/sys/sys/types.h
index 4910204a5057..27eecc68ad6c 100644
--- a/sys/sys/types.h
+++ b/sys/sys/types.h
@@ -117,6 +117,16 @@ typedef char * caddr_t; /* core address */
typedef __const char * c_caddr_t; /* core address, pointer to const */
typedef __volatile char *v_caddr_t; /* core address, pointer to volatile */
+#ifndef _BLKSIZE_T_DECLARED
+typedef __blksize_t blksize_t;
+#define _BLKSIZE_T_DECLARED
+#endif
+
+#ifndef _BLKCNT_T_DECLARED
+typedef __blkcnt_t blkcnt_t;
+#define _BLKCNT_T_DECLARED
+#endif
+
#ifndef _CLOCK_T_DECLARED
typedef __clock_t clock_t;
#define _CLOCK_T_DECLARED