github.com/tcnksm/go@v0.0.0-20141208075154-439b32936367/src/syscall/types_plan9.c (about)

     1  // Copyright 2009 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  // +build ignore
     6  
     7  /*
     8  Input to godefs.  See also mkerrors.sh and mkall.sh
     9  */
    10  
    11  typedef unsigned short ushort;
    12  typedef unsigned char uchar;
    13  typedef unsigned long ulong;
    14  typedef unsigned int uint;
    15  typedef long long vlong;
    16  typedef unsigned long long uvlong;
    17  
    18  typedef int $_C_int;
    19  
    20  enum {
    21  	OREAD	= 0,	// open for read
    22  	OWRITE	= 1,	// write
    23  	ORDWR	= 2,	// read and write
    24  	OEXEC	= 3,	// execute, == read but check execute permission
    25  	OTRUNC	= 16,	// or'ed in (except for exec), truncate file first
    26  	OCEXEC	= 32,	// or'ed in, close on exec
    27  	ORCLOSE	= 64,		// or'ed in, remove on close
    28  	OEXCL	= 0x1000,	// or'ed in, exclusive use (create only)
    29  
    30  	$O_RDONLY	= OREAD,
    31  	$O_WRONLY	= OWRITE,
    32  	$O_RDWR		= ORDWR,
    33  	$O_TRUNC	= OTRUNC,
    34  	$O_CLOEXEC	= OCEXEC,
    35  	$O_EXCL		= OEXCL,
    36  
    37  	$STATMAX	= 65535U,
    38  	$ERRMAX		= 128,
    39  
    40  	$MORDER		= 0x0003,	// mask for bits defining order of mounting
    41  	$MREPL		= 0x0000,	// mount replaces object
    42  	$MBEFORE	= 0x0001,	// mount goes before others in union directory
    43  	$MAFTER		= 0x0002,	// mount goes after others in union directory
    44  	$MCREATE	= 0x0004,	// permit creation in mounted directory
    45  	$MCACHE		= 0x0010,	// cache some data
    46  	$MMASK		= 0x0017,	// all bits on
    47  
    48  	$RFNAMEG	= (1<<0),
    49  	$RFENVG		= (1<<1),
    50  	$RFFDG		= (1<<2),
    51  	$RFNOTEG	= (1<<3),
    52  	$RFPROC		= (1<<4),
    53  	$RFMEM		= (1<<5),
    54  	$RFNOWAIT	= (1<<6),
    55  	$RFCNAMEG	= (1<<10),
    56  	$RFCENVG	= (1<<11),
    57  	$RFCFDG		= (1<<12),
    58  	$RFREND		= (1<<13),
    59  	$RFNOMNT	= (1<<14),
    60  
    61  	// bits in Qid.type
    62  	$QTDIR		= 0x80,		// type bit for directories
    63  	$QTAPPEND	= 0x40,		// type bit for append only files
    64  	$QTEXCL		= 0x20,		// type bit for exclusive use files
    65  	$QTMOUNT	= 0x10,		// type bit for mounted channel
    66  	$QTAUTH		= 0x08,		// type bit for authentication file
    67  	$QTTMP		= 0x04,		// type bit for not-backed-up file
    68  	$QTFILE		= 0x00,		// plain file
    69  
    70  
    71  	// bits in Dir.mode
    72  	$DMDIR		= 0x80000000,	// mode bit for directories
    73  	$DMAPPEND	= 0x40000000,	// mode bit for append only files
    74  	$DMEXCL		= 0x20000000,	// mode bit for exclusive use files
    75  	$DMMOUNT	= 0x10000000,	// mode bit for mounted channel
    76  	$DMAUTH		= 0x08000000,	// mode bit for authentication file
    77  	$DMTMP		= 0x04000000,	// mode bit for non-backed-up files
    78  	$DMREAD		= 0x4,		// mode bit for read permission
    79  	$DMWRITE	= 0x2,		// mode bit for write permission
    80  	$DMEXEC		= 0x1,		// mode bit for execute permission
    81  
    82  	BIT8SZ	= 1,
    83  	BIT16SZ	= 2,
    84  	BIT32SZ	= 4,
    85  	BIT64SZ	= 8,
    86  	QIDSZ = BIT8SZ+BIT32SZ+BIT64SZ,
    87  
    88  	// STATFIXLEN includes leading 16-bit count
    89  	// The count, however, excludes itself; total size is BIT16SZ+count
    90  	$STATFIXLEN = BIT16SZ+QIDSZ+5*BIT16SZ+4*BIT32SZ+1*BIT64SZ,	// amount of fixed length data in a stat buffer
    91  };
    92  
    93  
    94  struct Prof			// Per process profiling
    95  {
    96  	struct Plink	*pp;	// known to be 0(ptr)
    97  	struct Plink	*next;	// known to be 4(ptr)
    98  	struct Plink	*last;
    99  	struct Plink	*first;
   100  	ulong		pid;
   101  	ulong		what;
   102  };
   103  
   104  struct Tos {
   105  	struct Prof	prof;
   106  	uvlong		cyclefreq;	// cycle clock frequency if there is one, 0 otherwise
   107  	vlong		kcycles;	// cycles spent in kernel
   108  	vlong		pcycles;	// cycles spent in process (kernel + user)
   109  	ulong		pid;		// might as well put the pid here
   110  	ulong		clock;
   111  	// top of stack is here
   112  };
   113  
   114  typedef struct Prof $Prof;
   115  typedef struct Tos $Tos;