OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /or1k/trunk/newlib-1.10.0/newlib/libc/sys/sparc64/sys
    from Rev 1010 to Rev 1765
    Reverse comparison

Rev 1010 → Rev 1765

/syscall.h
0,0 → 1,346
#ifndef _SYSCALL_H_
#define _SYSCALL_H_
 
/*
* This file defines the system calls for SPARC.
*
* WARNING: This file can be included by assembler files.
*/
 
#define SYS_exit 1
#define SYS_fork 2
#define SYS_read 3
#define SYS_write 4
#define SYS_open 5
#define SYS_close 6
#define SYS_wait4 7
#define SYS_creat 8
#define SYS_link 9
#define SYS_unlink 10
#define SYS_execv 11
#define SYS_chdir 12
#ifdef __svr4__
#define SYS_time 13 /* old time in sunos4 */
#endif
#define SYS_mknod 14
#define SYS_chmod 15
#define SYS_chown 16
#define SYS_brk 17
#ifdef __svr4__
#define SYS_stat 18 /* old stat in sunos4 */
#endif
#define SYS_lseek 19
#define SYS_getpid 20
#ifdef __svr4__
#define SYS_mount 21 /* old mount in sunos4 */
#define SYS_umount 22 /* old umount in sunos4 */
#define SYS_setuid 23 /* old setuid in sunos4 */
#endif
#define SYS_getuid 24
#ifdef __svr4__
#define SYS_stime 25 /* old stime in sunos4 */
#endif
#define SYS_ptrace 26
#ifdef __svr4__
#define SYS_alarm 27 /* old alarm in sunos4 */
#define SYS_fstat 28 /* old fstat in sunos4 */
#define SYS_pause 29 /* old pause in sunos4 */
#define SYS_utime 30 /* old utime in sunos4 */
#define SYS_stty 31 /* old stty in sunos4 */
#define SYS_gtty 32 /* old gtty in sunos4 */
#endif
#define SYS_access 33
#ifdef __svr4__
#define SYS_nice 34 /* old nice in sunos4 */
#define SYS_statfs 35 /* old ftime in sunos4 */
#endif
#define SYS_sync 36
#define SYS_kill 37
#ifdef __svr4__
#define SYS_fstatfs 38
#define SYS_pgrpsys 39 /* old setpgrp in sunos4 */
#define SYS_xenix 40
#else
#define SYS_stat 38
#define SYS_lstat 40
#endif
#define SYS_dup 41
#define SYS_pipe 42
#define SYS_times 43 /* times is obsolete in sunos4, used anyway */
#define SYS_profil 44
#ifdef __svr4__
#define SYS_plock 45 /* unused in sunos4 */
#define SYS_setgid 46 /* old setgid in sunos4 */
#endif
#define SYS_getgid 47
#ifdef __svr4__
#define SYS_signal 48 /* old sigsys in sunos4 */
#define SYS_msgsys 49 /* unused in sunos4 */
#define SYS_sun 50 /* unused in sunos4 */
#endif
#define SYS_acct 51
#ifdef __svr4__
#define SYS_shmsys 52 /* old phys in sunos4 */
#define SYS_semsys 53
#else
#define SYS_mctl 53
#endif
#define SYS_ioctl 54
#ifdef __svr4__
#define SYS_uadmin 55
#else
#define SYS_reboot 55
#endif
/* 56 is old: mpxchan (reserved in sunos5) */
#ifdef __svr4__
#define SYS_utssys 57
#define SYS_fsync 58
#else
#define SYS_symlink 57
#define SYS_readlink 58
#endif
#define SYS_execve 59
#define SYS_umask 60
#define SYS_chroot 61
#ifdef __svr4__
#define SYS_fcntl 62
#define SYS_ulimit 63 /* unused in sunos4 */
/* 64-77 unused/reserved in sunos5 */
#else
#define SYS_fstat 62
#define SYS_getpagesize 64
#define SYS_msync 65
/* 66 is old: vfork */
/* 67 is old: vread */
/* 68 is old: vwrite */
#define SYS_sbrk 69
#define SYS_sstk 70
#define SYS_mmap 71
#define SYS_vadvise 72
#define SYS_munmap 73
#define SYS_mprotect 74
#define SYS_madvise 75
#define SYS_vhangup 76
/* 77 is old: vlimit */
#endif
 
