UnixFsysTypes.h
资源名称:warftpd.zip [点击查看]
上传用户:surprise9
上传日期:2007-01-04
资源大小:426k
文件大小:8k
源码类别:
Ftp客户端
开发平台:
Visual C++
- // This is part of the WAR SOFTWARE SERIES initiated by Jarle Aase
- // Copyright 1996 by Jarle Aase. All rights reserved.
- // See the "War Software Series Licende Agreement" for details concerning
- // use and distribution.
- // ---
- // This source code, executables and programs containing source code or
- // binaries or proprietetary technology from the War Software Series are
- // NOT alloed used, viewed or tested by any governmental agencies in
- // any countries. This includes the government, departments, police,
- // military etc.
- // ---
- // This file is intended for use with Tab space = 2
- // Created and maintained in MSVC Developer Studio
- // ---
- // NAME : UnixFsysTypes.h
- // PURPOSE : General entry point module for War Daemons
- // ORIGIN : Some manifests from UNIX <stat/types.h>, other from
- // VfSys.h in War FTP daemon 1.*
- // PROGRAM :
- // DATE : Oct. 13 1996
- // AUTHOR : Jarle Aase
- // ---
- // REVISION HISTORY
- //
- // We try to stay as close to UNIX as possible when working with permissions.
- // However, we need an extra set of permissons pr. class for free and hide
- // bits. We also use our own bits for links and directories so that we can
- // distinguish between links to files and linke to directorioes.
- // And - since we are not a "real" file system - we need to know if the file/dir
- // is read-only.
- /* Bit layout for the file mode (m_Flags)
- 30 20 10
- | 2 | 1 | 0 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 |
- +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
- | | | w | W | W | W | W | W | W | | W | W | | W | W | | X | X | X | X | X | X | X | X | X | X | X | X | X | X | X | X |
- +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
- | | | S | s | s | s | s | p | p | | p | p | | p | p | | s | s | s | s | s | s | s | p | p | p | p | p | p | p | p | p |
- | | |dsk|vir|dir|lnk|sro| U | U | | G | G | | O | O | | | | | | | | | U | U | U | G | G | G | O | O | O |
- | | | | | | | | f | h | | f | h | | f | h | |reg|dir| cs| np|uox|gox| sb| r | w | x | r | w | x | r | w | x |
- | | | | | | | | | | | | | | | | |---| bls | | | | | | | | | | | | | |
- | | | | | | | | | | | | | | | | |lnk --- lnk| | | | | | | | | | | | | |
- | | | | | | | | | | | | | | | | | soc |---| | | | | | | | | | | | | |
- | | | | | | | | | | | | | | | | | who | | | |sav| | | | | | | | | |
- X = UNIX U = user G = group O = other W = War
- r = read w = write x = exec f = free h = hide
- s = system
- dsk = Drive
- vir = Virtual file (Only exist in memory)
- sro = System Read Only (or CD-ROM)
- uox = S_ISUID set user id on execution
- gox = S_ISGID set group id on execution
- sb = S_ISTXT sticky bit
- np = S_IFIFO named pipe (fifo)
- cs = S_IFCHR character special
- dir = S_IFDIR directory
- bls = S_IFBLK block special
- reg = S_IFREG regular
- lnk = S_IFLNK symbolic link
- soc = S_IFSOCK socket
- sav = S_ISVTX save swapped text even after use
- who = S_IFWHT whiteout
- */
- #ifndef __UNIXFSYSTYPESH
- #define __UNIXFSYSTYPESH
- #define S_ISUID 0004000 /* set user id on execution */
- #define S_ISGID 0002000 /* set group id on execution */
- #ifndef _POSIX_SOURCE
- #define S_ISTXT 0001000 /* sticky bit */
- #endif
- #define S_IRWXU 0000700 /* RWX mask for owner */
- #define S_IRUSR 0000400 /* R for owner */
- #define S_IWUSR 0000200 /* W for owner */
- #define S_IXUSR 0000100 /* X for owner */
- #ifndef _POSIX_SOURCE
- #ifdef S_IREAD // <sys/stat> is included
- #undef S_IREAD
- #undef S_IWRITE
- #undef S_IEXEC
- #undef S_IFMT
- #undef S_IFCHR
- #undef S_IFDIR
- #undef S_IFREG
- #endif // <sys/stat>
- #define S_IREAD S_IRUSR
- #define S_IWRITE S_IWUSR
- #define S_IEXEC S_IXUSR
- #endif // Posix
- #define S_IRWXG 0000070 /* RWX mask for group */
- #define S_IRGRP 0000040 /* R for group */
- #define S_IWGRP 0000020 /* W for group */
- #define S_IXGRP 0000010 /* X for group */
- #define S_IRWXO 0000007 /* RWX mask for other */
- #define S_IROTH 0000004 /* R for other */
- #define S_IWOTH 0000002 /* W for other */
- #define S_IXOTH 0000001 /* X for other */
- // Currently not used by War
- #ifndef _POSIX_SOURCE
- #define S_IFMT 0170000 /* type of file mask */
- #define S_IFIFO 0010000 /* named pipe (fifo) */
- #define S_IFCHR 0020000 /* character special */
- #define S_IFDIR 0040000 /* directory */
- #define S_IFBLK 0060000 /* block special */
- #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
- // Currently not used by War
- #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 ||
- ((m) & 0170000) == 0140000) /* fifo or socket */
- // Currently not used by War
- #ifndef _POSIX_SOURCE
- #define S_ISLNK(m) (((m) & 0170000) == 0120000) /* symbolic link */
- #define S_ISSOCK(m) (((m) & 0170000) == 0010000 ||
- ((m) & 0170000) == 0140000) /* fifo or socket */
- #define S_ISWHT(m) (((m) & 0170000) == 0160000) /* whiteout */
- #endif
- // Currently not used by War
- #ifndef _POSIX_SOURCE
- #define ACCESSPERMS (S_IRWXU|S_IRWXG|S_IRWXO) /* 0777 */
- /* 7777 */
- #define ALLPERMS (S_ISUID|S_ISGID|S_ISTXT|S_IRWXU|S_IRWXG|S_IRWXO)
- /* 0666 */
- #define DEFFILEMODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH)
- #define S_BLKSIZE 512 /* block size used in the stat struct */
- #endif
- // Inode flags
- #define NODE_DIR (1 << 27) // Directory
- #define NODE_VIRTUAL (1 << 28) // No dir, just a name
- #define NODE_READONLY (1 << 25) // Operating system read only
- #define NODE_LINK (1 << 26) // Link
- #define NODE_DRIVE (1 << 29) // Drive
- // Node permissions
- #define NODE_OREAD S_IRUSR // Owner read
- #define NODE_0WRITE S_IWUSR // Owner write
- #define NODE_OEXEC S_IXUSR // Owner execute
- #define NODE_OFREE (1 << 24) // Owner free download
- #define NODE_OHIDE (1 << 23) // Hide from owner
- #define NODE_GREAD S_IRGRP // Group read
- #define NODE_GWRITE S_IWGRP // Group write
- #define NODE_GEXEC S_IXGRP // Group execute
- #define NODE_GFREE (1 << 21) // Group free download
- #define NODE_GHIDE (1 << 20) // Hide from group
- #define NODE_AREAD S_IROTH // All read
- #define NODE_AWRITE S_IWOTH // All write
- #define NODE_AEXEC S_IXOTH // All execute
- #define NODE_AFREE (1 << 18) // All (other) free download
- #define NODE_AHIDE (1 << 17) // Hide from group
- #define NODE_READ 0x0001 // Request read access
- #define NODE_WRITE 0x0002 // Request write/delete access
- #define NODE_EXEC 0x0004 // Request execute/chdir access
- #define NODE_ANY 0x0008 // Request any access
- #define NODE_CREATE 0x0012 // Request permission to create
- #define NODE_HIDE 0x0020 // Is node hidden for user?
- #define NODE_FREE 0x0040 // Is node free for user?
- #define NODE_MBFILE 0 // Must be file
- #define NODE_MBDIR 1 // Must be directory
- #define NODE_MBANY 2 // Can be anything
- #define NODE_WRITEMSK (NODE_0WRITE|NODE_GWRITE|NODE_AWRITE)
- #define NODE_DEFAULT_FILE 0666
- #define NODE_DEFAULT_DIR 0777
- #define NODE_SETTABLE 0x1B61FFF // Mask of bits that the user can chmod...
- #define ISDOT(a) (a[0] == '.')
- #define IS_READONLY(a) (a->m_Flags & NODE_READONLY)
- #define IS_DIRECTORY(a) (a->m_Flags & NODE_DIR)
- #define IS_DRIVE(a) (a->m_Flags & NODE_DRIVE)
- #define IS_LINK(a) (a->m_Flags & NODE_LINK)
- #define IS_EXEC(a) (a->m_Flags & (NODE_OEXEC | NODE_GEXEC | NODE_AEXEC))
- #endif //__UNIXFSYSTYPESH