#ifdef __svr4__
#define SYS_rfsys 78
#define SYS_rmdir 79
#define SYS_mkdir 80
#define SYS_getdents 81
/* 82 not used, was libattach */
/* 83 not used, was libdetach */
#define SYS_sysfs 84
#define SYS_getmsg 85
#define SYS_putmsg 86
#define SYS_poll 87
#define SYS_lstat 88
#define SYS_symlink 89
#define SYS_readlink 90
#define SYS_setgroups 91
#define SYS_getgroups 92
#define SYS_fchmod 93
#define SYS_fchown 94
#define SYS_sigprocmask 95
#define SYS_sigsuspend 96
#define SYS_sigaltstack 97
#define SYS_sigaction 98
#define SYS_sigpending 99
#define SYS_context 100
#define SYS_evsys 101
#define SYS_evtrapret 102
#define SYS_statvfs 103
#define SYS_fstatvfs 104
/* 105 reserved */
#define SYS_nfssys 106
#define SYS_waitsys 107
#define SYS_sigsendsys 108
#define SYS_hrtsys 109
#define SYS_acancel 110
#define SYS_async 111
#define SYS_priocntlsys 112
#define SYS_pathconf 113
#define SYS_mincore 114
#define SYS_mmap 115
#define SYS_mprotect 116
#define SYS_munmap 117
#define SYS_fpathconf 118
#define SYS_vfork 119
#define SYS_fchdir 120
#define SYS_readv 121
#define SYS_writev 122
#define SYS_xstat 123
#define SYS_lxstat 124
#define SYS_fxstat 125
#define SYS_xmknod 126
#define SYS_clocal 127
#define SYS_setrlimit 128
#define SYS_getrlimit 129
#define SYS_lchown 130
#define SYS_memcntl 131
#define SYS_getpmsg 132
#define SYS_putpmsg 133
#define SYS_rename 134
#define SYS_uname 135
#define SYS_setegid 136
#define SYS_sysconfig 137
#define SYS_adjtime 138
#define SYS_systeminfo 139
#define SYS_seteuid 141
#define SYS_vtrace 142
#define SYS_fork1 143
#define SYS_sigwait 144
#define SYS_lwp_info 145
#define SYS_yield 146
#define SYS_lwp_sema_p 147
#define SYS_lwp_sema_v 148
#define SYS_modctl 152
#define SYS_fchroot 153
#define SYS_utimes 154
#define SYS_vhangup 155
#define SYS_gettimeofday 156
#define SYS_getitimer 157
#define SYS_setitimer 158
#define SYS_lwp_create 159
#define SYS_lwp_exit 160
#define SYS_lwp_suspend 161
#define SYS_lwp_continue 162
#define SYS_lwp_kill 163
#define SYS_lwp_self 164
#define SYS_lwp_setprivate 165
#define SYS_lwp_getprivate 166
#define SYS_lwp_wait 167
#define SYS_lwp_mutex_unlock 168
#define SYS_lwp_mutex_lock 169
#define SYS_lwp_cond_wait 170
#define SYS_lwp_cond_signal 171
#define SYS_lwp_cond_broadcast 172
#define SYS_pread 173
#define SYS_pwrite 174
#define SYS_llseek 175
#define SYS_inst_sync 176
#define SYS_auditsys 186
#else
#define SYS_mincore 78
#define SYS_getgroups 79
#define SYS_setgroups 80
#define SYS_getpgrp 81
#define SYS_setpgrp 82
#define SYS_setitimer 83
/* 84 is old: wait & wait3 */
#define SYS_swapon 85
#define SYS_getitimer 86
#define SYS_gethostname 87
#define SYS_sethostname 88
#define SYS_getdtablesize 89
#define SYS_dup2 90
#define SYS_getdopt 91
#define SYS_fcntl 92
#define SYS_select 93
#define SYS_setdopt 94
#define SYS_fsync 95
#define SYS_setpriority 96
#define SYS_socket 97
#define SYS_connect 98
#define SYS_accept 99
#define SYS_getpriority 100
#define SYS_send 101
#define SYS_recv 102
/* 103 was socketaddr */
#define SYS_bind 104
#define SYS_setsockopt 105
#define SYS_listen 106
/* 107 was vtimes */
#define SYS_sigvec 108
#define SYS_sigblock 109
#define SYS_sigsetmask 110
#define SYS_sigpause 111
#define SYS_sigstack 112
#define SYS_recvmsg 113
#define SYS_sendmsg 114
#define SYS_vtrace 115
#define SYS_gettimeofday 116
#define SYS_getrusage 117
#define SYS_getsockopt 118
/* 119 is old resuba */
#define SYS_readv 120
#define SYS_writev 121
#define SYS_settimeofday 122
#define SYS_fchown 123
#define SYS_fchmod 124
#define SYS_recvfrom 125
#define SYS_setreuid 126
#define SYS_setregid 127
#define SYS_rename 128
#define SYS_truncate 129
#define SYS_ftruncate 130
#define SYS_flock 131
/* 132 is unused */
#define SYS_sendto 133
#define SYS_shutdown 134
#define SYS_socketpair 135
#define SYS_mkdir 136
#define SYS_rmdir 137
#define SYS_utimes 138
/* 139 is unused */
#define SYS_adjtime 140
#define SYS_getpeername 141
#define SYS_gethostid 142
/* 143 is old: sethostid */
#define SYS_getrlimit 144
#define SYS_setrlimit 145
#define SYS_killpg 146
/* 147 is unused */
/* 148 is old: setquota */
/* 149 is old: quota */
#define SYS_getsockname 150
#define SYS_getmsg 151
#define SYS_putmsg 152
#define SYS_poll 153
/* 154 is old: nfs_mount */
#define SYS_nfssvc 155
#define SYS_getdirentries 156
#define SYS_statfs 157
#define SYS_fstatfs 158
#define SYS_unmount 159
#define SYS_async_daemon 160
#define SYS_getfh 161
#define SYS_getdomainname 162
#define SYS_setdomainname 163
/* 164 is old: pcfs_mount */
#define SYS_quotactl 165
#define SYS_exportfs 166
#define SYS_mount 167
#define SYS_ustat 168
#define SYS_semsys 169
#define SYS_msgsys 170
#define SYS_shmsys 171
#define SYS_auditsys 172
#define SYS_rfssys 173
#define SYS_getdents 174
#define SYS_setsid 175
#define SYS_fchdir 176
#define SYS_fchroot 177
#define SYS_vpixsys 178
 
#define SYS_aioread 179
#define SYS_aiowrite 180
#define SYS_aiowait 181
#define SYS_aiocancel 182
 
#define SYS_sigpending 183
/* 184 is available */
#define SYS_setpgid 185
#define SYS_pathconf 186
#define SYS_fpathconf 187
#define SYS_sysconf 188
 
#define SYS_uname 189
 
#endif /* ! __svr4__ */
 
#endif /* _SYSCALL_H_ */
 
 
 
/stat.h
0,0 → 1,131
#ifndef _SYS_STAT_H
#define _SYS_STAT_H
 
#ifdef __cplusplus
extern "C" {
#endif
 
#include <_ansi.h>
#include <sys/types.h>
 
#ifdef __svr4__
 
#include <sys/time.h>
 
#define _ST_FSTYPSZ 16 /* array size for file system type name */
 
struct stat
{
dev_t st_dev;
long st_pad1[3]; /* reserved for network id */
ino_t st_ino;
mode_t st_mode;
nlink_t st_nlink;
uid_t st_uid;
gid_t st_gid;
dev_t st_rdev;
long st_pad2[2];
off_t st_size;
long st_pad3; /* future off_t expansion */
timestruc_t st_atim;
timestruc_t st_mtim;
timestruc_t st_ctim;
long st_blksize;
long st_blocks;
char st_fstype[_ST_FSTYPSZ];
long st_pad4[8]; /* expansion area */
};
 
#define st_atime st_atim.tv_sec
#define st_mtime st_mtim.tv_sec
#define st_ctime st_ctim.tv_sec
 
#else
 
#include <time.h>
 
struct stat
{
dev_t st_dev;
ino_t st_ino;
mode_t st_mode;
short st_nlink;
uid_t st_uid;
gid_t st_gid;
dev_t st_rdev;
off_t st_size;
time_t st_atime;
int st_spare1;
time_t st_mtime;
int st_spare2;
time_t st_ctime;
int st_spare3;
long st_blksize;
long st_blocks;
long st_spare4[2];
};
 
#endif
 
#define _IFMT 0170000 /* type of file */
#define _IFDIR 0040000 /* directory */
#define _IFCHR 0020000 /* character special */
#define _IFBLK 0060000 /* block special */
#define _IFREG 0100000 /* regular */
#define _IFLNK 0120000 /* symbolic link */
#define _IFSOCK 0140000 /* socket */
#define _IFIFO 0010000 /* fifo */
 
#define S_ISUID 0004000 /* set user id on execution */
#define S_ISGID 0002000 /* set group id on execution */
#ifndef _POSIX_SOURCE
#define S_ISVTX 0001000 /* save swapped text even after use */
#define S_IREAD 0000400 /* read permission, owner */
#define S_IWRITE 0000200 /* write permission, owner */
#define S_IEXEC 0000100 /* execute/search permission, owner */
 
#define S_ENFMT 0002000 /* enforcement-mode locking */
 
#define S_IFMT _IFMT
#define S_IFDIR _IFDIR
#define S_IFCHR _IFCHR
#define S_IFBLK _IFBLK
#define S_IFREG _IFREG
#define S_IFLNK _IFLNK
#define S_IFSOCK _IFSOCK
#define S_IFIFO _IFIFO
#endif /* !_POSIX_SOURCE */
 
 
#define S_IRWXU 0000700 /* rwx, owner */
#define S_IRUSR 0000400 /* read permission, owner */
#define S_IWUSR 0000200 /* write permission, owner */
#define S_IXUSR 0000100 /* execute/search permission, owner */
#define S_IRWXG 0000070 /* rwx, group */
#define S_IRGRP 0000040 /* read permission, group */
#define S_IWGRP 0000020 /* write permission, grougroup */
#define S_IXGRP 0000010 /* execute/search permission, group */
#define S_IRWXO 0000007 /* rwx, other */
#define S_IROTH 0000004 /* read permission, other */
#define S_IWOTH 0000002 /* write permission, other */
#define S_IXOTH 0000001 /* execute/search permission, other */
 
#define S_ISBLK(m) (((m)&_IFMT) == _IFBLK)
#define S_ISCHR(m) (((m)&_IFMT) == _IFCHR)
#define S_ISDIR(m) (((m)&_IFMT) == _IFDIR)
#define S_ISFIFO(m) (((m)&_IFMT) == _IFIFO)
#define S_ISREG(m) (((m)&_IFMT) == _IFREG)
#define S_ISLNK(m) (((m)&_IFMT) == _IFLNK)
#define S_ISSOCK(m) (((m)&_IFMT) == _IFSOCK)
 
int _EXFUN(chmod,( const char *_path, mode_t _mode ));
int _EXFUN(fstat,( int _fd, struct stat *_sbuf ));
int _EXFUN(mkdir,( char *_path, mode_t _mode ));
int _EXFUN(mkfifo,( char *_path, mode_t _mode ));
int _EXFUN(stat,( const char *_path, struct stat *_sbuf ));
mode_t _EXFUN(umask,( mode_t _mask ));
 
#ifdef __cplusplus
}
#endif
#endif /* _SYS_STAT_H */
/syscallasm.h
0,0 → 1,87
#ifndef _SYSCALLASM_H_
#define _SYSCALLASM_H_
 
/*
* This file defines the system calls for SPARC for the assembler.
* Anything C-ish is not allowed in this file.
* C files should include syscall.h.
*/
 
#include <sys/syscall.h>
 
/* Some macros for writing assember syscall stubs. */
 
#ifdef __svr4__
#define TEXT_SECTION .section ".text"
#define DATA_SECTION .section ".data"
#define ALIGN(x) .align x
#define GLOBAL(sym) .global sym
#define WORD(x) .long x
#define ASM_SYMBOL(name) name
#define ASM_PRIVATE_SYMBOL(name) _##name
#define SYSCALL_TRAP 8
#else
#define TEXT_SECTION .text
#define DATA_SECTION .data
#define ALIGN(x) .align x
#define GLOBAL(sym) .global sym
#define WORD(x) .word x
#define ASM_SYMBOL(name) _##name
#define ASM_PRIVATE_SYMBOL(name) name
#define SYSCALL_TRAP 0
#endif
 
#define defsyscall(name, n) \
TEXT_SECTION ; \
ALIGN (4) ; \
GLOBAL (ASM_SYMBOL (name)) ; \
ASM_SYMBOL (name): \
mov n,%g1 ; \
ta %icc,SYSCALL_TRAP ; \
bcc noerr ; \
sethi %hi (ASM_PRIVATE_SYMBOL (cerror)),%g1 ; \
or %g1,%lo (ASM_PRIVATE_SYMBOL (cerror)),%g1 ; \
jmpl %g1+%g0,%g0 ; \
nop ; \
noerr: \
jmpl %o7+8,%g0 ; \
nop
 
/* Support for reentrant syscalls. The "struct _reent *" arg is always the
the first one. After that we allow up to four additional args. We could
allow more, but that's all we need for now.
 
It may seem inefficient to have the reent arg be the first one as it means
copying all the other args into place (as opposed to making the reent arg
the last one in which case there wouldn't be any copying). I chose a clean
design over an extra four instructions in a system call. All other
reentrant functions use the first arg this way. */
 
#define defsyscall_r(name, n) \
TEXT_SECTION ; \
ALIGN (4) ; \
GLOBAL (ASM_SYMBOL (name)) ; \
ASM_SYMBOL (name): \
mov n,%g1 ; \
mov %o0,%o5 ; \
mov %o1,%o0 ; \
mov %o2,%o1 ; \
mov %o3,%o2 ; \
mov %o4,%o3 ; \
ta %icc,SYSCALL_TRAP ; \
bcc noerr ; \
sethi %hi (ASM_PRIVATE_SYMBOL (cerror_r)),%g1 ; \
or %g1,%lo (ASM_PRIVATE_SYMBOL (cerror_r)),%g1 ; \
jmpl %g1+%g0,%g0 ; \
mov %o5,%o1 ; \
noerr: \
jmpl %o7+8,%g0 ; \
nop
 
#define seterrno() \
sethi %hi (ASM_PRIVATE_SYMBOL (cerror)),%g1 ; \
or %g1,%lo (ASM_PRIVATE_SYMBOL (cerror)),%g1 ; \
jmpl %g1+%g0,%g0 ; \
nop
 
#endif /* _SYSCALLASM_H_ */
/time.h
0,0 → 1,22
#ifndef _SYS_TIME_H
#define _SYS_TIME_H
 
#ifdef __cplusplus
extern "C" {
#endif
 
struct timeval {
long tv_sec;
long tv_usec;
};
 
typedef struct timestruc {
time_t tv_sec;
long tv_nsec;
} timestruc_t;
 
#ifdef __cplusplus
}
#endif
 
#endif /* _SYS_TIME_H */
/file.h
0,0 → 1,3
/* This is the same as sys/fcntl.h for now. */
 
#include <sys/fcntl.h>
/termios.h
0,0 → 1,122
/* FIXME: From sys/sysvi386/sys */
#ifndef _SYS_TERMIOS_H
# define _SYS_TERMIOS_H
 
# define _XCGETA (('x'<<8)|1)
# define _XCSETA (('x'<<8)|2)
# define _XCSETAW (('x'<<8)|3)
# define _XCSETAF (('x'<<8)|4)
# define _TCSBRK (('T'<<8)|5)
# define _TCFLSH (('T'<<8)|7)
# define _TCXONC (('T'<<8)|6)
 
# define TCOOFF 0
# define TCOON 1
# define TCIOFF 2
# define TCION 3
 
# define TCIFLUSH 0
# define TCOFLUSH 1
# define TCIOFLUSH 2
 
# define NCCS 13
 
# define TCSAFLUSH _XCSETAF
# define TCSANOW _XCSETA
# define TCSADRAIN _XCSETAW
# define TCSADFLUSH _XCSETAF
 
# define IGNBRK 000001
# define BRKINT 000002
# define IGNPAR 000004
# define INPCK 000020
# define ISTRIP 000040
# define INLCR 000100
# define IGNCR 000200
# define ICRNL 000400
# define IXON 002000
# define IXOFF 010000
 
# define OPOST 000001
# define OCRNL 000004
# define ONLCR 000010
# define ONOCR 000020
# define TAB3 014000
 
# define CLOCAL 004000
# define CREAD 000200
# define CSIZE 000060
# define CS5 0
# define CS6 020
# define CS7 040
# define CS8 060
# define CSTOPB 000100
# define HUPCL 002000
# define PARENB 000400
# define PAODD 001000
 
# define ECHO 0000010
# define ECHOE 0000020
# define ECHOK 0000040
# define ECHONL 0000100
# define ICANON 0000002
# define IEXTEN 0000400 /* anybody know *what* this does?! */
# define ISIG 0000001
# define NOFLSH 0000200
# define TOSTOP 0001000
 
# define VEOF 4 /* also VMIN -- thanks, AT&T */
# define VEOL 5 /* also VTIME -- thanks again */
# define VERASE 2
# define VINTR 0
# define VKILL 3
# define VMIN 4 /* also VEOF */
# define VQUIT 1
# define VSUSP 10
# define VTIME 5 /* also VEOL */
# define VSTART 11
# define VSTOP 12
 
# define B0 000000
# define B50 000001
# define B75 000002
# define B110 000003
# define B134 000004
# define B150 000005
# define B200 000006
# define B300 000007
# define B600 000010
# define B1200 000011
# define B1800 000012
# define B2400 000013
# define B4800 000014
# define B9600 000015
# define B19200 000016
# define B38400 000017
 
typedef unsigned char cc_t;
typedef unsigned short tcflag_t;
typedef char speed_t;
 
struct termios {
tcflag_t c_iflag;
tcflag_t c_oflag;
tcflag_t c_cflag;
tcflag_t c_lflag;
char c_line;
cc_t c_cc[NCCS];
speed_t c_ispeed;
speed_t c_ospeed;
};
 
# ifndef _NO_MACROS
 
# define cfgetospeed(tp) ((tp)->c_ospeed)
# define cfgetispeed(tp) ((tp)->c_ispeed)
# define cfsetospeed(tp,s) (((tp)->c_ospeed = (s)), 0)
# define cfsetispeed(tp,s) (((tp)->c_ispeed = (s)), 0)
# define tcdrain(fd) _ioctl (fd, _TCSBRK, 1)
# endif /* _NO_MACROS */
 
#endif /* _SYS_TERMIOS_H */
 
/utime.h
0,0 → 1,13
/* FIXME: From sys/sysvi386/sys */
#ifndef _SYS_UTIME_H
# define _SYS_UTIME_H
 
#include <time.h>
 
struct utimbuf {
time_t actime;
time_t modtime;
};
 
#endif /* _SYS_UTIME_H */
 
/wait.h
0,0 → 1,43
/* FIXME: From sys/sysvi386/sys */
#ifndef _WAIT_H
# define _WAIT_H
 
# define WNOHANG 1
# define WUNTRACED 2
 
/*
* Unlike the atrocity that BSD ended up using, we do not have a "union
* wait," although I could probably implement one. Given the code I
* sometimes end up porting, it might be a good thing. Anyway, the
* format of a stat thingy, filled in by the wait*() routines, is:
* struct {
* int filler:16;
* union {
* struct stopped {
* int signo:8;
* int o177:8; // will be 0177
* };
* struct exited {
* int retval:8;
* int zero:8; // 0, obviously 8-)
* };
* struct termed {
* int zero:8; // zeroes
* int corep:1; // was there a core file?
* int signo:7; // what?! Only 127 signals?!
* };
* int value:16;
* };
* };
*
* Braver souls than I can turn that into a union wait, if desired. Ick.
*/
 
# define WIFEXITED(val) ((val)&0xff)
# define WEXITSTATUS(val) (((val)>>8)&0xff)
# define WIFSIGNALED(val) ((val) && !((val)&0xff))
# define WTERMSIG(val) (((val)>>8)&0x7f)
# define WIFSTOPPED(val) (((val)&0xff)==0177)
# define WSTOPSIG(val) (((val)>>8)&0xff)
#endif /* _SYS_WAIT_H */
 
/dirent.h
0,0 → 1,48
/* FIXME: From sys/sysvi386/sys */
#ifndef _SYS_DIRENT_H
# define _SYS_DIRENT_H
 
/*
* This file was written to be compatible with the BSD directory
* routines, so it looks like it. But it was written from scratch.
* Sean Eric Fagan, sef@Kithrup.COM
*/
 
typedef struct __dirdesc {
int dd_fd;
long dd_loc;
long dd_size;
char *dd_buf;
int dd_len;
long dd_seek;
} DIR;
 
# define __dirfd(dp) ((dp)->dd_fd)
 
DIR *opendir (const char *);
struct dirent *readdir (DIR *);
void rewinddir (DIR *);
int closedir (DIR *);
 
#include <sys/types.h>
 
#undef MAXNAMLEN /* from unistd.h */
#ifdef __svr4__
#define MAXNAMLEN 512
#else
#define MAXNAMLEN 255
#endif
 
#define d_ino d_fileno /* compatibility */
 
struct dirent {
off_t d_off;
unsigned long d_fileno;
unsigned short d_reclen;
unsigned short d_namlen;
char d_name[MAXNAMLEN + 1];
};
 
/* FIXME: include definition of DIRSIZ() ? */
 
#endif
/utmp.h
0,0 → 1,43
#ifndef _UTMP_H
# define _UTMP_H
 
#include <sys/types.h>
 
# define UTMP_FILE "/etc/utmp"
# define WTMP_FILE "/etc/wtmp"
 
struct utmp {
char ut_user[8]; /* how limited */
char ut_id[4]; /* ditto */
char ut_line[12]; /* I'm repeating myself */
short ut_pid;
short ut_type;
struct exit_status {
short e_termination;
short e_exit;
} ut_exit; /* for DEAD_PROCESS processes */
time_t ut_time;
};
 
/* Definitions for ut_type fields */
 
# define EMPTY 0
# define RUN_LVL 1
# define BOOT_TIME 2
# define OLD_TIME 3
# define NEW_TIME 4
# define INIT_PROCESS 5
# define LOGIN_PROCESS 6
# define USER_PROCESS 7
# define DEAD_PROCESS 8
# define ACCOUNTING 9
# define UTMAXTYPE ACCOUNTING
 
# define RUNLVL_MSG "run-level %c"
# define BOOT_MSG "system boot"
# define OTIME_MSG "old time"
# define NTIME_MSG "new time"
 
#endif /* _UTMP_H */
 
 
/fcntl.h
0,0 → 1,178
/* sys/fcntl.h for sparc64 */
 
/* This is basically the same as the default version, except that a few of
the values are different on Solaris (eg: FCREAT).
We support both SunOS4 and Solaris. */
 
#ifndef _SYS_FCNTL_H_
#define _SYS_FCNTL_H_
 
#ifdef __cplusplus
extern "C" {
#endif
 
#include <_ansi.h>
 
#define _FOPEN (-1) /* from sys/file.h, kernel use only */
#define _FREAD 0x0001 /* read enabled */
#define _FWRITE 0x0002 /* write enabled */
#define _FNDELAY 0x0004 /* non blocking I/O (4.2 style) */
#define _FAPPEND 0x0008 /* append (writes guaranteed at the end) */
#ifdef __svr4__
#define _FNONBLOCK 0x0080 /* non blocking I/O (POSIX) */
#define _FCREAT 0x0100 /* open with file create */
#define _FTRUNC 0x0200 /* open with truncation */
#define _FEXCL 0x0400 /* error on open if file exists */
#define _FNOCTTY 0x0800 /* don't assign a ctty on this open */
#else
#define _FMARK 0x0010 /* internal; mark during gc() */
#define _FDEFER 0x0020 /* internal; defer for next gc pass */
#define _FASYNC 0x0040 /* signal pgrp when data ready */
#define _FSHLOCK 0x0080 /* BSD flock() shared lock present */
#define _FEXLOCK 0x0100 /* BSD flock() exclusive lock present */
#define _FCREAT 0x0200 /* open with file create */
#define _FTRUNC 0x0400 /* open with truncation */
#define _FEXCL 0x0800 /* error on open if file exists */
#define _FNBIO 0x1000 /* non blocking I/O (sys5 style) */
#define _FSYNC 0x2000 /* do all writes synchronously */
#define _FNONBLOCK 0x4000 /* non blocking I/O (POSIX style) */
#define _FNOCTTY 0x8000 /* don't assign a ctty on this open */
#endif /* ! __svr4__ */
 
#define O_ACCMODE (O_RDONLY|O_WRONLY|O_RDWR)
 
/*
* Flag values for open(2) and fcntl(2)
* The kernel adds 1 to the open modes to turn it into some
* combination of FREAD and FWRITE.
*/
#define O_RDONLY 0 /* +1 == FREAD */
#define O_WRONLY 1 /* +1 == FWRITE */
#define O_RDWR 2 /* +1 == FREAD|FWRITE */
#define O_APPEND _FAPPEND
#define O_CREAT _FCREAT
#define O_TRUNC _FTRUNC
#define O_EXCL _FEXCL
/* O_SYNC _FSYNC not posix, defined below */
/* O_NDELAY _FNDELAY set in include/fcntl.h */
/* O_NDELAY _FNBIO set in 5include/fcntl.h */
#define O_NONBLOCK _FNONBLOCK
#define O_NOCTTY _FNOCTTY
 
#ifndef _POSIX_SOURCE
 
#define O_SYNC _FSYNC
 
/*
* Flags that work for fcntl(fd, F_SETFL, FXXXX)
*/
#define FAPPEND _FAPPEND
#define FSYNC _FSYNC
#define FASYNC _FASYNC
#define FNBIO _FNBIO
#define FNONBIO _FNONBLOCK /* XXX fix to be NONBLOCK everywhere */
#define FNDELAY _FNDELAY
 
/*
* Flags that are disallowed for fcntl's (FCNTLCANT);
* used for opens, internal state, or locking.
*/
#define FREAD _FREAD
#define FWRITE _FWRITE
#define FMARK _FMARK
#define FDEFER _FDEFER
#define FSHLOCK _FSHLOCK
#define FEXLOCK _FEXLOCK
 
/*
* The rest of the flags, used only for opens
*/
#define FOPEN _FOPEN
#define FCREAT _FCREAT
#define FTRUNC _FTRUNC
#define FEXCL _FEXCL
#define FNOCTTY _FNOCTTY
 
#endif !_POSIX_SOURCE
 
/* XXX close on exec request; must match UF_EXCLOSE in user.h */
#define FD_CLOEXEC 1 /* posix */
 
/* fcntl(2) requests */
#define F_DUPFD 0 /* Duplicate fildes */
#define F_GETFD 1 /* Get fildes flags (close on exec) */
#define F_SETFD 2 /* Set fildes flags (close on exec) */
#define F_GETFL 3 /* Get file flags */
#define F_SETFL 4 /* Set file flags */
#ifndef _POSIX_SOURCE
#ifdef __svr4__
#define F_GETOWN 23 /* Get owner - for ASYNC */
#define F_SETOWN 24 /* Set owner - for ASYNC */
#else
#define F_GETOWN 5 /* Get owner - for ASYNC */
#define F_SETOWN 6 /* Set owner - for ASYNC */
#endif
#endif /* !_POSIX_SOURCE */
#ifdef __svr4__
#define F_GETLK 14 /* Get record-locking information */
#define F_SETLK 6 /* Set or Clear a record-lock (Non-Blocking) */
#define F_SETLKW 7 /* Set or Clear a record-lock (Blocking) */
#else
#define F_GETLK 7 /* Get record-locking information */
#define F_SETLK 8 /* Set or Clear a record-lock (Non-Blocking) */
#define F_SETLKW 9 /* Set or Clear a record-lock (Blocking) */
#endif
#ifndef _POSIX_SOURCE
#define F_RGETLK 10 /* Test a remote lock to see if it is blocked */
#define F_RSETLK 11 /* Set or unlock a remote lock */
#define F_CNVT 12 /* Convert a fhandle to an open fd */
#define F_RSETLKW 13 /* Set or Clear remote record-lock(Blocking) */
#endif /* !_POSIX_SOURCE */
 
/* fcntl(2) flags (l_type field of flock structure) */
#define F_RDLCK 1 /* read lock */
#define F_WRLCK 2 /* write lock */
#define F_UNLCK 3 /* remove lock(s) */
#ifndef _POSIX_SOURCE
#define F_UNLKSYS 4 /* remove remote locks for a given system */
#endif /* !_POSIX_SOURCE */
 
/*#include <sys/stdtypes.h>*/
 
/* file segment locking set data type - information passed to system by user */
struct flock {
short l_type; /* F_RDLCK, F_WRLCK, or F_UNLCK */
short l_whence; /* flag to choose starting offset */
long l_start; /* relative offset, in bytes */
long l_len; /* length, in bytes; 0 means lock to EOF */
short l_pid; /* returned with F_GETLK */
short l_xxx; /* reserved for future use */
};
 
#ifndef _POSIX_SOURCE
/* extended file segment locking set data type */
struct eflock {
short l_type; /* F_RDLCK, F_WRLCK, or F_UNLCK */
short l_whence; /* flag to choose starting offset */
long l_start; /* relative offset, in bytes */
long l_len; /* length, in bytes; 0 means lock to EOF */
short l_pid; /* returned with F_GETLK */
short l_xxx; /* reserved for future use */
long l_rpid; /* Remote process id wanting this lock */
long l_rsys; /* Remote system id wanting this lock */
};
#endif /* !_POSIX_SOURCE */
 
 
#include <sys/types.h>
#include <sys/stat.h> /* sigh. for the mode bits for open/creat */
 
extern int open _PARAMS ((const char *, int, ...));
extern int creat _PARAMS ((const char *, mode_t));
extern int fcntl _PARAMS ((int, int, ...));
 
#ifdef __cplusplus
}
#endif
 
#endif /* !_SYS_FCNTL_H_ */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.