diff options
author | stevel@tonic-gate <none@none> | 2005-06-14 00:00:00 -0700 |
---|---|---|
committer | stevel@tonic-gate <none@none> | 2005-06-14 00:00:00 -0700 |
commit | 7c478bd95313f5f23a4c958a745db2134aa03244 (patch) | |
tree | c871e58545497667cbb4b0a4f2daf204743e1fe7 /usr/src/ucbhead | |
download | illumos-joyent-7c478bd95313f5f23a4c958a745db2134aa03244.tar.gz |
OpenSolaris Launch
Diffstat (limited to 'usr/src/ucbhead')
33 files changed, 5627 insertions, 0 deletions
diff --git a/usr/src/ucbhead/Makefile b/usr/src/ucbhead/Makefile new file mode 100644 index 0000000000..0390e30cca --- /dev/null +++ b/usr/src/ucbhead/Makefile @@ -0,0 +1,80 @@ +# +# CDDL HEADER START +# +# The contents of this file are subject to the terms of the +# Common Development and Distribution License, Version 1.0 only +# (the "License"). You may not use this file except in compliance +# with the License. +# +# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +# or http://www.opensolaris.org/os/licensing. +# See the License for the specific language governing permissions +# and limitations under the License. +# +# When distributing Covered Code, include this CDDL HEADER in each +# file and include the License file at usr/src/OPENSOLARIS.LICENSE. +# If applicable, add the following below this CDDL HEADER, with the +# fields enclosed by brackets "[]" replaced with your own identifying +# information: Portions Copyright [yyyy] [name of copyright owner] +# +# CDDL HEADER END +# +# +#ident "%Z%%M% %I% %E% SMI" +# +# Copyright 1989-2003 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# +# ucbhead/Makefile +# +# include global definitions +include ../Makefile.master + +LN= ln + +HDRS= \ +a.out.h assert.h curses.h dbm.h \ +regexp.h resolv.h setjmp.h sgtty.h \ +signal.h stdio.h strings.h struct.h syscall.h \ +unistd.h vfont.h vfork.h + +SYSHDRS= \ +dir.h fcntl.h file.h ioctl.h \ +param.h reboot.h resource.h rusage.h signal.h \ +sysmacros.h tty.h ttychars.h types.h vfs.h \ +wait.h + +UFSHDRS= quota.h + +ROOTHDRS= $(HDRS:%=$(ROOT)/usr/ucbinclude/%) \ + $(SYSHDRS:%=$(ROOT)/usr/ucbinclude/sys/%) \ + $(UFSHDRS:%=$(ROOT)/usr/ucbinclude/ufs/%) + +DIRS= sys ufs +ROOTDIRS= $(ROOT)/usr/ucbinclude $(DIRS:%=$(ROOT)/usr/ucbinclude/%) + +FCNTLH= $(ROOT)/usr/ucbinclude/fcntl.h +SYSFCNTLH= $(ROOT)/usr/ucbinclude/sys/fcntl.h + +INS.FCNTLH= $(RM) $@; $(SYMLINK) sys/fcntl.h $@ + +# install rules +$(ROOT)/usr/ucbinclude/sys/%: sys/% + $(INS.file) + +$(ROOT)/usr/ucbinclude/ufs/%: ufs/% + $(INS.file) + +$(ROOT)/usr/ucbinclude/%: % + $(INS.file) + +.KEEP_STATE: + +install_h: $(ROOTDIRS) $(ROOTHDRS) $(FCNTLH) + +$(FCNTLH): $(SYSFCNTLH) + $(INS.FCNTLH) + +$(ROOTDIRS): + $(INS.dir) + diff --git a/usr/src/ucbhead/a.out.h b/usr/src/ucbhead/a.out.h new file mode 100644 index 0000000000..5ccc525295 --- /dev/null +++ b/usr/src/ucbhead/a.out.h @@ -0,0 +1,267 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* + * Portions of this source code were derived from Berkeley 4.3 BSD + * under license from the Regents of the University of California. + */ + +/* + * SunOS 4.x a.out format -- 32-bit sparc only + */ + +#ifndef _A_OUT_H +#define _A_OUT_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#include <sys/isa_defs.h> + +#ifdef __cplusplus +extern "C" { +#endif + +#if defined(__sparcv8) + +/* contents of <sys/exec.h> included */ + +/* + * format of the exec header + * known by kernel and by user programs + */ +struct exec { + unsigned char a_dynamic:1; /* has a __DYNAMIC */ + unsigned char a_toolversion:7; + /* version of toolset used to create this file */ + unsigned char a_machtype; /* machine type */ + unsigned short a_magic; /* magic number */ + unsigned int a_text; /* size of text segment */ + unsigned int a_data; /* size of initialized data */ + unsigned int a_bss; /* size of uninitialized data */ + unsigned int a_syms; /* size of symbol table */ + unsigned int a_entry; /* entry point */ + unsigned int a_trsize; /* size of text relocation */ + unsigned int a_drsize; /* size of data relocation */ +}; + +#define OMAGIC 0407 /* old impure format */ +#define NMAGIC 0410 /* read-only text */ +#define ZMAGIC 0413 /* demand load format */ + +/* machine types */ + +#define M_OLDSUN2 0 /* old sun-2 executable files */ +#define M_SPARC 3 /* runs only on SPARC */ + +#define TV_SUN2_SUN3 0 +#define TV_SUN4 1 +/* end <sys/exec.h> */ + +/* + * memory management parameters + */ + +#define PAGSIZ 0x02000 +#define SEGSIZ PAGSIZ +#define OLD_PAGSIZ 0x00800 /* Page size under Release 2.0 */ +#define OLD_SEGSIZ 0x08000 /* Segment size under Release 2.0 */ + +/* + * returns 1 if an object file type is invalid, i.e., if the other macros + * defined below will not yield the correct offsets. Note that a file may + * have N_BADMAG(x) = 0 and may be fully linked, but still may not be + * executable. + */ + +#define N_BADMAG(x) \ + ((x).a_magic != OMAGIC && (x).a_magic != NMAGIC && \ + (x).a_magic != ZMAGIC) + +/* + * relocation parameters. These are architecture-dependent + * and can be deduced from the machine type. They are used + * to calculate offsets of segments within the object file; + * See N_TXTOFF(x), etc. below. + */ + +#define N_PAGSIZ(x) \ + ((x).a_machtype == M_OLDSUN2? OLD_PAGSIZ : PAGSIZ) +#define N_SEGSIZ(x) \ + ((x).a_machtype == M_OLDSUN2? OLD_SEGSIZ : SEGSIZ) + +/* + * offsets of various sections of an object file. + */ + +#define N_TXTOFF(x) \ + /* text segment */ \ + ((x).a_machtype == M_OLDSUN2 \ + ? ((x).a_magic == ZMAGIC ? N_PAGSIZ(x) : sizeof (struct exec)) \ + : ((x).a_magic == ZMAGIC ? 0 : sizeof (struct exec))) + +#define N_DATOFF(x) /* data segment */ \ + (N_TXTOFF(x) + (x).a_text) + +#define N_TRELOFF(x) /* text reloc'n */ \ + (N_DATOFF(x) + (x).a_data) + +#define N_DRELOFF(x) /* data relocation */ \ + (N_TRELOFF(x) + (x).a_trsize) + +#define N_SYMOFF(x) \ + /* symbol table */ \ + (N_TXTOFF(x)+(x).a_text+(x).a_data+(x).a_trsize+(x).a_drsize) + +#define N_STROFF(x) \ + /* string table */ \ + (N_SYMOFF(x) + (x).a_syms) + +/* + * Macros which take exec structures as arguments and tell where the + * various pieces will be loaded. + */ + +#define _N_BASEADDR(x) \ + (((x).a_magic == ZMAGIC) && ((x).a_entry < N_PAGSIZ(x)) ? \ + 0 : N_PAGSIZ(x)) + +#define N_TXTADDR(x) \ + ((x).a_machtype == M_OLDSUN2 ? N_SEGSIZ(x) : _N_BASEADDR(x)) + +#define N_DATADDR(x) \ + (((x).a_magic == OMAGIC)? (N_TXTADDR(x)+(x).a_text) \ + : (N_SEGSIZ(x)+((N_TXTADDR(x)+(x).a_text-1) & ~(N_SEGSIZ(x)-1)))) + +#define N_BSSADDR(x) (N_DATADDR(x)+(x).a_data) + +/* + * Format of a relocation datum. + */ + +/* + * Sparc relocation types + */ + +enum reloc_type +{ + RELOC_8, RELOC_16, RELOC_32, /* simplest relocs */ + RELOC_DISP8, RELOC_DISP16, RELOC_DISP32, /* Disp's (pc-rel) */ + RELOC_WDISP30, RELOC_WDISP22, /* SR word disp's */ + RELOC_HI22, RELOC_22, /* SR 22-bit relocs */ + RELOC_13, RELOC_LO10, /* SR 13&10-bit relocs */ + RELOC_SFA_BASE, RELOC_SFA_OFF13, /* SR S.F.A. relocs */ + RELOC_BASE10, RELOC_BASE13, RELOC_BASE22, /* base_relative pic */ + RELOC_PC10, RELOC_PC22, /* special pc-rel pic */ + RELOC_JMP_TBL, /* jmp_tbl_rel in pic */ + RELOC_SEGOFF16, /* ShLib offset-in-seg */ + RELOC_GLOB_DAT, RELOC_JMP_SLOT, RELOC_RELATIVE /* rtld relocs */ +}; + +/* + * Format of a relocation datum. + */ + +struct reloc_info_sparc /* used when header.a_machtype == M_SPARC */ +{ + unsigned int r_address; + /* relocation addr (offset in segment) */ + unsigned int r_index :24; /* segment index or symbol index */ + unsigned int r_extern : 1; /* if F, r_index==SEG#; if T, SYM idx */ + int : 2; /* <unused> */ + enum reloc_type r_type : 5; /* type of relocation to perform */ + int r_addend; /* addend for relocation value */ +}; + + + +/* + * Format of a symbol table entry + */ +struct nlist { + union { + char *n_name; /* for use when in-core */ + int n_strx; /* index into file string table */ + } n_un; + unsigned char n_type; /* type flag (N_TEXT,..) */ + char n_other; /* unused */ + short n_desc; /* see <stab.h> */ + unsigned int n_value; /* value of symbol (or sdb offset) */ +}; + +/* + * Simple values for n_type. + */ +#define N_UNDF 0x0 /* undefined */ +#define N_ABS 0x2 /* absolute */ +#define N_TEXT 0x4 /* text */ +#define N_DATA 0x6 /* data */ +#define N_BSS 0x8 /* bss */ +#define N_COMM 0x12 /* common (internal to ld) */ +#define N_FN 0x1e /* file name symbol */ + +#define N_EXT 01 /* external bit, or'ed in */ +#define N_TYPE 0x1e /* mask for all the type bits */ + +/* + * Dbx entries have some of the N_STAB bits set. + * These are given in <stab.h> + */ +#define N_STAB 0xe0 /* if any of these bits set, a dbx symbol */ + +/* + * Format for namelist values. + */ +#define N_FORMAT "%08x" + +/* + * secondary sections. + * this stuff follows the string table. + * not even its presence or absence is noted in the + * exec header (?). the secondary header gives + * the number of sections. following it is an + * array of "extra_nsects" int's which give the + * sizeof of the individual sections. the presence of + * even the header is optional. + */ + +#define EXTRA_MAGIC 1040 /* taxing concept */ +#define EXTRA_IDENT 0 /* ident's in 0th extra section */ + +struct extra_sections { + int extra_magic; /* should be EXTRA_MAGIC */ + int extra_nsects; /* number of extra sections */ +}; + +#endif /* defined(__sparcv8) */ + +#ifdef __cplusplus +} +#endif + +#endif /* _A_OUT_H */ diff --git a/usr/src/ucbhead/assert.h b/usr/src/ucbhead/assert.h new file mode 100644 index 0000000000..ea79048e92 --- /dev/null +++ b/usr/src/ucbhead/assert.h @@ -0,0 +1,58 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#ifndef _ASSERT_H +#define _ASSERT_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#ifdef NDEBUG +#undef assert +#define assert(EX) + +#else + +#define _assert(ex) {if (!(ex)) \ + {(void)fprintf(stderr, "Assertion failed: file \"%s\", \ + line %d\n", __FILE__, __LINE__); exit(1); }} +#define assert(ex) _assert(ex) + +#endif /* NDEBUG */ + +#endif /* _ASSERT_H */ diff --git a/usr/src/ucbhead/curses.h b/usr/src/ucbhead/curses.h new file mode 100644 index 0000000000..d02dd7017a --- /dev/null +++ b/usr/src/ucbhead/curses.h @@ -0,0 +1,255 @@ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* + * Copyright (c) 1980 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + */ + +#ifndef _CURSES_H +#define _CURSES_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef WINDOW + +#include <stdio.h> +#include <sgtty.h> + +#undef HZ /* in case they've included <sys/param.h> */ + +#if !(defined(__cplusplus) && defined(_BOOL)) +#define bool char +#endif + +#define reg register + +#define TRUE (1) +#define FALSE (0) +#define ERR (0) +#define OK (1) + +#define _ENDLINE 001 +#define _FULLWIN 002 +#define _SCROLLWIN 004 +#define _FLUSH 010 +#define _FULLLINE 020 +#define _IDLINE 040 +#define _STANDOUT 0200 +#define _NOCHANGE -1 + +#define _puts(s) tputs(s, 0, _putchar) + +typedef struct sgttyb SGTTY; + +/* + * Capabilities from termcap + */ + +extern bool AM, BS, CA, DA, DB, EO, HC, HZ, IN, MI, MS, NC, NS, OS, UL, + XB, XN, XT, XS, XX; +extern char *AL, *BC, *BT, *CD, *CE, *CL, *CM, *CR, *CS, *DC, *DL, + *DM, *DO, *ED, *EI, *K0, *K1, *K2, *K3, *K4, *K5, *K6, + *K7, *K8, *K9, *HO, *IC, *IM, *IP, *KD, *KE, *KH, *KL, + *KR, *KS, *KU, *LL, *MA, *ND, *NL, *RC, *SC, *SE, *SF, + *SO, *SR, *TA, *TE, *TI, *UC, *UE, *UP, *US, *VB, *VS, + *VE, *AL_PARM, *DL_PARM, *UP_PARM, *DOWN_PARM, + *LEFT_PARM, *RIGHT_PARM; +extern char PC; + +/* + * From the tty modes... + */ + +extern bool GT, NONL, UPPERCASE, normtty, _pfast; + +struct _win_st { + short _cury, _curx; + short _maxy, _maxx; + short _begy, _begx; + short _flags; + short _ch_off; + bool _clear; + bool _leave; + bool _scroll; + char **_y; + short *_firstch; + short *_lastch; + struct _win_st *_nextp, *_orig; +}; + +#define WINDOW struct _win_st + +extern bool My_term, _echoit, _rawmode, _endwin; + +extern char *Def_term, ttytype[50]; + +extern int LINES, COLS, _tty_ch, _res_flg; + +extern SGTTY _tty; + +extern WINDOW *stdscr, *curscr; + +#define VOID(x) (x) + +/* + * pseudo functions for standard screen + */ +#define addch(ch) VOID(waddch(stdscr, ch)) +#define getch() VOID(wgetch(stdscr)) +#define addstr(str) VOID(waddstr(stdscr, str)) +#define getstr(str) VOID(wgetstr(stdscr, str)) +#define move(y, x) VOID(wmove(stdscr, y, x)) +#define clear() VOID(wclear(stdscr)) +#define erase() VOID(werase(stdscr)) +#define clrtobot() VOID(wclrtobot(stdscr)) +#define clrtoeol() VOID(wclrtoeol(stdscr)) +#define insertln() VOID(winsertln(stdscr)) +#define deleteln() VOID(wdeleteln(stdscr)) +#define refresh() VOID(wrefresh(stdscr)) +#define inch() VOID(winch(stdscr)) +#define insch(c) VOID(winsch(stdscr, c)) +#define delch() VOID(wdelch(stdscr)) +#define standout() VOID(wstandout(stdscr)) +#define standend() VOID(wstandend(stdscr)) + +/* + * mv functions + */ +#define mvwaddch(win, y, x, ch) VOID(wmove(win, y, x) == ERR ? \ + ERR:waddch(win, ch)) +#define mvwgetch(win, y, x) VOID(wmove(win, y, x) == ERR?ERR:wgetch(win)) +#define mvwaddstr(win, y, x, str) VOID(wmove(win, y, x) == ERR? \ + ERR:waddstr(win, str)) +#define mvwgetstr(win, y, x, str) VOID(wmove(win, y, x) == ERR? \ + ERR:wgetstr(win, str)) +#define mvwinch(win, y, x) VOID(wmove(win, y, x) == ERR ? ERR : winch(win)) +#define mvwdelch(win, y, x) VOID(wmove(win, y, x) == ERR ? \ + ERR : wdelch(win)) +#define mvwinsch(win, y, x, c) VOID(wmove(win, y, x) == ERR ? \ + ERR:winsch(win, c)) +#define mvaddch(y, x, ch) mvwaddch(stdscr, y, x, ch) +#define mvgetch(y, x) mvwgetch(stdscr, y, x) +#define mvaddstr(y, x, str) mvwaddstr(stdscr, y, x, str) +#define mvgetstr(y, x, str) mvwgetstr(stdscr, y, x, str) +#define mvinch(y, x) mvwinch(stdscr, y, x) +#define mvdelch(y, x) mvwdelch(stdscr, y, x) +#define mvinsch(y, x, c) mvwinsch(stdscr, y, x, c) + +/* + * pseudo functions + */ + +#define clearok(win, bf) (win->_clear = bf) +#define leaveok(win, bf) (win->_leave = bf) +#define scrollok(win, bf) (win->_scroll = bf) +#define flushok(win, bf) (bf ? (win->_flags |= _FLUSH): \ + (win->_flags &= ~_FLUSH)) +#define getyx(win, y, x) y = win->_cury, x = win->_curx +#define winch(win) (win->_y[win->_cury][win->_curx] & 0177) + +#define raw() (_tty.sg_flags |= RAW, _pfast = _rawmode = TRUE, \ + (void) stty(_tty_ch, &_tty)) +#define noraw() (_tty.sg_flags &= ~RAW, _rawmode = FALSE, \ + _pfast = !(_tty.sg_flags & CRMOD), (void) stty(_tty_ch, &_tty)) +#define cbreak() (_tty.sg_flags |= CBREAK, _rawmode = TRUE, \ + (void) stty(_tty_ch, &_tty)) +#define nocbreak() (_tty.sg_flags &= ~CBREAK, _rawmode = FALSE, \ + (void) stty(_tty_ch, &_tty)) +#define crmode() cbreak() /* backwards compatability */ +#define nocrmode() nocbreak() /* backwards compatability */ +#define echo() (_tty.sg_flags |= ECHO, _echoit = TRUE, \ + (void) stty(_tty_ch, &_tty)) +#define noecho() (_tty.sg_flags &= ~ECHO, _echoit = FALSE, \ + (void) stty(_tty_ch, &_tty)) +#define nl() (_tty.sg_flags |= CRMOD, _pfast = _rawmode, \ + (void) stty(_tty_ch, &_tty)) +#define nonl() (_tty.sg_flags &= ~CRMOD, _pfast = TRUE, \ + (void) stty(_tty_ch, &_tty)) +#define savetty() ((void) gtty(_tty_ch, &_tty), _res_flg = _tty.sg_flags) +#define resetty() (_tty.sg_flags = _res_flg, (void) stty(_tty_ch, &_tty)) + +#define erasechar() (_tty.sg_erase) +#define killchar() (_tty.sg_kill) +#define baudrate() (_tty.sg_ospeed) + +/* + * chtype is the type used to store a character together with attributes. + * It can be set to "char" to save space, or "int" to get more attributes. + */ +#ifdef CHTYPE +typedef CHTYPE chtype; +#else +typedef unsigned int chtype; +#endif + +#ifndef __STDC__ +WINDOW *initscr(), *newwin(), *subwin(); +char *longname(), *getcap(); +#else +extern WINDOW *initscr(void); +extern WINDOW *newwin(int, int, int, int); +extern WINDOW *subwin(WINDOW *, int, int, int, int); +extern char *longname(char *, char *); +extern char *getcap(char *); +extern char *wstandout(WINDOW *); +extern char *wstandend(WINDOW *); +extern int gettmode(void); +extern int idlok(WINDOW *, bool); +extern int box(WINDOW *, char, char); +extern int touchwin(WINDOW *); +extern int touchline(WINDOW *, int, int, int); +extern int mvcur(int, int, int, int); +extern int wmove(WINDOW *, int, int); +extern int scroll(WINDOW *); +extern int werase(WINDOW *); +extern int wrefresh(WINDOW *); +extern int endwin(void); +extern int mvwin(WINDOW *, int, int); +extern int delwin(WINDOW *); +extern int overlay(WINDOW *, WINDOW *); +extern int overwrite(WINDOW *, WINDOW *); +extern int winsertln(WINDOW *); +extern int wdeleteln(WINDOW *); +extern int wgetstr(WINDOW *, char *); +extern int wgetch(WINDOW *); +extern int waddch(WINDOW *, char); +extern int waddstr(WINDOW *, char *); +extern int winsch(WINDOW *, char); +extern int wdelch(WINDOW *); +extern int wclear(WINDOW *); +extern int wclrtobot(WINDOW *); +extern int wclrtoeol(WINDOW *); +extern int printw(char *, ...); +extern int wprintw(WINDOW *, char *, ...); +extern int mvprintw(int, int, char *, ...); +extern int mvwprintw(WINDOW *, int, int, char *, ...); +extern int scanw(char *, ...); +extern int wscanw(WINDOW *, char *, ...); +extern int mvscanw(int, int, char *, ...); +extern int mvwscanw(WINDOW *, int, int, char *, ...); +extern int setterm(char *); +#endif /* __STDC__ */ + +/* + * Used to be in unctrl.h. + */ +#define unctrl(c) _unctrl[(c) & 0177] +extern char *_unctrl[]; +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* _CURSES_H */ diff --git a/usr/src/ucbhead/dbm.h b/usr/src/ucbhead/dbm.h new file mode 100644 index 0000000000..da9110584b --- /dev/null +++ b/usr/src/ucbhead/dbm.h @@ -0,0 +1,100 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#ifndef _DBM_H +#define _DBM_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#ifdef __cplusplus +extern "C" { +#endif + +#define PBLKSIZ 1024 +#define DBLKSIZ 4096 +#define BYTESIZ 8 + +#ifndef NULL +#define NULL ((char *) 0) +#endif + +long bitno; +long maxbno; +long blkno; +long hmask; + +char pagbuf[PBLKSIZ]; +char dirbuf[DBLKSIZ]; + +int dirf; +int pagf; +int dbrdonly; + +#ifndef DATUM +typedef struct +{ + char *dptr; + int dsize; +} datum; +#define DATUM +#endif + +#ifdef __STDC__ +datum fetch(datum); +datum makdatum(char *, int); +datum firstkey(void); +datum nextkey(datum); +datum firsthash(long); +long calchash(datum); +long hashinc(long); +#else +datum fetch(); +datum makdatum(); +datum firstkey(); +datum nextkey(); +datum firsthash(); +long calchash(); +long hashinc(); +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* _DBM_H */ diff --git a/usr/src/ucbhead/regexp.h b/usr/src/ucbhead/regexp.h new file mode 100644 index 0000000000..5d0e0cccb1 --- /dev/null +++ b/usr/src/ucbhead/regexp.h @@ -0,0 +1,549 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#ifndef _REGEXP_H +#define _REGEXP_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#include <ctype.h> + +#ifdef __cplusplus +extern "C" { +#endif + +#define CBRA 2 +#define CCHR 4 +#define CDOT 8 +#define CCL 12 +#define CXCL 16 +#define CDOL 20 +#define CCEOF 22 +#define CKET 24 +#define CBACK 36 +#define NCCL 40 + +#define STAR 01 +#define RNGE 03 + +#define NBRA 9 + +#define PLACE(c) ep[c >> 3] |= bittab[c & 07] +#define ISTHERE(c) (ep[c >> 3] & bittab[c & 07]) +#define ecmp(s1, s2, n) (strncmp(s1, s2, n) == 0) + +static char *braslist[NBRA]; +static char *braelist[NBRA]; +int sed, nbra; +char *loc1, *loc2, *locs; +static int nodelim; + +int circf; +static int low; +static int size; + +static char bittab[] = { 1, 2, 4, 8, 16, 32, 64, 128 }; + +char * +compile(instring, ep, endbuf, seof) +char *ep; +char *instring, *endbuf; +{ + INIT /* Dependent declarations and initializations */ + int c; + int eof = seof; + char *lastep = instring; + int cclcnt; + char bracket[NBRA], *bracketp; + int closed; + int neg; + int lc; + int i, cflg; + int iflag; /* used for non-ascii characters in brackets */ + + lastep = 0; + if ((c = GETC()) == eof || c == '\n') { + if (c == '\n') { + UNGETC(c); + nodelim = 1; + } + if (*ep == 0 && !sed) + ERROR(41); + RETURN(ep); + } + bracketp = bracket; + circf = closed = nbra = 0; + if (c == '^') + circf++; + else + UNGETC(c); + while (1) { + if (ep >= endbuf) + ERROR(50); + c = GETC(); + if (c != '*' && ((c != '\\') || (PEEKC() != '{'))) + lastep = ep; + if (c == eof) { + *ep++ = CCEOF; + if (bracketp != bracket) + ERROR(42); + RETURN(ep); + } + switch (c) { + + case '.': + *ep++ = CDOT; + continue; + + case '\n': + if (!sed) { + UNGETC(c); + *ep++ = CCEOF; + nodelim = 1; + if (bracketp != bracket) + ERROR(42); + RETURN(ep); + } else ERROR(36); + case '*': + if (lastep == 0 || *lastep == CBRA || *lastep == CKET) + goto defchar; + *lastep |= STAR; + continue; + + case '$': + if (PEEKC() != eof && PEEKC() != '\n') + goto defchar; + *ep++ = CDOL; + continue; + + case '[': + if (&ep[17] >= endbuf) + ERROR(50); + + *ep++ = CCL; + lc = 0; + for (i = 0; i < 16; i++) + ep[i] = 0; + + neg = 0; + if ((c = GETC()) == '^') { + neg = 1; + c = GETC(); + } + iflag = 1; + do { + c &= 0377; + if (c == '\0' || c == '\n') + ERROR(49); + if ((c & 0200) && iflag) { + iflag = 0; + if (&ep[32] >= endbuf) + ERROR(50); + ep[-1] = CXCL; + for (i = 16; i < 32; i++) + ep[i] = 0; + } + if (c == '-' && lc != 0) { + if ((c = GETC()) == ']') { + PLACE('-'); + break; + } + if ((c & 0200) && iflag) { + iflag = 0; + if (&ep[32] >= endbuf) + ERROR(50); + ep[-1] = CXCL; + for (i = 16; i < 32; i++) + ep[i] = 0; + } + while (lc < c) { + PLACE(lc); + lc++; + } + } + lc = c; + PLACE(c); + } while ((c = GETC()) != ']'); + + if (iflag) + iflag = 16; + else + iflag = 32; + + if (neg) { + if (iflag == 32) { + for (cclcnt = 0; cclcnt < iflag; + cclcnt++) + ep[cclcnt] ^= 0377; + ep[0] &= 0376; + } else { + ep[-1] = NCCL; + /* make nulls match so test fails */ + ep[0] |= 01; + } + } + + ep += iflag; + + continue; + + case '\\': + switch (c = GETC()) { + + case '(': + if (nbra >= NBRA) + ERROR(43); + *bracketp++ = nbra; + *ep++ = CBRA; + *ep++ = nbra++; + continue; + + case ')': + if (bracketp <= bracket) + ERROR(42); + *ep++ = CKET; + *ep++ = *--bracketp; + closed++; + continue; + + case '{': + if (lastep == (char *) 0) + goto defchar; + *lastep |= RNGE; + cflg = 0; + nlim: + c = GETC(); + i = 0; + do { + if ('0' <= c && c <= '9') + i = 10 * i + c - '0'; + else + ERROR(16); + } while (((c = GETC()) != '\\') && (c != ',')); + if (i >= 255) + ERROR(11); + *ep++ = i; + if (c == ',') { + if (cflg++) + ERROR(44); + if ((c = GETC()) == '\\') + *ep++ = 255; + else { + UNGETC(c); + goto nlim; + /* get 2'nd number */ + } + } + if (GETC() != '}') + ERROR(45); + if (!cflg) /* one number */ + *ep++ = i; + else if ((ep[-1] & 0377) < (ep[-2] & 0377)) + ERROR(46); + continue; + + case '\n': + ERROR(36); + + case 'n': + c = '\n'; + goto defchar; + + default: + if (c >= '1' && c <= '9') { + if ((c -= '1') >= closed) + ERROR(25); + *ep++ = CBACK; + *ep++ = c; + continue; + } + } + /* Drop through to default to use \ to turn off special chars */ + + defchar: + default: + lastep = ep; + *ep++ = CCHR; + *ep++ = c; + } + } +} + +int +step(p1, p2) +char *p1, *p2; +{ + int c; + + + if (circf) { + loc1 = p1; + return (advance(p1, p2)); + } + /* fast check for first character */ + if (*p2 == CCHR) { + c = p2[1]; + do { + if (*p1 != c) + continue; + if (advance(p1, p2)) { + loc1 = p1; + return (1); + } + } while (*p1++); + return (0); + } + /* regular algorithm */ + do { + if (advance(p1, p2)) { + loc1 = p1; + return (1); + } + } while (*p1++); + return (0); +} + +advance(lp, ep) +char *lp, *ep; +{ + char *curlp; + int c; + char *bbeg; + char neg; + int ct; + + while (1) { + neg = 0; + switch (*ep++) { + + case CCHR: + if (*ep++ == *lp++) + continue; + return (0); + + case CDOT: + if (*lp++) + continue; + return (0); + + case CDOL: + if (*lp == 0) + continue; + return (0); + + case CCEOF: + loc2 = lp; + return (1); + + case CXCL: + c = (unsigned char)*lp++; + if (ISTHERE(c)) { + ep += 32; + continue; + } + return (0); + + case NCCL: + neg = 1; + + case CCL: + c = *lp++; + if (((c & 0200) == 0 && ISTHERE(c)) ^ neg) { + ep += 16; + continue; + } + return (0); + + case CBRA: + braslist[*ep++] = lp; + continue; + + case CKET: + braelist[*ep++] = lp; + continue; + + case CCHR | RNGE: + c = *ep++; + getrnge(ep); + while (low--) + if (*lp++ != c) + return (0); + curlp = lp; + while (size--) + if (*lp++ != c) + break; + if (size < 0) + lp++; + ep += 2; + goto star; + + case CDOT | RNGE: + getrnge(ep); + while (low--) + if (*lp++ == '\0') + return (0); + curlp = lp; + while (size--) + if (*lp++ == '\0') + break; + if (size < 0) + lp++; + ep += 2; + goto star; + + case CXCL | RNGE: + getrnge(ep + 32); + while (low--) { + c = (unsigned char)*lp++; + if (!ISTHERE(c)) + return (0); + } + curlp = lp; + while (size--) { + c = (unsigned char)*lp++; + if (!ISTHERE(c)) + break; + } + if (size < 0) + lp++; + ep += 34; /* 32 + 2 */ + goto star; + + case NCCL | RNGE: + neg = 1; + + case CCL | RNGE: + getrnge(ep + 16); + while (low--) { + c = *lp++; + if (((c & 0200) || !ISTHERE(c)) ^ neg) + return (0); + } + curlp = lp; + while (size--) { + c = *lp++; + if (((c & 0200) || !ISTHERE(c)) ^ neg) + break; + } + if (size < 0) + lp++; + ep += 18; /* 16 + 2 */ + goto star; + + case CBACK: + bbeg = braslist[*ep]; + ct = braelist[*ep++] - bbeg; + + if (ecmp(bbeg, lp, ct)) { + lp += ct; + continue; + } + return (0); + + case CBACK | STAR: + bbeg = braslist[*ep]; + ct = braelist[*ep++] - bbeg; + curlp = lp; + while (ecmp(bbeg, lp, ct)) + lp += ct; + + while (lp >= curlp) { + if (advance(lp, ep)) + return (1); + lp -= ct; + } + return (0); + + + case CDOT | STAR: + curlp = lp; + while (*lp++); + goto star; + + case CCHR | STAR: + curlp = lp; + while (*lp++ == *ep); + ep++; + goto star; + + case CXCL | STAR: + curlp = lp; + do { + c = (unsigned char)*lp++; + } while (ISTHERE(c)); + ep += 32; + goto star; + + case NCCL | STAR: + neg = 1; + + case CCL | STAR: + curlp = lp; + do { + c = *lp++; + } while (((c & 0200) == 0 && ISTHERE(c)) ^ neg); + ep += 16; + goto star; + + star: + do { + if (--lp == locs) + break; + if (advance(lp, ep)) + return (1); + } while (lp > curlp); + return (0); + + } + } +} + +static +getrnge(str) +char *str; +{ + low = *str++ & 0377; + size = ((*str & 0377) == 255)? 20000: (*str &0377) - low; +} + +#ifdef __cplusplus +} +#endif + +#endif /* _REGEXP_H */ diff --git a/usr/src/ucbhead/resolv.h b/usr/src/ucbhead/resolv.h new file mode 100644 index 0000000000..1370e09d62 --- /dev/null +++ b/usr/src/ucbhead/resolv.h @@ -0,0 +1,79 @@ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* + * Copyright (c) 1983, 1987 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + */ + +/* + * Global defines and variables for resolver stub. + */ + +#ifndef _RESOLV_H +#define _RESOLV_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#include <sys/types.h> +#include <netinet/in.h> + +#ifdef __cplusplus +extern "C" { +#endif + +#define ADDRSORT 1 /* enable the address-sorting option */ +#define MAXADDR 10 /* max # addresses to sort by */ + +#define MAXDNAME 256 +#define MAXNS 3 /* max # name servers we'll track */ +#define MAXDNSRCH 3 /* max # default domain levels to try */ +#define LOCALDOMAINPARTS 2 /* min levels in name that is "local" */ + +#define RES_TIMEOUT 6 /* seconds between retries */ + +struct state { + int retrans; /* retransmition time interval */ + int retry; /* number of times to retransmit */ + int options; /* option flags - see below. */ + int nscount; /* number of name servers */ + struct sockaddr_in nsaddr_list[MAXNS]; /* address of name server */ +#define nsaddr nsaddr_list[0] /* for backward compatibility */ + ushort_t id; /* current packet id */ + char defdname[MAXDNAME]; /* default domain */ + char *dnsrch[MAXDNSRCH+1]; /* components of domain to search */ + int ascount; /* number of addresses */ + struct in_addr sort_list[MAXADDR]; /* address sorting list */ +}; + +/* + * Resolver options + */ +#define RES_INIT 0x0001 /* address initialized */ +#define RES_DEBUG 0x0002 /* print debug messages */ +#define RES_AAONLY 0x0004 /* authoritative answers only */ +#define RES_USEVC 0x0008 /* use virtual circuit */ +#define RES_PRIMARY 0x0010 /* query primary server only */ +#define RES_IGNTC 0x0020 /* ignore trucation errors */ +#define RES_RECURSE 0x0040 /* recursion desired */ +#define RES_DEFNAMES 0x0080 /* use default domain name */ +#define RES_STAYOPEN 0x0100 /* Keep TCP socket open */ +#define RES_DNSRCH 0x0200 /* search up local domain tree */ + +#define RES_DEFAULT (RES_RECURSE | RES_DEFNAMES | RES_DNSRCH) + +extern struct state _res; +extern char *p_cdname(), *p_rr(), *p_type(), *p_class(); + +#ifdef __cplusplus +} +#endif + +#endif /* _RESOLV_H */ + diff --git a/usr/src/ucbhead/setjmp.h b/usr/src/ucbhead/setjmp.h new file mode 100644 index 0000000000..1757f760fb --- /dev/null +++ b/usr/src/ucbhead/setjmp.h @@ -0,0 +1,137 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +/* + * 4.3BSD setjmp compatibility header + * + * 4.3BSD setjmp/longjmp is equivalent to SVR4 sigsetjmp/siglongjmp - + * 4.3BSD _setjmp/_longjmp is equivalent to SVR4 setjmp/longjmp + */ + +#ifndef _SETJMP_H +#define _SETJMP_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#include <sys/types.h> +#include <sys/signal.h> +#include <sys/ucontext.h> + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * The sizes of the jump-buffer (_JBLEN) and the sigjump-buffer + * (_SIGJBLEN) are defined by the appropriate, processor specific, ABI. + */ +#if defined(__amd64) +#define _JBLEN 128 /* must be the same as _SIGJBLEN for libucb */ +#define _SIGJBLEN 128 /* ABI value */ +#elif defined(__i386) +#define _JBLEN 128 /* must be the same as _SIGJBLEN for libucb */ +#define _SIGJBLEN 128 /* ABI value */ +#elif defined(__sparcv9) +#define _JBLEN 19 /* ABI value */ +#define _SIGJBLEN 19 /* ABI value */ +#elif defined(__sparc) +#define _JBLEN 19 /* _SIGJBLEN */ +#define _SIGJBLEN 19 /* ABI value */ +#else +#error "ISA not supported" +#endif + +#if defined(__i386) || defined(__amd64) || \ + defined(__sparc) || defined(__sparcv9) + +#if !defined(_LP64) && defined(__cplusplus) +typedef int jmp_buf[_JBLEN]; +#else +typedef long jmp_buf[_JBLEN]; +#endif + +#else +#error "ISA not supported" +#endif + +#if defined(__i386) || defined(__amd64) || \ + defined(__sparc) || defined(__sparcv9) + +#if !defined(_LP64) && defined(__cplusplus) +typedef int sigjmp_buf[_SIGJBLEN]; +#else +typedef long sigjmp_buf[_SIGJBLEN]; +#endif + +#else +#error "ISA not supported" +#endif + +#define setjmp(env) _sigsetjmp((env), 1) +#define longjmp(env, val) _siglongjmp((env), (val)) +#define _setjmp(env) _sigsetjmp((env), 0) +#define _longjmp(env, val) _siglongjmp((env), (val)) + +#if defined(__STDC__) + +extern int _sigsetjmp(sigjmp_buf, int); +#pragma unknown_control_flow(_sigsetjmp) +extern void _siglongjmp(sigjmp_buf, int) __NORETURN; + +extern int sigsetjmp(sigjmp_buf, int); +#pragma unknown_control_flow(sigsetjmp) +extern void siglongjmp(sigjmp_buf, int) __NORETURN; + +#else + +extern int _sigsetjmp(); +#pragma unknown_control_flow(_sigsetjmp) +extern void _siglongjmp(); + +extern int sigsetjmp(); +#pragma unknown_control_flow(sigsetjmp) +extern void siglongjmp(); + +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* _SETJMP_H */ diff --git a/usr/src/ucbhead/sgtty.h b/usr/src/ucbhead/sgtty.h new file mode 100644 index 0000000000..7b6debf640 --- /dev/null +++ b/usr/src/ucbhead/sgtty.h @@ -0,0 +1,54 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright (c) 1997, by Sun Microsystems, Inc. + * All rights reserved. + */ + +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + + +/* + * Note that the guard is carefully crafted here. + */ + +#ifndef _SYS_IOCTL_H + +#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.1 */ + +#include <sys/ioctl.h> + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef __STDC__ +extern int stty(int, struct sgttyb *); +extern int gtty(int, struct sgttyb *); +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* _SYS_IOCTL_H */ diff --git a/usr/src/ucbhead/signal.h b/usr/src/ucbhead/signal.h new file mode 100644 index 0000000000..43d92a01d1 --- /dev/null +++ b/usr/src/ucbhead/signal.h @@ -0,0 +1,50 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 2003 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +/* + * Note that the guard is carefully crafted here. + */ + +#ifndef _SIGNAL_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#include <sys/signal.h> + +#endif /* _SIGNAL_H */ diff --git a/usr/src/ucbhead/stdio.h b/usr/src/ucbhead/stdio.h new file mode 100644 index 0000000000..7130b93169 --- /dev/null +++ b/usr/src/ucbhead/stdio.h @@ -0,0 +1,339 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +/* + * User-visible pieces of the ANSI C standard I/O package. + */ + +#ifndef _STDIO_H +#define _STDIO_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#include <sys/feature_tests.h> +#include <sys/va_list.h> +#include <stdio_tag.h> +#include <stdio_impl.h> + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef BSD +#define BSD +#endif + +#ifndef _SIZE_T +#define _SIZE_T +#if !defined(_LP64) && defined(__cplusplus) +typedef unsigned int size_t; +#else +typedef unsigned long size_t; +#endif +#endif + +#ifndef _SSIZE_T +#define _SSIZE_T +#if !defined(_LP64) && defined(__cplusplus) +typedef int ssize_t; +#else +typedef long ssize_t; +#endif +#endif + +typedef long fpos_t; + +#ifndef NULL +#define NULL 0 +#endif + +#if defined(__STDC__) + +#if #machine(pdp11) +#define BUFSIZ 512 +#define _STDIO_REVERSE +#elif #machine(u370) +#define BUFSIZ 4096 +#define _STDIO_REVERSE +#define _STDIO_ALLOCATE +#else +#define BUFSIZ 1024 +#endif + +#else /* !defined(__STDC__) */ + +#if pdp11 || u370 + +#if pdp11 +#define BUFSIZ 512 +#define _STDIO_REVERSE +#else /* u370 */ +#define BUFSIZ 4096 +#define _STDIO_REVERSE +#define _STDIO_ALLOCATE +#endif + +#else +#define BUFSIZ 1024 +#endif + +#endif /* __STDC__ */ + +#if defined(__i386) +#define _NFILE 60 /* initial number of streams: Intel x86 ABI */ +#else +#define _NFILE 20 /* initial number of streams: SPARC ABI and default */ +#endif + +#define _SBFSIZ 8 /* compatibility with shared libs */ + +#define _IOFBF 0000 /* full buffered */ +#define _IOLBF 0100 /* line buffered */ +#define _IONBF 0004 /* not buffered */ +#define _IOEOF 0020 /* EOF reached on read */ +#define _IOERR 0040 /* I/O error from system */ + +#define _IOREAD 0001 /* currently reading */ +#define _IOWRT 0002 /* currently writing */ +#define _IORW 0200 /* opened for reading and writing */ +#define _IOMYBUF 0010 /* stdio malloc()'d buffer */ + +#ifndef EOF +#define EOF (-1) +#endif + +#define FOPEN_MAX _NFILE +#define FILENAME_MAX 1024 /* max # of characters in a path name */ + +#define SEEK_SET 0 +#define SEEK_CUR 1 +#define SEEK_END 2 +#define TMP_MAX 17576 /* 26 * 26 * 26 */ + +#if !defined(_STRICT_STDC) || defined(_POSIX_SOURCE) || defined(_XOPEN_SOURCE) +#define L_ctermid 9 +#define L_cuserid 9 +#define P_tmpdir "/var/tmp/" +#endif + +#define L_tmpnam 25 /* (sizeof(P_tmpdir) + 15) */ + +#if defined(__STDC__) +#define stdin (&__iob[0]) +#define stdout (&__iob[1]) +#define stderr (&__iob[2]) +#else +#define stdin (&_iob[0]) +#define stdout (&_iob[1]) +#define stderr (&_iob[2]) +#endif + +#ifndef _FILEDEFED +#define _FILEDEFED +typedef __FILE FILE; +#endif + +#if defined(__STDC__) +extern FILE __iob[_NFILE]; +#else +extern FILE _iob[_NFILE]; +#endif +extern FILE *_lastbuf; +extern unsigned char *_bufendtab[]; +#ifndef _STDIO_ALLOCATE +extern unsigned char _sibuf[], _sobuf[]; +#endif + +/* Large file interfaces */ +/* transition back from explicit 64-bit offset to implicit (64-bit) offset */ +#if defined(_LP64) && defined(_LARGEFILE64_SOURCE) +#ifdef __PRAGMA_REDEFINE_EXTNAME +#pragma redefine_extname fopen64 fopen +#pragma redefine_extname freopen64 freopen +#else +#define fopen64 fopen +#define freopen64 freopen +#endif +#endif + +/* transition from 32-bit offset to explicit 64-bit offset */ +#if !defined(_LP64) && (_FILE_OFFSET_BITS == 64) +#ifdef __PRAGMA_REDEFINE_EXTNAME +#pragma redefine_extname fopen fopen64 +#pragma redefine_extname freopen freopen64 +#else +#define fopen fopen64 +#define freopen freopen64 +#endif +#endif + +#if defined(__STDC__) + +extern int remove(const char *); +extern int rename(const char *, const char *); +extern int fclose(FILE *); +extern int fflush(FILE *); +extern FILE *fopen(const char *, const char *); +extern FILE *freopen(const char *, const char *, FILE *); +extern void setbuf(FILE *, char *); +extern void setbuffer(FILE *, char *, int); +extern int setlinebuf(FILE *); +extern int setvbuf(FILE *, char *, int, size_t); +/* PRINTFLIKE2 */ +extern int fprintf(FILE *, const char *, ...); +/* SCANFLIKE2 */ +extern int fscanf(FILE *, const char *, ...); +/* PRINTFLIKE1 */ +extern int printf(const char *, ...); +/* SCANFLIKE1 */ +extern int scanf(const char *, ...); +/* PRINTFLIKE2 */ +extern char *sprintf(const char *, const char *, ...); +/* SCANFLIKE2 */ +extern int sscanf(const char *, const char *, ...); +extern int vfprintf(FILE *, const char *, __va_list); +extern int vprintf(const char *, __va_list); +extern char *vsprintf(char *, char *, __va_list); +extern int fgetc(FILE *); +extern char *fgets(char *, int, FILE *); +extern int fputc(int, FILE *); +extern int fputs(const char *, FILE *); +extern int getc(FILE *); +extern int getchar(void); +extern char *gets(char *); +extern int putc(int, FILE *); +extern int putchar(int); +extern int puts(const char *); +extern int ungetc(int, FILE *); +extern size_t fread(void *, size_t, size_t, FILE *); +extern size_t fwrite(const void *, size_t, size_t, FILE *); +extern int fgetpos(FILE *, fpos_t *); +extern int fseek(FILE *, long, int); +extern int fsetpos(FILE *, const fpos_t *); +extern long ftell(FILE *); +extern void rewind(FILE *); +extern void clearerr(FILE *); +extern int feof(FILE *); +extern int ferror(FILE *); +extern void perror(const char *); + +extern int __filbuf(FILE *); +extern int __flsbuf(int, FILE *); + +#if !defined(_STRICT_STDC) || defined(_POSIX_SOURCE) || defined(_XOPEN_SOURCE) + /* non-ANSI standard compilation */ + +extern FILE *fdopen(int, const char *); +extern FILE *popen(const char *, const char *); +extern char *ctermid(char *); +extern char *cuserid(char *); +extern char *tempnam(const char *, const char *); +extern int getw(FILE *); +extern int putw(int, FILE *); +extern int pclose(FILE *); +extern int system(const char *); +extern int fileno(FILE *); + +#endif /* !defined(_STRICT_STDC) */ + +#else /* !defined __STDC__ */ +#define _bufend(p) _bufendtab[fileno(p)] +#define _bufsiz(p) (_bufend(p) - (p)->_base) + +extern FILE *fopen(), *fdopen(), *freopen(), *popen(); +extern long ftell(); +extern void rewind(), setbuf(), setbuffer(); +extern int setlinebuf(); +extern char *ctermid(), *cuserid(), *fgets(), *gets(), *sprintf(), + *vsprintf(); +extern int fclose(), fflush(), fread(), fwrite(), fseek(), fgetc(), + getw(), pclose(), printf(), fprintf(), + vprintf(), vfprintf(), fputc(), putw(), + puts(), fputs(), scanf(), fscanf(), sscanf(), + setvbuf(), system(), ungetc(); +extern int fileno(); +extern int getc(), getchar(), putc(), putchar(), feof(), ferror(); +extern void clearerr(); + +#endif /* __STDC__ */ + +#ifndef __lint + +#ifndef _LP64 + +#ifdef __STDC__ + +#define getc(p) (--(p)->_cnt < 0 ? __filbuf(p) : (int)*(p)->_ptr++) +#define putc(x, p) (--(p)->_cnt < 0 ? __flsbuf((x), (p)) \ + : (int)(*(p)->_ptr++ = (x))) + +#else /* __STDC__ */ + +#define getc(p) (--(p)->_cnt < 0 ? _filbuf(p) : (int)*(p)->_ptr++) +#define putc(x, p) (--(p)->_cnt < 0 ? \ + _flsbuf((unsigned char) (x), (p)) : \ + (int)(*(p)->_ptr++ = (unsigned char)(x))) +#endif /* __STDC__ */ + +#define clearerr(p) ((void) ((p)->_flag &= ~(_IOERR | _IOEOF))) +#define feof(p) ((p)->_flag & _IOEOF) +#define ferror(p) ((p)->_flag & _IOERR) + +#endif /* _LP64 */ + +#define getchar() getc(stdin) +#define putchar(x) putc((x), stdout) + +#endif /* __lint */ + +#if defined(_LARGEFILE64_SOURCE) && !((_FILE_OFFSET_BITS == 64) && \ + !defined(__PRAGMA_REDEFINE_EXTNAME)) +#if defined(__STDC__) +extern FILE *fopen64(const char *, const char *); +extern FILE *freopen64(const char *, const char *, FILE *); +#else +extern FILE *fopen64(), *freopen64(); +#endif +#endif /* _LARGEFILE64_SOURCE... */ + +#ifdef __cplusplus +} +#endif + +#endif /* _STDIO_H */ diff --git a/usr/src/ucbhead/strings.h b/usr/src/ucbhead/strings.h new file mode 100644 index 0000000000..47e96a2564 --- /dev/null +++ b/usr/src/ucbhead/strings.h @@ -0,0 +1,71 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +/* + * External function definitions + * for routines described in string(3). + */ + +#ifndef _STRINGS_H +#define _STRINGS_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#include <string.h> + +#ifdef __cplusplus +extern "C" { +#endif + +#if defined(__STDC__) +extern char *index(char *, char); +extern char *rindex(char *, char); +extern int bcmp(const void *, const void *, size_t); +extern void bcopy(const void *, void *, size_t); +extern void bzero(void *, size_t); +#else +extern char *index(); +extern char *rindex(); +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* _STRINGS_H */ diff --git a/usr/src/ucbhead/struct.h b/usr/src/ucbhead/struct.h new file mode 100644 index 0000000000..09deb59234 --- /dev/null +++ b/usr/src/ucbhead/struct.h @@ -0,0 +1,53 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +/* + * access to information relating to the fields of a structure + */ + +#ifndef _STRUCT_H +#define _STRUCT_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#define fldoff(str, fld) ((long)&(((struct str *)0)->fld)) +#define fldsiz(str, fld) (sizeof (((struct str *)0)->fld)) +#define strbase(str, ptr, fld) ((struct str *)((char *)(ptr)-fldoff(str, fld))) + +#endif /* !_STRUCT_H */ diff --git a/usr/src/ucbhead/sys/dir.h b/usr/src/ucbhead/sys/dir.h new file mode 100644 index 0000000000..1cf5567127 --- /dev/null +++ b/usr/src/ucbhead/sys/dir.h @@ -0,0 +1,203 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#ifndef _SYS_DIR_H +#define _SYS_DIR_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#include <sys/isa_defs.h> +#include <sys/int_types.h> + +/* + * This header file provides BSD compatibility for DIR and direct structures. + * The fields in the BSD DIR structure are identical to to the SVR4 DIR + * structure, except for the fact that the dd_buf field in SVR4 is not + * statically allocated. + * The BSD direct structure is similar (not identical) to the dirent + * structure. All fields of the direct structure can be obtained using + * the information provided by dirent. + * All routines manipulating DIR structures are compatible, only readdir + * is not. The BSD version of this routine returns a direct structure. + */ + +#ifdef __cplusplus +extern "C" { +#endif + +#if !defined(KERNEL) && !defined(DEV_BSIZE) +#define DEV_BSIZE 512 +#endif +#define DIRBUF 8192 +#define DIRBLKSIZ DIRBUF +#define MAXNAMLEN 255 + +#if _FILE_OFFSET_BITS == 32 +struct direct { + ulong_t d_ino; /* inode number of entry */ + ushort_t d_reclen; /* length of this record */ + ushort_t d_namlen; /* length of string in d_name */ + char d_name[MAXNAMLEN+1]; /* name of entry */ +}; +#elif _FILE_OFFSET_BITS == 64 +struct direct { + ino_t d_ino; /* inode number of entry */ + ushort_t d_reclen; /* length of this record */ + ushort_t d_namlen; /* length of string in d_name */ + char d_name[MAXNAMLEN+1]; /* name of entry */ +}; +#endif +#if defined(_LARGEFILE64_SOURCE) +struct direct64 { + ino64_t d_ino; /* inode number of entry */ + ushort_t d_reclen; /* length of this record */ + ushort_t d_namlen; /* length of string in d_name */ + char d_name[MAXNAMLEN+1]; /* name of entry */ +}; +#endif + +/* + * The macro DIRSIZ(dp) gives an amount of space required to represent + * a directory entry. + */ +#undef DIRSIZ +#undef DIRSIZ64 + +#if _FILE_OFFSET_BITS == 32 +#define DIRSIZ(dp) \ + ((sizeof (struct direct) - sizeof ((dp)->d_name) + \ + (strlen((dp)->d_name)+1) + 3) & ~3) +#elif _FILE_OFFSET_BITS == 64 +#define DIRSIZ(dp) \ + ((sizeof (struct direct64) - sizeof ((dp)->d_name) + \ + (strlen((dp)->d_name)+1) + 3) & ~3) +#endif +#if defined(_LARGEFILE64_SOURCE) +#define DIRSIZ64(dp) \ + ((sizeof (struct direct64) - sizeof ((dp)->d_name) + \ + (strlen((dp)->d_name)+1) + 3) & ~3) +#endif + +#ifndef KERNEL +/* + * Definitions for library routines operating on directories. + */ +typedef struct _dirdesc { + int dd_fd; + int dd_loc; + int dd_size; + char *dd_buf; +} DIR; + +#ifndef NULL +#define NULL 0 +#endif + +#if defined(_LP64) && defined(_LARGEFILE64_SOURCE) +#ifdef __PRAGMA_REDEFINE_EXTNAME +#pragma redefine_extname readdir64 readdir +#pragma redefine_extname scandir64 scandir +#pragma redefine_extname alphasort64 alphasort +#else +#define readdir64 readdir +#define scandir64 scandir +#define alphasort64 alphasort +#define direct64 direct +#endif +#endif + +#if !defined(_LP64) && (_FILE_OFFSET_BITS == 64) +#ifdef __PRAGMA_REDEFINE_EXTNAME +#pragma redefine_extname readdir readdir64 +#pragma redefine_extname scandir scandir64 +#pragma redefine_extname alphasort alphasort64 +#else +#define readdir readdir64 +#define scandir scandir64 +#define alphasort alphasort64 +#define direct direct64 +#endif +#endif + +#if defined(__STDC__) +extern DIR *opendir(const char *); +extern struct direct *readdir(DIR *); +extern long telldir(DIR *); +extern void seekdir(DIR *, long); +extern int scandir(char *, struct direct *(*[]), + int (*)(struct direct *), + int (*)(struct direct **, struct direct **)); +extern int alphasort(struct direct **, struct direct **); +extern void rewinddir(DIR *); +extern int closedir(DIR *); +#else +extern DIR *opendir(); +extern struct direct *readdir(); +extern long telldir(); +extern void seekdir(); +extern int scandir(); +extern int alphasort(); +extern void rewinddir(); +extern void closedir(); +#endif + +#if defined(_LARGEFILE64_SOURCE) && !((_FILE_OFFSET_BITS == 64) && \ + !defined(__PRAGMA_REDEFINE_EXTNAME)) +#if defined(__STDC__) +extern struct direct64 *readdir64(DIR *); +extern int scandir64(char *, struct direct64 *(*[]), + int (*)(struct direct64 *), + int (*)(struct direct64 **, struct direct64 **)); +extern int alphasort64(struct direct64 **, struct direct64 **); +#else +extern struct direct64 *readdir64(); +extern int scandir64(); +extern int alphasort64(); +#endif +#endif /* _LARGEFILE64_SOURCE... */ + +#define rewinddir(dirp) seekdir((dirp), 0) + +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* _SYS_DIR_H */ diff --git a/usr/src/ucbhead/sys/fcntl.h b/usr/src/ucbhead/sys/fcntl.h new file mode 100644 index 0000000000..8567282301 --- /dev/null +++ b/usr/src/ucbhead/sys/fcntl.h @@ -0,0 +1,249 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1998 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#ifndef _SYS_FCNTL_H +#define _SYS_FCNTL_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#ifndef _SYS_TYPES_H +#include <sys/types.h> +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/* Flag values accessible to open(2) and fcntl(2) */ +/* (The first three can only be set by open) */ +#define O_RDONLY 0 +#define O_WRONLY 1 +#define O_RDWR 2 +#define O_NDELAY 04 /* Non-blocking I/O */ +#define O_APPEND 010 /* append (writes guaranteed at the end) */ +#define O_SYNC 020 /* synchronous write option */ +#define O_NONBLOCK 0200 /* Non-blocking I/O (POSIX) */ +#define O_PRIV 010000 /* Private access to file */ + +#ifdef _LARGEFILE_SOURCE +#define O_LARGEFILE 0x2000 +#endif + +/* Flag values accessible only to open(2) */ +#define O_CREAT 00400 /* open with file create (uses third open arg) */ +#define O_TRUNC 01000 /* open with truncation */ +#define O_EXCL 02000 /* exclusive open */ +#define O_NOCTTY 04000 /* don't allocate controlling tty (POSIX) */ + +/* fcntl(2) requests */ +#define F_DUPFD 0 /* Duplicate fildes */ +#define F_GETFD 1 /* Get fildes flags */ +#define F_SETFD 2 /* Set fildes flags */ +#define F_GETFL 3 /* Get file flags */ +#define F_SETFL 4 /* Set file flags */ +#define F_SETLK 6 /* Set file lock */ +#define F_SETLKW 7 /* Set file lock and wait */ + +/* + * Applications that read /dev/mem must be built like the kernel. A new + * symbol "_KMEMUSER" is defined for this purpose. + * Applications that read /dev/mem will migrate with the kernel + * to an "_LTYPES" definition. + */ + +#if defined(_KERNEL) || defined(_KMEMUSER) +#define F_GETLK 14 /* Get file lock */ +#define F_O_GETLK 5 /* SVR3 Get file lock */ + +#else /* user definition */ + +#if defined(_LTYPES) /* EFT definition */ +#define F_GETLK 14 /* Get file lock */ +#else +#define F_GETLK 5 /* Get file lock */ +#endif /* defined(_LTYPES) */ + +#endif /* defined(_KERNEL) */ + +#define F_SETLK 6 /* Set file lock */ +#define F_SETLKW 7 /* Set file lock and wait */ + + +#define F_CHKFL 8 /* Reserved */ +#define F_ALLOCSP 10 /* Reserved */ +#define F_FREESP 11 /* Free file space */ +#define F_ISSTREAM 13 /* Is the file desc. a stream ? */ +#define F_PRIV 15 /* Turn on private access to file */ +#define F_NPRIV 16 /* Turn off private access to file */ +#define F_QUOTACTL 17 /* UFS quota call */ +#define F_BLOCKS 18 /* Get number of BLKSIZE blocks allocated */ +#define F_BLKSIZE 19 /* Get optimal I/O block size */ + +#define F_GETOWN 23 /* Get owner */ +#define F_SETOWN 24 /* Set owner */ + +/* flags for F_GETFL, F_SETFL-- copied from <sys/file.h> */ +#ifndef FOPEN +#define FOPEN 0xFFFFFFFF +#define FREAD 0x01 +#define FWRITE 0x02 +#define FNDELAY 0x04 +#define FAPPEND 0x08 +#define FSYNC 0x10 +#define FNONBLOCK 0x80 + +#define FMASK 0xFF /* should be disjoint from FASYNC */ + +/* open-only modes */ + +#define FCREAT 0x0100 +#define FTRUNC 0x0200 +#define FEXCL 0x0400 +#define FNOCTTY 0x0800 +#define FASYNC 0x1000 + +/* file descriptor flags */ +#define FCLOSEXEC 001 /* close on exec */ +#endif + +/* + * File segment locking set data type - information passed to system by user. + */ +#if defined(_KERNEL) || defined(_KMEMUSER) + /* EFT definition */ +typedef struct flock { + short l_type; + short l_whence; + off_t l_start; + off_t l_len; /* len == 0 means until end of file */ + int l_sysid; + pid_t l_pid; + long pad[4]; /* reserve area */ +} flock_t; + +typedef struct o_flock { + short l_type; + short l_whence; + int l_start; + int l_len; /* len == 0 means until end of file */ + short l_sysid; + o_pid_t l_pid; +} o_flock_t; + +#else /* user level definition */ + +#if defined(_STYPES) + /* SVR3 definition */ +typedef struct flock { + short l_type; + short l_whence; + off_t l_start; + off_t l_len; /* len == 0 means until end of file */ + short l_sysid; + o-pid_t l_pid; +} flock_t; + +#else + +typedef struct flock { + short l_type; + short l_whence; + off_t l_start; + off_t l_len; /* len == 0 means until end of file */ + int l_sysid; + pid_t l_pid; + long pad[4]; /* reserve area */ +} flock_t; + +#endif /* define(_STYPES) */ + +#endif /* defined(_KERNEL) */ + +/* + * File segment locking types. + */ +#define F_RDLCK 01 /* Read lock */ +#define F_WRLCK 02 /* Write lock */ +#define F_UNLCK 03 /* Remove lock(s) */ + +/* + * POSIX constants + */ + +#define O_ACCMODE 3 /* Mask for file access modes */ +#define FD_CLOEXEC 1 /* close on exec flag */ + +/* large file compilation environment setup */ +#if !defined(_LP64) && _FILE_OFFSET_BITS == 64 +#ifdef __PRAGMA_REDEFINE_EXTNAME +#pragma redefine_extname open open64 +#pragma redefine_extname creat creat64 +#else +#define open open64 +#define creat creat64 +#endif +#endif /* !_LP64 && _FILE_OFFSET_BITS == 64 */ + +#if defined(_LP64) && defined(_LARGEFILE64_SOURCE) +#ifdef __PRAGMA_REDEFINE_EXTNAME +#pragma redefine_extname open64 open +#pragma redefine_extname creat64 creat +#else +#define open64 open +#define creat64 creat +#endif +#endif /* _LP64 && _LARGEFILE64_SOURCE */ + +#if defined(__STDC__) +extern int fcntl(int, int, ...); +extern int open(const char *, int, ...); +extern int creat(const char *, mode_t); +#if defined(_LARGEFILE64_SOURCE) && !((_FILE_OFFSET_BITS == 64) && \ + !defined(__PRAGMA_REDEFINE_EXTNAME)) +extern int open64(const char *, int, ...); +extern int creat64(const char *, mode_t); +#endif + +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* _SYS_FCNTL_H */ diff --git a/usr/src/ucbhead/sys/file.h b/usr/src/ucbhead/sys/file.h new file mode 100644 index 0000000000..10863380dd --- /dev/null +++ b/usr/src/ucbhead/sys/file.h @@ -0,0 +1,178 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1998 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#ifndef _SYS_FILE_H +#define _SYS_FILE_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#ifndef _SYS_TYPES_H +#include <sys/types.h> +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * One file structure is allocated for each open/creat/pipe call. + * Main use is to hold the read/write pointer associated with + * each open file. + */ + +typedef struct file +{ + struct file *f_next; /* pointer to next entry */ + struct file *f_prev; /* pointer to previous entry */ + ushort_t f_flag; + cnt_t f_count; /* reference count */ + struct vnode *f_vnode; /* pointer to vnode structure */ + off_t f_offset; /* read/write character pointer */ + struct cred *f_cred; /* credentials of user who opened it */ + struct aioreq *f_aiof; /* aio file list forward link */ + struct aioreq *f_aiob; /* aio file list backward link */ +/* #ifdef MERGE */ + struct file *f_slnk; /* XENIX semaphore queue */ +/* #endif MERGE */ +} file_t; + + +#ifndef _SYS_FCNTL_H +#include <sys/fcntl.h> +#endif + +/* flags - see also fcntl.h */ + +#ifndef FOPEN +#define FOPEN 0xFFFFFFFF +#define FREAD 0x01 +#define FWRITE 0x02 +#define FNDELAY 0x04 +#define FAPPEND 0x08 +#define FSYNC 0x10 +#define FNONBLOCK 0x80 /* Non-blocking flag (POSIX). */ + +#define FMASK 0xff /* should be disjoint from FASYNC */ + +/* open only modes */ + +#define FCREAT 0x100 +#define FTRUNC 0x200 +#define FEXCL 0x400 +#define FNOCTTY 0x800 /* don't allocate controlling tty (POSIX). */ +#define FASYNC 0x1000 /* asyncio is in progress */ +#define FPRIV 0x1000 /* open with private access */ + +/* file descriptor flags */ +#define FCLOSEXEC 001 /* close on exec */ +#endif + +/* record-locking options. */ +#define F_ULOCK 0 /* Unlock a previously locked region */ +#define F_LOCK 1 /* Lock a region for exclusive use */ +#define F_TLOCK 2 /* Test and lock a region for exclusive use */ +#define F_TEST 3 /* Test a region for other processes locks */ + +/* + * flock operations. + */ +#define LOCK_SH 1 /* shared lock */ +#define LOCK_EX 2 /* exclusive lock */ +#define LOCK_NB 4 /* don't block when locking */ +#define LOCK_UN 8 /* unlock */ + +/* + * Access call. + */ +#define F_OK 0 /* does file exist */ +#define X_OK 1 /* is it executable by caller */ +#define W_OK 2 /* writable by caller */ +#define R_OK 4 /* readable by caller */ + +/* + * Lseek call. + */ +#ifndef L_SET +#define L_SET 0 /* absolute offset */ +#define L_INCR 1 /* relative to current offset */ +#define L_XTND 2 /* relative to end of file */ +#endif + + +/* miscellaneous defines */ + +#define NULLFP ((struct file *)0) + +/* + * Count of number of entries in file list. + */ +extern unsigned int filecnt; + +/* + * routines dealing with user per-open file flags and + * user open files. getf() is declared in systm.h. It + * probably belongs here. + */ +#if defined(__STDC__) +extern void setf(int, file_t *); +extern void setpof(int, char); +extern char getpof(int); +extern int fassign(struct vnode **, int, int *); +#else +extern void setf(), setpof(); +extern char getpof(); +extern int fassign(); +#endif + +extern off_t lseek(); + +#if defined(_LARGEFILE64_SOURCE) && !((_FILE_OFFSET_BITS == 64) && \ + !defined(__PRAGMA_REDEFINE_EXTNAME)) +#if defined(__STDC__) +extern off64_t lseek64(int, off64_t, int); +#else +extern off64_t llseek64(); +#endif +#endif /* _LARGEFILE64_SOURCE... */ + +#ifdef __cplusplus +} +#endif + +#endif /* _SYS_FILE_H */ diff --git a/usr/src/ucbhead/sys/ioctl.h b/usr/src/ucbhead/sys/ioctl.h new file mode 100644 index 0000000000..f6fbbd8057 --- /dev/null +++ b/usr/src/ucbhead/sys/ioctl.h @@ -0,0 +1,148 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +/* + * There are some inherent problems in having a single file + * ioctl.h, with both System V and BSD flags. Introducing + * BSD flags into this file creates compilation problems + * with flags such as ECHO, NL1 etc., if termio.h and ioctl.h + * are included by the same file. Since these two files can + * be only included by System V applications, /usr/include/sys/ioctl.h + * will be System V mode and all the BSD flags will be turned off + * using #ifdef BSD_COMP. This file will also exist in + * /usr/ucbinclude/sys/ioctl.h for BSD applications but without the + * BSD flags turned off. System V appliactions can use ioctl.h without + * any changes, System V applications requiring BSD flags should + * -D BSD_COMP when compiling (and be warned about the common + * flags between System V and BSD) and BSD applications should + * use /usr/ucbinclude/sys/ioctl.h. + * + */ + +#ifndef _SYS_IOCTL_H +#define _SYS_IOCTL_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#define IOCTYPE 0xff00 + +#define LIOC ('l'<<8) +#define LIOCGETP (LIOC|1) +#define LIOCSETP (LIOC|2) +#define LIOCGETS (LIOC|5) +#define LIOCSETS (LIOC|6) + +#define DIOC ('d'<<8) +#define DIOCGETC (DIOC|1) +#define DIOCGETB (DIOC|2) +#define DIOCSETE (DIOC|3) + +/* BSD related defines */ + +#include <sys/types.h> +#include <sys/ttychars.h> +#include <sys/ttydev.h> +#include <sys/ttold.h> + +#define TANDEM O_TANDEM +#define CBREAK O_CBREAK +#ifndef _SGTTY_H +#define LCASE O_LCASE +#define ECHO O_ECHO +#define CRMOD O_CRMOD +#define RAW O_RAW +#define ODDP O_ODDP +#define EVENP O_EVENP +#define ANYP O_ANYP +#define NLDELAY O_NLDELAY +#define NL0 O_NL0 +#define NL1 O_NL1 +#define NL2 O_NL2 +#define NL3 O_NL3 +#define TBDELAY O_TBDELAY +#define TAB0 O_TAB0 +#define TAB1 O_TAB1 +#define TAB2 O_TAB2 +#define XTABS O_XTABS +#define CRDELAY O_CRDELAY +#define CR0 O_CR0 +#define CR1 O_CR1 +#define CR2 O_CR2 +#define CR3 O_CR3 +#define VTDELAY O_VTDELAY +#define FF0 O_FF0 +#define FF1 O_FF1 +#define BSDELAY O_BSDELAY +#define BS0 O_BS0 +#define BS1 O_BS1 +#define ALLDELAY O_ALLDELAY +#endif /* _SGTTY_H */ +#define CRTBS O_CRTBS +#define PRTERA O_PRTERA +#define CRTERA O_CRTERA +#define TILDE O_TILDE +#define MDMBUF O_MDMBUF +#define LITOUT O_LITOUT +#define TOSTOP O_TOSTOP +#define FLUSHO O_FLUSHO +#define NOHANG O_NOHANG +#define L001000 O_L001000 +#define CRTKIL O_CRTKIL +#define PASS8 O_PASS8 +#define CTLECH O_CTLECH +#define PENDIN O_PENDIN +#define DECCTQ O_DECCTQ +#define NOFLSH O_NOFLSH + +#define TIOCGSIZE TIOCGWINSZ +#define TIOCSSIZE TIOCSWINSZ + +#ifndef tIOC +#define tIOC ('t'<<8) +#endif + +#ifndef TIOCGPGRP +#define TIOCGPGRP (tIOC|20) /* get pgrp of tty */ +#define TIOCSPGRP (tIOC|21) /* set pgrp of tty */ +#endif + +#include <sys/filio.h> +#include <sys/sockio.h> + +#endif /* _SYS_IOCTL_H */ diff --git a/usr/src/ucbhead/sys/param.h b/usr/src/ucbhead/sys/param.h new file mode 100644 index 0000000000..dfd47aeb9d --- /dev/null +++ b/usr/src/ucbhead/sys/param.h @@ -0,0 +1,295 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#ifndef _SYS_PARAM_H +#define _SYS_PARAM_H + +#pragma ident "%Z%%M% %I% %E% SMI" + + +/* + * Fundamental variables; don't change too often. + * + * This file is included here for compatibility with + * SunOS, but it does *not* include all the values + * define in the SunOS version of this file. + */ + +#include <sys/isa_defs.h> +#include <limits.h> +#include <unistd.h> + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef MAX_INPUT +#define MAX_INPUT 512 /* Maximum bytes stored in the input queue */ +#endif + +#ifndef MAX_CANON +#define MAX_CANON 256 /* Maximum bytes for canoical processing */ +#endif + +#define UID_NOBODY 60001 +#define GID_NOBODY 60001 + +#define UID_NOACCESS 60002 /* user ID no access */ + +#define MAXPID ((pid_t)sysconf(_SC_MAXPID)) /* max process id */ +#define MAXUID 2147483647 /* max user id */ +#define MAXLINK 32767 /* max links */ + +#define NMOUNT 40 /* est. of # mountable fs for quota calc */ + +/* The values below are defined in limits.h */ +#define NOFILE OPEN_MAX /* max open files per process */ + +#define CANBSIZ 256 /* max size of typewriter line */ +#define HZ ((int)sysconf(_SC_CLK_TCK)) /* ticks/second of the clock */ +#define TICK (1000000000/((int)sysconf(_SC_CLK_TCK))) + +#define NCARGS 0x100000 /* # characters in exec arglist */ + /* must be multiple of NBPW. */ +/* + * These define the maximum and minimum allowable values of the + * configurable parameter NGROUPS_MAX. + */ +#define NGROUPS_UMAX 32 +#define NGROUPS_UMIN 8 + +#define NGROUPS NGROUPS_MAX /* max number groups, from limits.h */ +#define NOGROUP -1 /* marker for empty group set member */ + +/* + * Priorities. Should not be altered too much. + */ + +#define PMASK 0177 +#define PCATCH 0400 +#define PNOSTOP 01000 +#define PSWP 0 +#define PINOD 10 +#define PSNDD PINOD +#define PAMAP PINOD +#define PPMAP PINOD +#define PRIBIO 20 +#define PZERO 25 +#define PMEM 0 +#define NZERO 20 +#define PPIPE 26 +#define PVFS 27 +#define PWAIT 30 +#define PLOCK 35 +#define PSLEP 39 +#define PUSER 60 +#define PIDLE 127 + +/* + * Fundamental constants of the implementation--cannot be changed easily. + */ + +#define NBPS 0x20000 /* Number of bytes per segment */ +#define NBPW sizeof (int) /* number of bytes in an integer */ + +#if defined(_LP64) && !defined(__cplusplus) +#define NULL 0L +#else +#define NULL 0 +#endif + +#define CMASK 0 /* default mask for file creation */ +#define CDLIMIT (1L<<11) /* default max write address */ +#define NODEV (dev_t)(-1) +#define NBPSCTR 512 /* Bytes per disk sector. */ +#define UBSIZE 512 /* unix block size. */ +#define SCTRSHFT 9 /* Shift for BPSECT. */ + +#define lobyte(X) (((unsigned char *)&(X))[1]) +#define hibyte(X) (((unsigned char *)&(X))[0]) +#define loword(X) (((ushort_t *)&(X))[1]) +#define hiword(X) (((ushort_t *)&(X))[0]) + +/* REMOTE -- whether machine is primary, secondary, or regular */ +#define SYSNAME 9 /* # chars in system name */ +#define PREMOTE 39 + +/* + * MAXPATHLEN defines the longest permissible path length, + * including the terminating null, after expanding symbolic links. + * MAXSYMLINKS defines the maximum number of symbolic links + * that may be expanded in a path name. It should be set high + * enough to allow all legitimate uses, but halt infinite loops + * reasonably quickly. + * MAXNAMELEN is the length (including the terminating null) of + * the longest permissible file (component) name. + */ +#define MAXPATHLEN 1024 +#define MAXSYMLINKS 20 +#define MAXNAMELEN 256 + +#ifndef NADDR +#define NADDR 13 +#endif + +/* + * The following are defined to be the same as + * defined in /usr/include/limits.h. They are + * needed for pipe and FIFO compatibility. + */ +#ifndef PIPE_BUF /* max # bytes atomic in write to a pipe */ +#define PIPE_BUF 5120 +#endif /* PIPE_BUF */ + +#ifndef PIPE_MAX /* max # bytes written to a pipe in a write */ +#define PIPE_MAX 5120 +#endif /* PIPE_MAX */ + +#define PIPEBUF PIPE_BUF /* pipe buffer size */ + +#ifndef NBBY +#define NBBY 8 /* number of bits per byte */ +#endif + +/* macros replacing interleaving functions */ +#define dkblock(bp) ((bp)->b_blkno) +#define dkunit(bp) (minor((bp)->b_dev) >> 3) + +/* + * File system parameters and macros. + * + * The file system is made out of blocks of at most MAXBSIZE units, + * with smaller units (fragments) only in the last direct block. + * MAXBSIZE primarily determines the size of buffers in the buffer + * pool. It may be made larger without any effect on existing + * file systems; however making it smaller make make some file + * systems unmountable. + * + * Note that the blocked devices are assumed to have DEV_BSIZE + * "sectors" and that fragments must be some multiple of this size. + */ +#define MAXBSIZE 8192 +#define DEV_BSIZE 512 +#define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */ +#define MAXFRAG 8 + +#ifdef _LP64 +#define MAXOFF_T 0x7fffffffffffffffl +#define MAXOFFSET_T 0x7fffffffffffffffll +#else +#define MAXOFF_T 0x7fffffff +#ifndef _LONGLONG_TYPE +#define MAXOFFSET_T 0x7fffffff +#else +#define MAXOFFSET_T 0x7fffffffffffffffLL +#endif +#endif /* _LP64 */ + +#define btodb(bytes) /* calculates (bytes / DEV_BSIZE) */ \ + ((unsigned)(bytes) >> DEV_BSHIFT) +#define dbtob(db) /* calculates (db * DEV_BSIZE) */ \ + ((unsigned)(db) << DEV_BSHIFT) + +/* + * PAGES* describes the logical page size used by the system. + */ + +#define PAGESIZE (sysconf(_SC_PAGESIZE)) /* All the above, for logical */ +#define PAGEOFFSET (PAGESIZE - 1) +#define PAGEMASK (~PAGEOFFSET) + +/* + * Some random macros for units conversion. + */ + +/* + * pages to bytes, and back (with and without rounding) + */ +#define ptob(x) ((x) * PAGESIZE) +#define btop(x) (((unsigned)(x)) / PAGESIZE) +#define btopr(x) ((((unsigned)(x) + PAGEOFFSET) / PAGESIZE)) + +/* + * Signals + */ + +#include <sys/signal.h> +#include <sys/types.h> + +/* + * bit map related macros + */ +#define setbit(a, i) ((a)[(i)/NBBY] |= 1<<((i)%NBBY)) +#define clrbit(a, i) ((a)[(i)/NBBY] &= ~(1<<((i)%NBBY))) +#define isset(a, i) ((a)[(i)/NBBY] & (1<<((i)%NBBY))) +#define isclr(a, i) (((a)[(i)/NBBY] & (1<<((i)%NBBY))) == 0) + +/* + * Macros for fast min/max. + */ +#ifndef MIN +#define MIN(a, b) (((a) < (b))?(a):(b)) +#endif +#ifndef MAX +#define MAX(a, b) (((a) > (b))?(a):(b)) +#endif + +#define howmany(x, y) (((x)+((y)-1))/(y)) +#define roundup(x, y) ((((x)+((y)-1))/(y))*(y)) + +/* + * Scale factor for scaled integers used to count + * %cpu time and load averages. + */ +#define FSHIFT 8 /* bits to right of fixed binary point */ +#define FSCALE (1<<FSHIFT) + +/* + * Maximum size of hostname recognized and stored in the kernel. + * Same as in /usr/include/netdb.h + */ +#ifndef MAXHOSTNAMELEN +#define MAXHOSTNAMELEN 256 +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* _SYS_PARAM_H */ diff --git a/usr/src/ucbhead/sys/reboot.h b/usr/src/ucbhead/sys/reboot.h new file mode 100644 index 0000000000..9ff17c1a63 --- /dev/null +++ b/usr/src/ucbhead/sys/reboot.h @@ -0,0 +1,68 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#ifndef _VM_REBOOT_H +#define _VM_REBOOT_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +/* + * Arguments to reboot system call and flags to init. + * + * On the VAX, these are passed to boot program in r11, + * and on to init. + * + * On the Sun, these are parsed from the boot command line + * and used to construct the argument list for init. + */ + +#define RB_AUTOBOOT 0 /* flags for system auto-booting itself */ + +#define RB_ASKNAME 0x001 /* ask for file name to reboot from */ +#define RB_SINGLE 0x002 /* reboot to single user only */ +#define RB_NOSYNC 0x004 /* dont sync before reboot */ +#define RB_HALT 0x008 /* don't reboot, just halt */ +#define RB_INITNAME 0x010 /* name given for /etc/init */ +#define RB_NOBOOTRC 0x020 /* don't run /etc/rc.boot */ +#define RB_DEBUG 0x040 /* being run under debugger */ +#define RB_DUMP 0x080 /* dump system core */ +#define RB_WRITABLE 0x100 /* mount root read/write */ +#define RB_STRING 0x200 /* pass boot args to prom monitor */ + +#endif /* _VM_REBOOT_H */ diff --git a/usr/src/ucbhead/sys/resource.h b/usr/src/ucbhead/sys/resource.h new file mode 100644 index 0000000000..9a03d755cc --- /dev/null +++ b/usr/src/ucbhead/sys/resource.h @@ -0,0 +1,100 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#ifndef _SYS_RESOURCE_H +#define _SYS_RESOURCE_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#ifndef _SYS_RUSAGE_H +#include <sys/rusage.h> +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Process priority specifications to get/setpriority. + */ +#define PRIO_MIN -20 +#define PRIO_MAX 20 + +#define PRIO_PROCESS 0 +#define PRIO_PGRP 1 +#define PRIO_USER 2 + +/* + * Resource limits + * RLIMIT_RSS removed so RLIMIT_NOFILE takes the value of 5 + * to stay compatible with svr4 + */ +#define RLIMIT_CPU 0 /* cpu time in milliseconds */ +#define RLIMIT_FSIZE 1 /* maximum file size */ +#define RLIMIT_DATA 2 /* data size */ +#define RLIMIT_STACK 3 /* stack size */ +#define RLIMIT_CORE 4 /* core file size */ +#define RLIMIT_NOFILE 5 /* maximum descriptor index + 1 */ + +#define RLIM_NLIMITS 7 /* number of resource limits */ + +#define RLIM_INFINITY 0x7fffffff + +struct rlimit { + int rlim_cur; /* current (soft) limit */ + int rlim_max; /* maximum value for rlim_cur */ +}; + +#if defined(__STDC__) +extern int getpriority(int, int); +extern int setpriority(int, int, int); +extern int setrlimit(int, const struct rlimit *); +extern int getrlimit(int, struct rlimit *); +#else +extern int getpriority(); +extern int setpriority(); +extern int setrlimit(); +extern int getrlimit(); +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* !_SYS_RESOURCE_H */ diff --git a/usr/src/ucbhead/sys/rusage.h b/usr/src/ucbhead/sys/rusage.h new file mode 100644 index 0000000000..0ae0ab1309 --- /dev/null +++ b/usr/src/ucbhead/sys/rusage.h @@ -0,0 +1,70 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright (c) 1991-1997, by Sun Microsystems, Inc. + * All rights reserved. + */ + +#ifndef _SYS_RUSAGE_H +#define _SYS_RUSAGE_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#include <sys/time.h> + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Resource utilization information. + */ + +#define RUSAGE_SELF 0 +#define RUSAGE_CHILDREN -1 + +struct rusage { + struct timeval ru_utime; /* user time used */ + struct timeval ru_stime; /* system time used */ + long ru_maxrss; +#define ru_first ru_ixrss + long ru_ixrss; /* XXX: 0 */ + long ru_idrss; /* XXX: sum of rm_asrss */ + long ru_isrss; /* XXX: 0 */ + long ru_minflt; /* any page faults not requiring I/O */ + long ru_majflt; /* any page faults requiring I/O */ + long ru_nswap; /* swaps */ + long ru_inblock; /* block input operations */ + long ru_oublock; /* block output operations */ + long ru_msgsnd; /* messages sent */ + long ru_msgrcv; /* messages received */ + long ru_nsignals; /* signals received */ + long ru_nvcsw; /* voluntary context switches */ + long ru_nivcsw; /* involuntary " */ +#define ru_last ru_nivcsw +}; + +#ifdef __cplusplus +} +#endif + +#endif /* _SYS_RUSAGE_H */ diff --git a/usr/src/ucbhead/sys/signal.h b/usr/src/ucbhead/sys/signal.h new file mode 100644 index 0000000000..71a4e74d8c --- /dev/null +++ b/usr/src/ucbhead/sys/signal.h @@ -0,0 +1,496 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#ifndef _UCB_SYS_SIGNAL_H +#define _UCB_SYS_SIGNAL_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +/* + * 4.3BSD signal compatibility header + * + * this file includes all standard SVR4 header info, plus the 4.3BSD + * structures - 4.3BSD signal codes are translated to SVR4 generic + * signal codes where applicable + */ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * SysV <signal.h> + */ + +/* ---- <signal.h> ---- */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + + +#ifndef _SIGNAL_H +#define _SIGNAL_H + +/* ---- <sys/signal.h> ---- */ + +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + + +#ifndef _SYS_SIGNAL_H +#define _SYS_SIGNAL_H + +#define SIGHUP 1 /* hangup */ +#define SIGINT 2 /* interrupt (rubout) */ +#define SIGQUIT 3 /* quit (ASCII FS) */ +#define SIGILL 4 /* illegal instruction (not reset when caught) */ +#define SIGTRAP 5 /* trace trap (not reset when caught) */ +#define SIGIOT 6 /* IOT instruction */ +#define SIGABRT 6 /* used by abort, replace SIGIOT in the future */ +#define SIGEMT 7 /* EMT instruction */ +#define SIGFPE 8 /* floating point exception */ +#define SIGKILL 9 /* kill (cannot be caught or ignored) */ +#define SIGBUS 10 /* bus error */ +#define SIGSEGV 11 /* segmentation violation */ +#define SIGSYS 12 /* bad argument to system call */ +#define SIGPIPE 13 /* write on a pipe with no one to read it */ +#define SIGALRM 14 /* alarm clock */ +#define SIGTERM 15 /* software termination signal from kill */ +#define SIGUSR1 16 /* user defined signal 1 */ +#define SIGUSR2 17 /* user defined signal 2 */ +#define SIGCLD 18 /* child status change */ +#define SIGCHLD 18 /* child status change alias (POSIX) */ +#define SIGPWR 19 /* power-fail restart */ +#define SIGWINCH 20 /* window size change */ +#define SIGURG 21 /* urgent socket condition */ +#define SIGPOLL 22 /* pollable event occured */ +#define SIGIO SIGPOLL /* socket I/O possible (SIGPOLL alias) */ +#define SIGSTOP 23 /* stop (cannot be caught or ignored) */ +#define SIGTSTP 24 /* user stop requested from tty */ +#define SIGCONT 25 /* stopped process has been continued */ +#define SIGTTIN 26 /* background tty read attempted */ +#define SIGTTOU 27 /* background tty write attempted */ +#define SIGVTALRM 28 /* virtual timer expired */ +#define SIGPROF 29 /* profiling timer expired */ +#define SIGXCPU 30 /* exceeded cpu limit */ +#define SIGXFSZ 31 /* exceeded file size limit */ +#define SIGWAITING 32 /* process's lwps are blocked */ +#define SIGLWP 33 /* special signal used by thread library */ + +#if defined(__cplusplus) + +typedef void SIG_FUNC_TYP(int); +typedef SIG_FUNC_TYP *SIG_TYP; +#define SIG_PF SIG_TYP + +#define SIG_DFL (SIG_PF)0 +#define SIG_ERR (SIG_PF)-1 +#define SIG_IGN (SIG_PF)1 +#define SIG_HOLD (SIG_PF)2 + +#elif defined(lint) + +#define SIG_DFL (void(*)(int))0 +#define SIG_ERR (void(*)(int))0 +#define SIG_IGN (void (*)(int))0 +#define SIG_HOLD (void(*)(int))0 + +#else + +#define SIG_DFL (void(*)())0 +#define SIG_ERR (void(*)())-1 +#define SIG_IGN (void (*)())1 +#define SIG_HOLD (void(*)())2 + +#endif + +#define SIG_BLOCK 1 +#define SIG_UNBLOCK 2 +#define SIG_SETMASK 3 + +#define SIGNO_MASK 0xFF +#define SIGDEFER 0x100 +#define SIGHOLD 0x200 +#define SIGRELSE 0x400 +#define SIGIGNORE 0x800 +#define SIGPAUSE 0x1000 + +#if !defined(_STRICT_STDC) || defined(_POSIX_SOURCE) + +#ifndef _SIGSET_T +#define _SIGSET_T +typedef struct { /* signal set type */ + unsigned int __sigbits[4]; +} sigset_t; +#endif /* _SIGSET_T */ + +typedef struct { + unsigned int __sigbits[2]; +} k_sigset_t; + +struct sigaction { + int sa_flags; +#if defined(__cplusplus) + void (*sa_handler)(int); +#else + void (*sa_handler)(); +#endif + sigset_t sa_mask; + int sa_resv[2]; +}; + +/* this is only valid for SIGCLD */ +#define SA_NOCLDSTOP 0x00020000 /* don't send job control SIGCLD's */ +#endif + +#if !defined(_STRICT_STDC) && !defined(_POSIX_SOURCE) + /* non-comformant ANSI compilation */ + +/* definitions for the sa_flags field */ +#define SA_ONSTACK 0x00000001 +#define SA_RESETHAND 0x00000002 +#define SA_RESTART 0x00000004 +#define SA_SIGINFO 0x00000008 +#define SA_NODEFER 0x00000010 + +/* this is only valid for SIGCLD */ +#define SA_NOCLDWAIT 0x00010000 /* don't save zombie children */ + +#define NSIG 34 /* valid signals range from 1 to NSIG-1 */ +#define MAXSIG 33 /* size of u_signal[], NSIG-1 <= MAXSIG */ + +#define MINSIGSTKSZ 2048 +#define SIGSTKSZ 8192 + +#define SS_ONSTACK 0x00000001 +#define SS_DISABLE 0x00000002 + +struct sigaltstack { + char *ss_sp; + int ss_size; + int ss_flags; +}; + +typedef struct sigaltstack stack_t; + +#endif /* __STDC__ && !POSIX */ + + +#endif /* _SYS_SIGNAL_H */ + +/* ---- end of SysV <sys/signal.h> ---- */ + +typedef int sig_atomic_t; + +#if defined(__STDC__) + +extern const char *_sys_siglist[]; +extern const int _sys_nsig; + +#ifdef __cplusplus +extern "C" SIG_PF signal(int, SIG_PF); +#else +extern void (*signal(int, void (*)(int)))(int); +#endif +extern int raise(int); + +#if !defined(_STRICT_STDC) || defined(_POSIX_SOURCE) || \ + defined(_XOPEN_SOURCE) +extern int kill(pid_t, int); +extern int sigaction(int, const struct sigaction *, struct sigaction *); +extern int sigaddset(sigset_t *, int); +extern int sigdelset(sigset_t *, int); +extern int sigemptyset(sigset_t *); +extern int sigfillset(sigset_t *); +extern int sigismember(const sigset_t *, int); +extern int sigpending(sigset_t *); +extern int sigprocmask(int, const sigset_t *, sigset_t *); +extern int sigsuspend(const sigset_t *); +#endif + +#if !defined(_STRICT_STDC) && !defined(_POSIX_SOURCE) +extern int gsignal(int); +extern void (*sigset(int, void (*)(int)))(int); +extern int sighold(int); +extern int sigrelse(int); +extern int sigignore(int); +extern int sigpause(int); +extern int (*ssignal(int, int (*)(int)))(int); +extern int sigaltstack(const stack_t *, stack_t *); +/* extern int sigsend(idtype_t, id_t, int); */ +/* extern int sigsendset(const procset_t *, int); */ +#endif + +#else + +extern char *_sys_siglist[]; +extern int _sys_nsig; + +extern void(*signal())(); +extern void(*sigset())(); + +#endif /* __STDC__ */ + +#endif /* _SIGNAL_H */ +/* ---- end of SysV <signal.h> ---- */ + +#define sigmask(m) (m > 32 ? 0 : (1 << ((m)-1))) + +/* + * 4.3BSD structure used in sigstack call. + */ + +struct sigstack { + char *ss_sp; /* signal stack pointer */ + int ss_onstack; /* current status */ +}; + +#define SV_ONSTACK 0x0001 /* take signal on signal stack */ +#define SV_INTERRUPT 0x0002 /* do not restart system on signal return */ +#define SV_RESETHAND 0x0004 /* reset handler to SIG_DFL when signal taken */ + +#define sv_onstack sv_flags + +struct sigcontext { + int sc_onstack; /* sigstack state to restore */ + int sc_mask; /* signal mask to restore */ +#ifdef u3b2 + int sc_sp; /* sp to restore */ + int sc_fp; /* fp to restore */ + int sc_ap; /* ap to restore */ + int sc_pc; /* pc to restore */ + int sc_ps; /* psw to restore */ +#endif +#ifdef vax + int sc_sp; /* sp to restore */ + int sc_fp; /* fp to restore */ + int sc_ap; /* ap to restore */ + int sc_pc; /* pc to restore */ + int sc_ps; /* psl to restore */ +#endif /* vax */ +#ifdef mc68000 + int sc_sp; /* sp to restore */ + int sc_pc; /* pc to retore */ + int sc_ps; /* psl to restore */ +#endif /* mc68000 */ +#ifdef __sparc +#define MAXWINDOW 31 /* max usable windows in sparc */ + long sc_sp; /* sp to restore */ + long sc_pc; /* pc to retore */ + long sc_npc; /* next pc to restore */ + long sc_psr; /* psr to restore */ + /* aliased to REG_CCR for sparcv9 */ + long sc_g1; /* register that must be restored */ + long sc_o0; + int sc_wbcnt; /* number of outstanding windows */ + char *sc_spbuf[MAXWINDOW]; /* sp's for each wbuf */ + long sc_wbuf[MAXWINDOW][16]; /* outstanding window save buffer */ +#endif /* __sparc */ +#if defined(__amd64) + long sc_sp; /* sp to restore */ + long sc_pc; /* pc to retore */ + long sc_ps; /* psl to restore */ + long sc_rax; /* rax to restore */ + long sc_rdx; /* rdx to restore */ +#define sc_r0 sc_rax +#define sc_r1 sc_rdx +#elif defined(__i386) + int sc_sp; /* sp to restore */ + int sc_pc; /* pc to retore */ + int sc_ps; /* psl to restore */ + int sc_eax; /* eax to restore */ + int sc_edx; /* edx to restore */ +#define sc_r0 sc_eax +#define sc_r1 sc_edx +#endif +}; + +/* + * 4.3BSD signal vector structure used in sigvec call. + */ +struct sigvec { +#if defined(__cplusplus) + void (*sv_handler)(int, int, struct sigcontext *, char *); +#else + void (*sv_handler)(); /* signal handler */ +#endif + int sv_mask; /* signal mask to apply */ + int sv_flags; /* see signal options below */ +}; + +#if defined(__STDC__) +extern int sigvec(int, struct sigvec *, struct sigvec *); +extern int sigblock(int); +extern int sigsetmask(int); +#endif + +/* + * Signal codes taken verbatim from SunOS4.1 + */ +#ifdef vax +#define ILL_RESAD_FAULT 0x0 /* reserved addressing fault */ +#define ILL_PRIVIN_FAULT 0x1 /* privileged instruction fault */ +#define ILL_RESOP_FAULT 0x2 /* reserved operand fault */ +#endif /* vax */ +#ifdef mc68000 +#define ILL_ILLINSTR_FAULT 0x10 /* illegal instruction fault */ +#define ILL_PRIVVIO_FAULT 0x20 /* privilege violation fault */ +#define ILL_COPROCERR_FAULT 0x34 /* [coprocessor protocol error fault] */ +#define ILL_TRAP1_FAULT 0x84 /* trap #1 fault */ +#define ILL_TRAP2_FAULT 0x88 /* trap #2 fault */ +#define ILL_TRAP3_FAULT 0x8c /* trap #3 fault */ +#define ILL_TRAP4_FAULT 0x90 /* trap #4 fault */ +#define ILL_TRAP5_FAULT 0x94 /* trap #5 fault */ +#define ILL_TRAP6_FAULT 0x98 /* trap #6 fault */ +#define ILL_TRAP7_FAULT 0x9c /* trap #7 fault */ +#define ILL_TRAP8_FAULT 0xa0 /* trap #8 fault */ +#define ILL_TRAP9_FAULT 0xa4 /* trap #9 fault */ +#define ILL_TRAP10_FAULT 0xa8 /* trap #10 fault */ +#define ILL_TRAP11_FAULT 0xac /* trap #11 fault */ +#define ILL_TRAP12_FAULT 0xb0 /* trap #12 fault */ +#define ILL_TRAP13_FAULT 0xb4 /* trap #13 fault */ +#define ILL_TRAP14_FAULT 0xb8 /* trap #14 fault */ +#endif /* mc68000 */ +#ifdef sparc +#define ILL_STACK 0x00 /* bad stack */ +#define ILL_ILLINSTR_FAULT 0x02 /* illegal instruction fault */ +#define ILL_PRIVINSTR_FAULT 0x03 /* privileged instruction fault */ +/* codes from 0x80 to 0xff are software traps */ +#define ILL_TRAP_FAULT(n) ((n)+0x80) /* trap n fault */ +#endif /* sparc */ +#if defined(__i386) || defined(__amd64) +#define ILL_ILLINSTR_FAULT 0x02 /* illegal instruction fault */ +#endif + +#ifdef mc68000 +#define EMT_EMU1010 0x28 /* line 1010 emulator trap */ +#define EMT_EMU1111 0x2c /* line 1111 emulator trap */ +#endif /* mc68000 */ +#ifdef sparc +#define EMT_TAG 0x0a /* tag overflow */ +#endif /* sparc */ + +#ifdef vax +#define FPE_INTOVF_TRAP 0x1 /* integer overflow */ +#define FPE_INTDIV_TRAP 0x2 /* integer divide by zero */ +#define FPE_FLTOVF_TRAP 0x3 /* floating overflow */ +#define FPE_FLTDIV_TRAP 0x4 /* floating/decimal divide by zero */ +#define FPE_FLTUND_TRAP 0x5 /* floating underflow */ +#define FPE_DECOVF_TRAP 0x6 /* decimal overflow */ +#define FPE_SUBRNG_TRAP 0x7 /* subscript out of range */ +#define FPE_FLTOVF_FAULT 0x8 /* floating overflow fault */ +#define FPE_FLTDIV_FAULT 0x9 /* divide by zero floating fault */ +#define FPE_FLTUND_FAULT 0xa /* floating underflow fault */ +#endif /* vax */ +#ifdef mc68000 +#define FPE_INTDIV_TRAP 0x14 /* integer divide by zero */ +#define FPE_CHKINST_TRAP 0x18 /* CHK [CHK2] instruction */ +#define FPE_TRAPV_TRAP 0x1c /* TRAPV [cpTRAPcc TRAPcc] instr */ +#define FPE_FLTBSUN_TRAP 0xc0 /* [branch or set on unordered cond] */ +#define FPE_FLTINEX_TRAP 0xc4 /* [floating inexact result] */ +#define FPE_FLTDIV_TRAP 0xc8 /* [floating divide by zero] */ +#define FPE_FLTUND_TRAP 0xcc /* [floating underflow] */ +#define FPE_FLTOPERR_TRAP 0xd0 /* [floating operand error] */ +#define FPE_FLTOVF_TRAP 0xd4 /* [floating overflow] */ +#define FPE_FLTNAN_TRAP 0xd8 /* [floating Not-A-Number] */ +#ifdef sun +#define FPE_FPA_ENABLE 0x400 /* [FPA not enabled] */ +#define FPE_FPA_ERROR 0x404 /* [FPA arithmetic exception] */ +#endif /* sun */ +#endif /* mc68000 */ +#ifdef sparc +#define FPE_INTOVF_TRAP 0x1 /* integer overflow */ +#define FPE_STARTSIG_TRAP 0x2 /* process using fp */ +#define FPE_INTDIV_TRAP 0x14 /* integer divide by zero */ +#define FPE_FLTINEX_TRAP 0xc4 /* [floating inexact result] */ +#define FPE_FLTDIV_TRAP 0xc8 /* [floating divide by zero] */ +#define FPE_FLTUND_TRAP 0xcc /* [floating underflow] */ +#define FPE_FLTOPERR_TRAP 0xd0 /* [floating operand error] */ +#define FPE_FLTOVF_TRAP 0xd4 /* [floating overflow] */ +#endif /* sparc */ + +/* + * The codes for SIGBUS and SIGSEGV are described in <vm/faultcode.h> + * These are the same between SunOS4.1 and SunOS5.0 + */ + +#include <vm/faultcode.h> + +#define BUS_HWERR FC_HWERR /* misc hardware error (e.g. timeout) */ +#define BUS_ALIGN FC_ALIGN /* hardware alignment error */ +#ifdef BUS_OBJERR /* namespace conflict with SysV */ +#undef BUS_OBJERR +#endif +#define BUS_OBJERR FC_OBJERR /* object returned errno value */ +/* + * The BUS_CODE(code) will be one of the above. In the BUS_OBJERR case, + * doing a BUS_ERRNO(code) gives an errno value reported by the underlying + * file object mapped at the fault address. Note that this appears to be + * duplicated with the segmentation fault case below -- unfortunate, since + * the specification has always claimed that such errors produce SIGBUS. + * The segmentation cases are left defined as a transition aid. + */ +#define BUS_CODE(C) FC_CODE(C) +#define BUS_ERRNO(C) FC_ERRNO(C) + +#define SEGV_NOMAP FC_NOMAP /* no mapping at the fault address */ +#define SEGV_PROT FC_PROT /* access exceeded protections */ +#define SEGV_OBJERR FC_OBJERR /* object returned errno value */ +/* + * The SEGV_CODE(code) will be SEGV_NOMAP, SEGV_PROT, or SEGV_OBJERR. + * In the SEGV_OBJERR case, doing a SEGV_ERRNO(code) gives an errno value + * reported by the underlying file object mapped at the fault address. + */ +#define SEGV_CODE(C) FC_CODE(C) +#define SEGV_ERRNO(C) FC_ERRNO(C) +#define SEGV_MAKE_ERR(e) FC_MAKE_ERR(e) + +#define SIG_NOADDR ((char *)~0) + +#if defined(lint) +#define BADSIG (void(*)())0 +#else +#define BADSIG (void(*)())-1 +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* _UCB_SYS_SIGNAL_H */ diff --git a/usr/src/ucbhead/sys/sysmacros.h b/usr/src/ucbhead/sys/sysmacros.h new file mode 100644 index 0000000000..72e53d17ed --- /dev/null +++ b/usr/src/ucbhead/sys/sysmacros.h @@ -0,0 +1,58 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +/* + * Major/minor device constructing/busting macros. + */ + +#ifndef _SYS_SYSMACROS_H +#define _SYS_SYSMACROS_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +/* major part of a device */ +#define major(x) ((int)(((unsigned)(x)>>8)&0377)) + +/* minor part of a device */ +#define minor(x) ((int)((x)&0377)) + +/* make a device number */ +#define makedev(x, y) ((dev_t)(((x)<<8) | (y))) + +#endif /* !_SYS_SYSMACROS_H */ diff --git a/usr/src/ucbhead/sys/tty.h b/usr/src/ucbhead/sys/tty.h new file mode 100644 index 0000000000..7b3a226294 --- /dev/null +++ b/usr/src/ucbhead/sys/tty.h @@ -0,0 +1,225 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1998 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#ifndef _SYS_TTY_H +#define _SYS_TTY_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#include <sys/ttychars.h> +#include <sys/ttydev.h> + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * A clist structure is the head of a linked list queue of characters. + * The routines getc* and putc* manipulate these structures. + */ + +struct clist { + int c_cc; /* character count */ + struct cblock *c_cf; /* pointer to first */ + struct cblock *c_cl; /* pointer to last */ +}; + +/* Macro to find clist structure given pointer into it */ +#define CMATCH(pointer) (char *)(cfree + (pointer - cfree)) + +/* Character control block for interrupt level control */ + +struct ccblock { + caddr_t c_ptr; /* buffer address */ + ushort_t c_count; /* character count */ + ushort_t c_size; /* buffer size */ +}; + +/* + * A tty structure is needed for each UNIX character device that + * is used for normal terminal IO. + */ +#define NCC 8 +struct tty { + struct clist t_rawq; /* raw input queue */ + struct clist t_canq; /* canonical queue */ + struct clist t_outq; /* output queue */ + struct ccblock t_tbuf; /* tx control block */ + struct ccblock t_rbuf; /* rx control block */ + int (* t_proc)(); /* routine for device functions */ + ushort_t t_iflag; /* input modes */ + ushort_t t_oflag; /* output modes */ + ushort_t t_cflag; /* control modes */ + ushort_t t_lflag; /* line discipline modes */ + short t_state; /* internal state */ + o_pid_t t_pgrp; /* process group name */ + char t_line; /* line discipline */ + char t_delct; /* delimiter count */ + char t_term; /* terminal type */ + char t_tmflag; /* terminal flags */ + char t_col; /* current column */ + char t_row; /* current row */ + char t_vrow; /* variable row */ + char t_lrow; /* last physical row */ + char t_hqcnt; /* no. high queue packets on t_outq */ + char t_dstat; + /* used by terminal handlers and line disciplines */ + unsigned char t_cc[NCC]; /* settable control chars */ +}; + +/* + * The structure of a clist block + */ +#define CLSIZE 64 +struct cblock { + struct cblock *c_next; + char c_first; + char c_last; + char c_data[CLSIZE]; +}; + +extern struct cblock *cfree; +extern struct cblock *getcb(); +extern struct cblock *getcf(); +extern struct clist ttnulq; +extern int cfreecnt; + +struct chead { + struct cblock *c_next; + int c_size; + int c_flag; +}; +extern struct chead cfreelist; + +struct inter { + int cnt; +}; + +#define QESC 0200 /* queue escape */ +#define HQEND 01 /* high queue end */ + +#define TTIPRI 28 +#define TTOPRI 29 + +#ifdef u3b15 +/* + * following defs allow for job control in both vpm and + * stand-alone tty environments + */ +#define VPMTTY 1 +#define SATTY 2 +#endif + +/* limits */ +extern int ttlowat[], tthiwat[]; +#define TTYHOG 256 +#define TTXOLO 132 +#define TTXOHI 180 + +/* Hardware bits */ +#define DONE 0200 +#define IENABLE 0100 +#define OVERRUN 040000 +#define FRERROR 020000 +#define PERROR 010000 + +/* Internal state */ +#define TIMEOUT 01 /* Delay timeout in progress */ +#define WOPEN 02 /* Waiting for open to complete */ +#define ISOPEN 04 /* Device is open */ +#define TBLOCK 010 +#define CARR_ON 020 /* Software copy of carrier-present */ +#define BUSY 040 /* Output in progress */ +#define OASLP 0100 /* Wakeup when output done */ +#define IASLP 0200 /* Wakeup when input done */ +#define TTSTOP 0400 /* Output stopped by ctl-s */ +#define EXTPROC 01000 /* External processing */ +#define TACT 02000 +#define CLESC 04000 /* Last char escape */ +#define RTO 010000 /* Raw Timeout */ +#define TTIOW 020000 +#define TTXON 040000 +#define TTXOFF 0100000 + +/* l_output status */ +#define CPRES 0100000 + +/* device commands */ +#define T_OUTPUT 0 +#define T_TIME 1 +#define T_SUSPEND 2 +#define T_RESUME 3 +#define T_BLOCK 4 +#define T_UNBLOCK 5 +#define T_RFLUSH 6 +#define T_WFLUSH 7 +#define T_BREAK 8 +#define T_INPUT 9 +#define T_DISCONNECT 10 +#define T_PARM 11 +#define T_SWTCH 12 + +/* + * Terminal flags (set in t_tmflgs). + */ + +#define SNL 1 /* non-standard new-line needed */ +#define ANL 2 /* automatic new-line */ +#define LCF 4 /* Special treatment of last col, row */ +#define TERM_CTLECHO 010 /* Echo terminal control characters */ +#define TERM_INVIS 020 /* do not send escape sequences to user */ +#define QLOCKB 040 /* high queue locked for base level */ +#define QLOCKI 0100 /* high queue locked for interrupts */ +#define TERM_BIT 0200 /* Bit reserved for terminal drivers. */ + /* Usually used to indicate that an esc */ + /* character has arrived and that the */ + /* next character is special. */ + /* This bit is the same as the TM_SET */ + /* bit which may never be set by a user */ +/* + * device reports + */ +#define L_BUF 0 +#define L_BREAK 3 + +#ifdef __cplusplus +} +#endif + +#endif /* _SYS_TTY_H */ diff --git a/usr/src/ucbhead/sys/ttychars.h b/usr/src/ucbhead/sys/ttychars.h new file mode 100644 index 0000000000..dfd80c1dca --- /dev/null +++ b/usr/src/ucbhead/sys/ttychars.h @@ -0,0 +1,76 @@ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + */ + +/* + * User visible structures and constants + * related to terminal handling. + */ + +#ifndef _SYS_TTYCHARS_H +#define _SYS_TTYCHARS_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#ifdef __cplusplus +extern "C" { +#endif + +struct ttychars { + char tc_erase; /* erase last character */ + char tc_kill; /* erase entire line */ + char tc_intrc; /* interrupt */ + char tc_quitc; /* quit */ + char tc_startc; /* start output */ + char tc_stopc; /* stop output */ + char tc_eofc; /* end-of-file */ + char tc_brkc; /* input delimiter (like nl) */ + char tc_suspc; /* stop process signal */ + char tc_dsuspc; /* delayed stop process signal */ + char tc_rprntc; /* reprint line */ + char tc_flushc; /* flush output (toggles) */ + char tc_werasc; /* word erase */ + char tc_lnextc; /* literal next character */ +}; + +#ifndef _SYS_TERMIOS_H + +#ifndef CTRL +#define CTRL(c) ((c) & 037) +#endif + +/* default special characters */ +#define CERASE 0177 +#define CKILL CTRL('u') +#define CINTR CTRL('c') +#define CQUIT 034 /* FS, ^\ */ +#define CSTART CTRL('q') +#define CSTOP CTRL('s') +#define CEOF CTRL('d') +#define CEOT CEOF +#define CBRK 0377 +#define CSUSP CTRL('z') +#define CDSUSP CTRL('y') +#define CRPRNT CTRL('r') +#define CFLUSH CTRL('o') +#define CWERASE CTRL('w') +#define CLNEXT CTRL('v') + +#endif /* _SYS_TERMIOS_H */ + +#ifdef __cplusplus +} +#endif + +#endif /* _SYS_TTYCHARS_H */ diff --git a/usr/src/ucbhead/sys/types.h b/usr/src/ucbhead/sys/types.h new file mode 100644 index 0000000000..43f3eceb18 --- /dev/null +++ b/usr/src/ucbhead/sys/types.h @@ -0,0 +1,515 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* + * Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T + * All Rights Reserved + */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#ifndef _SYS_TYPES_H +#define _SYS_TYPES_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +/* + * Include fixed width type declarations proposed by the ISO/JTC1/SC22/WG14 C + * committee's working draft for the revision of the current ISO C standard, + * ISO/IEC 9899:1990 Programming language - C. These are not currently + * required by any standard but constitute a useful, general purpose set + * of type definitions which is namespace clean with respect to all standards. + */ + +#include <sys/int_types.h> +#include <sys/feature_tests.h> + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _ASM + +/* From SunOS types.h */ +#if defined(mc68000) +typedef struct _physadr { short r[1]; } *physadr; +typedef struct _label { int val[13]; } label_t; +#elif defined(__i386) +typedef struct _physadr { short r[1]; } *physadr; +typedef struct _label { int val[8]; } label_t; +#elif defined(__sparc) +typedef struct _physadr { int r[1]; } *physadr; +typedef struct _label { int val[2]; } label_t; +#else +typedef struct _physadr { int r[1]; } *physadr; +typedef struct _label { int val[10]; } label_t; +#endif + +/* POSIX Extensions */ + +typedef unsigned char uchar_t; +typedef unsigned short ushort_t; +typedef unsigned int uint_t; +typedef unsigned long ulong_t; + + +/* For BSD compatibility */ +typedef char *addr_t; /* ?<core address> type */ + +typedef char *caddr_t; /* ?<core address> type */ +typedef long daddr_t; /* <disk address> type */ +typedef short cnt_t; /* ?<count> type */ +typedef ulong_t pgcnt_t; /* number of pages */ + +#ifdef _ILP32 +typedef ulong_t paddr_t; /* <physical address> type */ +typedef long swblk_t; +#endif + +typedef uchar_t use_t; /* use count for swap. */ +typedef short sysid_t; +typedef short index_t; +typedef short lock_t; /* lock work for busy wait */ +typedef enum boolean { B_FALSE, B_TRUE } boolean_t; +typedef ulong_t l_dev_t; + +/* + * The following protects users who use other than Sun compilers + * (eg, GNU C) that don't support long long, and need to include + * this header file. + */ +#ifdef _LONGLONG_TYPE +typedef long long longlong_t; +typedef unsigned long long u_longlong_t; +#else +#ifdef GCC +typedef int64_t longlong_t; +typedef uint64_t u_longlong_t; +#else +/* used to reserve space and generate alignment */ +typedef union { + int32_t l[2]; + double d; +} longlong_t; +typedef union { + uint32_t l[2]; + double d; +} u_longlong_t; +#endif /* GCC */ +#endif /* _LONGLONG_TYPE */ + +/* + * The {u,}pad64_t types can be used in structures such that those structures + * may be accessed by code produced by compilation environments which don't + * support a 64 bit integral datatype. The intention is not to allow + * use of these fields in such environments, but to maintain the alignment + * and offsets of the structure. + * + * Similar comments for {u,}pad128_t. + * + * Note that these types do NOT generate any stronger alignment constraints + * than those available in the underlying ABI. See <sys/isa_list.h> + */ +#ifdef _LONGLONG_TYPE +typedef int64_t pad64_t; +typedef uint64_t upad64_t; +#else +typedef union { + double _d; + int32_t _l[2]; +} pad64_t; + +typedef union { + double _d; + uint32_t _l[2]; +} upad64_t; +#endif /* _LONGLONG_TYPE */ + +typedef union { + long double _q; + int32_t _l[4]; +} pad128_t; + +typedef union { + long double _q; + uint32_t _l[4]; +} upad128_t; + +/* + * attributes for threads, dynamically allocated by library + */ +typedef struct { + void *__pthread_attrp; +} pthread_attr_t; + +/* types related to file sizes, counts, offsets, etc. */ +#if defined(_LP64) || _FILE_OFFSET_BITS == 32 +typedef long off_t; /* ?<offset> type */ +typedef long blkcnt_t; /* counts file blocks */ +typedef ulong_t fsblkcnt_t; /* counts file system blocks */ +typedef ulong_t fsfilcnt_t; /* counts files */ +typedef ulong_t ino_t; /* expanded inode type */ +#elif _FILE_OFFSET_BITS == 64 +typedef longlong_t off_t; /* offsets within files */ +typedef longlong_t blkcnt_t; /* count of file blocks */ +typedef u_longlong_t fsblkcnt_t; /* count of file system blocks */ +typedef u_longlong_t fsfilcnt_t; /* count of files */ +typedef u_longlong_t ino_t; /* expanded inode type */ +#endif + +#ifdef _LP64 +typedef int blksize_t; /* used for block sizes */ +#else +typedef long blksize_t; /* used for block sizes */ +#endif + +#ifdef _LARGEFILE64_SOURCE +#ifdef _LP64 +typedef off_t off64_t; +typedef blkcnt_t blkcnt64_t; +typedef fsblkcnt_t fsblkcnt64_t; +typedef fsfilcnt_t fsfilcnt64_t; +typedef ino_t ino64_t; +#else +typedef longlong_t off64_t; /* ?<offset> type */ +typedef longlong_t blkcnt64_t; /* counts file blocks */ +typedef u_longlong_t fsblkcnt64_t; /* counts file system blocks */ +typedef u_longlong_t fsfilcnt64_t; /* counts files */ +typedef u_longlong_t ino64_t; /* expanded inode type */ +#endif +#endif + +/* + * The following type is for various kinds of identifiers. The + * actual type must be the same for all since some system calls + * (such as sigsend) take arguments that may be any of these + * types. The enumeration type idtype_t defined in sys/procset.h + * is used to indicate what type of id is being specified. + */ + +typedef longlong_t offset_t; +typedef u_longlong_t u_offset_t; +typedef longlong_t diskaddr_t; + +/* + * These types (t_{u}scalar_t) exist because the XTI/TPI/DLPI standards had + * to use them instead of int32_t and uint32_t because DEC had + * shipped 64-bit wide. + */ +#if defined(_LP64) || defined(_I32LPx) +typedef int32_t t_scalar_t; +typedef uint32_t t_uscalar_t; +#else +typedef long t_scalar_t; /* historical versions */ +typedef unsigned long t_uscalar_t; +#endif /* defined(_LP64) || defined(_I32LPx) */ + +/* + * Partial support for 64-bit file offset enclosed herein, + * specifically used to access devices greater than 2gb. + * However, support for devices greater than 2gb requires compiler + * support for long long. + */ +#ifdef _LONG_LONG_LTOH +typedef union lloff { + offset_t _f; /* Full 64 bit offset value */ + struct { + int32_t _l; /* lower 32 bits of offset value */ + int32_t _u; /* upper 32 bits of offset value */ + } _p; +} lloff_t; +#endif + +#ifdef _LONG_LONG_HTOL +typedef union lloff { + offset_t _f; /* Full 64 bit offset value */ + struct { + int32_t _u; /* upper 32 bits of offset value */ + int32_t _l; /* lower 32 bits of offset value */ + } _p; +} lloff_t; +#endif + +#ifdef _LONG_LONG_LTOH +typedef union lldaddr { + diskaddr_t _f; /* Full 64 bit disk address value */ + struct { + int32_t _l; /* lower 32 bits of disk address value */ + int32_t _u; /* upper 32 bits of disk address value */ + } _p; +} lldaddr_t; +#endif + +#ifdef _LONG_LONG_HTOL +typedef union lldaddr { + diskaddr_t _f; /* Full 64 bit disk address value */ + struct { + int32_t _u; /* upper 32 bits of disk address value */ + int32_t _l; /* lower 32 bits of disk address value */ + } _p; +} lldaddr_t; +#endif + +typedef ulong_t k_fltset_t; /* kernel fault set type */ + +#if defined(_LP64) || defined(_I32LPx) +typedef int id_t; /* A process id, */ + /* process group id, */ + /* session id, */ + /* scheduling class id, */ + /* user id or group id. */ +#else +typedef long id_t; +#endif + +typedef void *timeout_id_t; +typedef void *bufcall_id_t; + +/* Typedefs for dev_t components */ + +#if !defined(_LP64) && defined(__cplusplus) +typedef ulong_t major_t; /* major part of device number */ +typedef ulong_t minor_t; /* minor part of device number */ +#else +typedef uint_t major_t; +typedef uint_t minor_t; +#endif + +typedef short pri_t; + +/* + * For compatibility reasons the following typedefs (prefixed o_) + * can't grow regardless of the EFT definition. Although, + * applications should not explicitly use these typedefs + * they may be included via a system header definition. + * WARNING: These typedefs may be removed in a future + * release. + * ex. the definitions in s5inode.h (now obsoleted) + * remained small to preserve compatibility + * in the S5 file system type. + */ +typedef ushort_t o_mode_t; /* old file attribute type */ +typedef short o_dev_t; /* old device type */ +typedef ushort_t o_uid_t; /* old UID type */ +typedef o_uid_t o_gid_t; /* old GID type */ +typedef short o_nlink_t; /* old file link type */ +typedef short o_pid_t; /* old process id type */ +typedef ushort_t o_ino_t; /* old inode type */ + +/* POSIX and XOPEN Declarations */ + +typedef int key_t; /* IPC key type */ +#if !defined(_LP64) && defined(__cplusplus) +typedef ulong_t mode_t; /* file attribute type */ +#else +typedef uint_t mode_t; +#endif + +#ifndef _UID_T +#define _UID_T +#if !defined(_LP64) && defined(__cplusplus) +typedef long uid_t; /* UID type */ +#else +typedef int uid_t; +#endif +#endif + +typedef uid_t gid_t; /* GID type */ +typedef id_t taskid_t; /* task ID type */ +typedef id_t projid_t; /* project ID type */ +typedef id_t poolid_t; /* pool ID type */ +typedef id_t zoneid_t; /* zone ID type */ +typedef id_t ctid_t; /* contract ID type */ + +typedef ulong_t dev_t; /* expanded device type */ + +#if !defined(_LP64) && defined(__cplusplus) +typedef ulong_t nlink_t; /* file link type */ +typedef long pid_t; /* process id type */ +#else +typedef uint_t nlink_t; +typedef int pid_t; +#endif + +#ifndef _SIZE_T +#define _SIZE_T +#if !defined(_LP64) && defined(__cplusplus) +typedef uint_t size_t; +#else +typedef ulong_t size_t; +#endif +#endif + +#ifndef _SSIZE_T +#define _SSIZE_T +#if !defined(_LP64) && defined(__cplusplus) +typedef int ssize_t; +#else +typedef long ssize_t; /* used by functions which return a */ + /* count of bytes or an error indication */ +#endif +#endif + +#ifndef _TIME_T +#define _TIME_T +typedef long time_t; /* time of day in seconds */ +#endif /* _TIME_T */ + +#ifndef _CLOCK_T +#define _CLOCK_T +typedef long clock_t; /* relative time in a specified resolution */ +#endif /* ifndef _CLOCK_T */ + +#if (defined(_KERNEL) || !defined(_POSIX_SOURCE)) + +/* BEGIN CSTYLED */ +typedef unsigned char unchar; +typedef unsigned int uint; +typedef unsigned long ulong; +/* END CSTYLED */ + +#if defined(_KERNEL) + +#define SHRT_MIN -32768 /* min value of a "short int" */ +#define SHRT_MAX 32767 /* max value of a "short int" */ +#define USHRT_MAX 65535u /* max value of "unsigned short int" */ +#define INT_MIN (-2147483647-1) /* min value of an "int" */ +#define INT_MAX 2147483647 /* max value of an "int" */ +#define UINT_MAX 4294967295u /* max value of an "unsigned int" */ +#if !defined(_LP64) +#define LONG_MIN (-2147483647L-1L) /* min value of a "long int" */ +#define LONG_MAX 2147483647L /* max value of a "long int" */ +#define ULONG_MAX 4294967295UL /* max value of "unsigned long int" */ +#else +#define LONG_MIN (-9223372036854775807L-1L) +#define LONG_MAX 9223372036854775807L +#define ULONG_MAX 18446744073709551615UL +#endif + +#endif /* defined(_KERNEL) */ + + +#define P_MYPID ((pid_t)0) + +/* + * The following is the value of type id_t to use to indicate the + * caller's current id. See procset.h for the type idtype_t + * which defines which kind of id is being specified. + */ + +#define P_MYID (-1) +#define NOPID (pid_t)(-1) + +#ifndef NODEV +#define NODEV (dev_t)(-1) +#endif + +#ifdef _ILP32 +/* + * A host identifier is used to uniquely define a particular node + * on an rfs network. Its type is as follows. + */ + +typedef long hostid_t; + +/* + * The following value of type hostid_t is used to indicate the + * current host. The actual hostid for each host is in the + * kernel global variable rfs_hostid. + */ + +#define P_MYHOSTID (-1) +#endif + +#endif /* END (defined(_KERNEL) || !defined(_POSIX_SOURCE)) */ + +/* BEGIN CSTYLED */ +typedef unsigned char u_char; +typedef unsigned short u_short; +typedef unsigned int u_int; +typedef unsigned long u_long; +typedef unsigned short ushort; /* sys III compat */ +typedef struct _quad { int val[2]; } quad; /* used by UFS */ +/* END CSTYLED */ + +/* + * These were added to allow non-ANSI compilers to compile the system. + */ + +#ifdef __STDC__ + +/* _VOID, const, volatile left in for source compatibility */ + +/* BEGIN CSTYLED */ +#ifndef _VOID +#define _VOID void +#endif + +#else + +#ifndef _VOID +#define _VOID char +#endif + +#ifndef const +#define const +#endif + +#ifndef volatile +#define volatile +#endif +/* END CSTYLED */ + +#endif /* __STDC__ */ + +#endif /* _ASM */ + +/* + * Nested include for BSD/sockets source compatibility. + * (The select macros used to be defined here). + */ +#include <sys/select.h> +/* + * Nested include for BSD compatibility. + */ + +#define AHZ 64 + +#include <sys/sysmacros.h> + +#ifdef __cplusplus +} +#endif + +#endif /* _SYS_TYPES_H */ diff --git a/usr/src/ucbhead/sys/vfs.h b/usr/src/ucbhead/sys/vfs.h new file mode 100644 index 0000000000..70573eef56 --- /dev/null +++ b/usr/src/ucbhead/sys/vfs.h @@ -0,0 +1,271 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1998 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#ifndef _SYS_VFS_H +#define _SYS_VFS_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#include <sys/types.h> +#include <sys/cred.h> +#include <sys/vnode.h> +#include <sys/statvfs.h> + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Data associated with mounted file systems. + */ + +/* + * File system identifier. Should be unique (at least per machine). + */ +typedef struct { + int val[2]; /* file system id type */ +} fsid_t; + +/* + * File identifier. Should be unique per filesystem on a single + * machine. This is typically called by a stateless file server + * in order to generate "file handles". + */ +#define MAXFIDSZ 16 +#define freefid(fidp) \ + kmem_free((caddr_t)(fidp), sizeof (struct fid) - MAXFIDSZ + (fidp)->fid_len) + +typedef struct fid { + ushort_t fid_len; /* length of data in bytes */ + char fid_data[MAXFIDSZ]; /* data (variable length) */ +} fid_t; + +/* + * Structure per mounted file system. Each mounted file system has + * an array of operations and an instance record. The file systems + * are kept on a singly linked list headed by "rootvfs" and terminated + * by NULL. + */ +typedef struct vfs { + struct vfs *vfs_next; /* next VFS in VFS list */ + struct vfsops *vfs_op; /* operations on VFS */ + struct vnode *vfs_vnodecovered; /* vnode mounted on */ + ulong_t vfs_flag; /* flags */ + ulong_t vfs_bsize; /* native block size */ + int vfs_fstype; /* file system type index */ + fsid_t vfs_fsid; /* file system id */ + caddr_t vfs_data; /* private data */ + l_dev_t vfs_dev; /* device of mounted VFS */ + ulong_t vfs_bcount; /* I/O count (accounting) */ + ushort_t vfs_nsubmounts; /* immediate sub-mount count */ +} vfs_t; + +/* + * VFS flags. + */ +#define VFS_RDONLY 0x01 /* read-only vfs */ +#define VFS_MLOCK 0x02 /* lock vfs so that subtree is stable */ +#define VFS_MWAIT 0x04 /* someone is waiting for lock */ +#define VFS_NOSUID 0x08 /* setuid disallowed */ +#define VFS_REMOUNT 0x10 /* modify mount options only */ +#define VFS_NOTRUNC 0x20 /* does not truncate long file names */ + +/* + * Argument structure for mount(2). + */ +struct mounta { + char *spec; + char *dir; + int flags; + char *fstype; + char *dataptr; + int datalen; +}; + +/* + * Reasons for calling the vfs_mountroot() operation. + */ + +enum whymountroot { ROOT_INIT, ROOT_REMOUNT, ROOT_UNMOUNT }; +typedef enum whymountroot whymountroot_t; + +/* + * Operations supported on virtual file system. + */ +typedef struct vfsops { +#if defined(__STDC__) + int (*vfs_mount)(struct vfs *, struct vnode *, struct mounta *, + struct cred *); + int (*vfs_unmount)(struct vfs *, struct cred *); + int (*vfs_root)(struct vfs *, struct vnode **); + int (*vfs_statvfs)(struct vfs *, struct statvfs64 *); + int (*vfs_sync)(struct vfs *, short, struct cred *); + int (*vfs_vget)(struct vfs *, struct vnode **, struct fid *); + int (*vfs_mountroot)(struct vfs *, enum whymountroot); + int (*vfs_swapvp)(struct vfs *, struct vnode **, char *); + int (*vfs_filler[4])(void); +#else + int (*vfs_mount)(); /* mount file system */ + int (*vfs_unmount)(); /* unmount file system */ + int (*vfs_root)(); /* get root vnode */ + int (*vfs_statvfs)(); /* get file system statistics */ + int (*vfs_sync)(); /* flush fs buffers */ + int (*vfs_vget)(); /* get vnode from fid */ + int (*vfs_mountroot)(); /* mount the root filesystem */ + int (*vfs_swapvp)(); /* return vnode for swap */ + int (*vfs_filler[4])(); /* for future expansion */ +#endif +} vfsops_t; + +#define VFS_MOUNT(vfsp, mvp, uap, cr) \ + (*(vfsp)->vfs_op->vfs_mount)(vfsp, mvp, uap, cr) +#define VFS_UNMOUNT(vfsp, cr) (*(vfsp)->vfs_op->vfs_unmount)(vfsp, cr) +#define VFS_ROOT(vfsp, vpp) (*(vfsp)->vfs_op->vfs_root)(vfsp, vpp) +#define VFS_STATVFS(vfsp, sp) (*(vfsp)->vfs_op->vfs_statvfs)(vfsp, sp) +#define VFS_SYNC(vfsp) (*(vfsp)->vfs_op->vfs_sync)(vfsp) +#define VFS_VGET(vfsp, vpp, fidp) \ + (*(vfsp)->vfs_op->vfs_vget)(vfsp, vpp, fidp) +#define VFS_MOUNTROOT(vfsp, init) \ + (*(vfsp)->vfs_op->vfs_mountroot)(vfsp, init) +#define VFS_SWAPVP(vfsp, vpp, nm) \ + (*(vfsp)->vfs_op->vfs_swapvp)(vfsp, vpp, nm) + +/* + * Filesystem type switch table. + */ +typedef struct vfssw { + char *vsw_name; /* type name string */ +#if defined(__STDC__) + int (*vsw_init)(struct vfssw *, int); +#else + int (*vsw_init)(); /* init routine */ +#endif + struct vfsops *vsw_vfsops; /* filesystem operations vector */ + int vsw_flag; /* flags */ +} vfssw_t; + +/* + * Public operations. + */ +#if defined(__STDC__) +void vfs_mountroot(void); +void vfs_add(vnode_t *, struct vfs *, int); +void vfs_remove(struct vfs *); +int vfs_lock(struct vfs *); +void vfs_unlock(struct vfs *); +struct vfs *getvfs(fsid_t *); +struct vfs *vfs_devsearch(dev_t); +struct vfssw *vfs_getvfssw(char *); +u_int vf_to_stf(u_int); +#else +extern void vfs_mountroot(); /* mount the root */ +extern void vfs_add(); /* add a new vfs to mounted vfs list */ +extern void vfs_remove(); /* remove a vfs from mounted vfs list */ +extern int vfs_lock(); /* lock a vfs */ +extern void vfs_unlock(); /* unlock a vfs */ +extern vfs_t *getvfs(); /* return vfs given fsid */ +extern vfs_t *vfs_devsearch(); /* find vfs given device */ +extern vfssw_t *vfs_getvfssw(); /* find vfssw ptr given fstype name */ +extern ulong_t vf_to_stf(); /* map VFS flags to statfs flags */ +#endif + +#define VFS_INIT(vfsp, op, data) { \ + (vfsp)->vfs_next = (struct vfs *)0; \ + (vfsp)->vfs_op = (op); \ + (vfsp)->vfs_flag = 0; \ + (vfsp)->vfs_data = (data); \ + (vfsp)->vfs_nsubmounts = 0; \ +} + +/* + * Globals. + */ +extern struct vfs *rootvfs; /* ptr to root vfs structure */ +extern struct vfssw vfssw[]; /* table of filesystem types */ +extern char rootfstype[]; /* name of root fstype */ +extern int nfstype; /* # of elements in vfssw array */ + +/* + * file system statistics, from SunOS 4.1 + */ +#if _FILE_OFFSET_BITS == 32 +struct statfs { + int f_type; /* type of info, zero for now */ + int f_bsize; /* fundamental file system block size */ + int f_blocks; /* total blocks in file system */ + int f_bfree; /* free blocks in fs */ + int f_bavail; /* free blocks avail to non-superuser */ + int f_files; /* total file nodes in file system */ + int f_ffree; /* free files nodes in fs */ + fsid_t f_fsid; /* file system id */ + int f_spare[7]; /* spare for later */ +}; +#elif _FILE_OFFSET_BITS == 64 +struct statfs { + long f_type; /* type of info, zero for now */ + ulong_t f_bsize; /* fundamental file system block size */ + fsblkcnt_t f_blocks; /* total blocks in file system */ + fsblkcnt_t f_bfree; /* free blocks in fs */ + fsblkcnt_t f_bavail; /* free blocks avail to non-superuser */ + fsfilcnt_t f_files; /* total file nodes in file system */ + fsfilcnt_t f_ffree; /* free files nodes in fs */ + fsid_t f_fsid; /* file system id */ + int f_spare[7]; /* spare for later */ +}; +#endif +#if defined(_LARGEFILE64_SOURCE) +struct statfs64 { + long f_type; /* type of info, zero for now */ + + ulong_t f_bsize; /* fundamental file system block size */ + fsblkcnt_t f_blocks; /* total blocks in file system */ + fsblkcnt_t f_bfree; /* free blocks in fs */ + fsblkcnt_t f_bavail; /* free blocks avail to non-superuser */ + fsfilcnt_t f_files; /* total file nodes in file system */ + fsfilcnt_t f_ffree; /* free files nodes in fs */ + fsid_t f_fsid; /* file system id */ + int f_spare[7]; /* spare for later */ +}; +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* _SYS_VFS_H */ diff --git a/usr/src/ucbhead/sys/wait.h b/usr/src/ucbhead/sys/wait.h new file mode 100644 index 0000000000..6a5447aa3e --- /dev/null +++ b/usr/src/ucbhead/sys/wait.h @@ -0,0 +1,171 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* + * Portions of this source code were derived from Berkeley 4.3 BSD + * under license from the Regents of the University of California. + */ + +#ifndef _SYS_WAIT_H +#define _SYS_WAIT_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#include <sys/isa_defs.h> +#include <sys/resource.h> + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * This wait.h is a combination of SunOS's wait.h and SysV wait.h + * The structure 'union wait' is taken from SunOS, while the + * rest of the #define's are from SysV. + */ + +/* + * Structure of the information in the first word returned by both + * wait and wait3. If w_stopval==WSTOPPED, then the second structure + * describes the information returned, else the first. See WUNTRACED below. + */ +union wait { + int w_status; /* used in syscall */ + /* + * Terminated process status. + */ + struct { +#if defined(_BIT_FIELDS_LTOH) + unsigned short w_Termsig:7; /* termination signal */ + unsigned short w_Coredump:1; /* core dump indicator */ + unsigned short w_Retcode:8; /* exit code if w_termsig==0 */ +#else + unsigned short w_Fill1:16; /* high 16 bits unused */ + unsigned short w_Retcode:8; /* exit code if w_termsig==0 */ + unsigned short w_Coredump:1; /* core dump indicator */ + unsigned short w_Termsig:7; /* termination signal */ +#endif + } w_T; + /* + * Stopped process status. Returned + * only for traced children unless requested + * with the WUNTRACED option bit. + */ + struct { +#if defined(_BIT_FIELDS_LTOH) + unsigned short w_Stopval:8; /* == W_STOPPED if stopped */ + unsigned short w_Stopsig:8; /* signal that stopped us */ +#else + unsigned short w_Fill2:16; /* high 16 bits unused */ + unsigned short w_Stopsig:8; /* signal that stopped us */ + unsigned short w_Stopval:8; /* == W_STOPPED if stopped */ +#endif + } w_S; +}; +#define w_termsig w_T.w_Termsig +#define w_coredump w_T.w_Coredump +#define w_retcode w_T.w_Retcode +#define w_stopval w_S.w_Stopval +#define w_stopsig w_S.w_Stopsig + +/* ----- begin SysV wait.h ----- */ + +#include <sys/types.h> +#ifdef BUS_OBJERR /* Namespace conflict */ +#undef BUS_OBJERR +#endif +#include <sys/siginfo.h> +#include <sys/procset.h> + +/* + * arguments to wait functions + */ + +#define WEXITED 0001 /* wait for processes that have exite */ +#define WTRAPPED 0002 /* wait for processes stopped while tracing */ +#define N_WSTOPPED 0004 /* wait for processes stopped by signals */ +#define WCONTINUED 0010 /* wait for processes continued */ + +#define WUNTRACED N_WSTOPPED /* for POSIX */ + +#define WNOHANG 0100 /* non blocking form of wait */ +#define WNOWAIT 0200 /* non destructive form of wait */ + +#define WOPTMASK (WEXITED|WTRAPPED|WSTOPPED|WCONTINUED|WNOHANG|WNOWAIT) + +/* + * macros for stat return from wait functions + */ + +#define WSTOPFLG 0177 +#define WSTOPPED WSTOPFLG + /* This is for source compatibility w/ SunOS */ +#define WCONTFLG 0177777 +#define WCOREFLG 0200 +#define WSIGMASK 0177 + +#define WLOBYTE(stat) ((int)((stat)&0377)) +#define WHIBYTE(stat) ((int)(((stat)>>8)&0377)) +#define WWORD(stat) ((int)((stat))&0177777) + +#define WIFEXITED(stat) (WLOBYTE(stat) == 0) +#define WIFSIGNALED(stat) (WLOBYTE(stat) > 0 && WHIBYTE(stat) == 0) +#define WIFSTOPPED(stat) (WLOBYTE(stat) == WSTOPFLG&&WHIBYTE(stat) != 0) +#define WIFCONTINUED(stat) (WWORD(stat) == WCONTFLG) + +#define WEXITSTATUS(stat) WHIBYTE(stat) +#define WTERMSIG(stat) (WLOBYTE(stat)&WSIGMASK) +#define WSTOPSIG(stat) WHIBYTE(stat) +#define WCOREDUMP(stat) ((stat)&WCOREFLG) + + + +#if !defined(_KERNEL) +#if defined(__STDC__) + +extern pid_t wait(int *); +extern pid_t waitpid(pid_t, int *, int); +extern int waitid(idtype_t, id_t, siginfo_t *, int); +extern pid_t wait4(pid_t, int *, int, struct rusage *); +extern pid_t wait3(int *, int, struct rusage *); + +#else + +extern pid_t wait(); +extern pid_t waitpid(); +extern int waitid(); + +#endif /* __STDC__ */ +#endif /* _KERNEL */ + +#ifdef __cplusplus +} +#endif + +#endif /* _SYS_WAIT_H */ diff --git a/usr/src/ucbhead/syscall.h b/usr/src/ucbhead/syscall.h new file mode 100644 index 0000000000..d3702c8a20 --- /dev/null +++ b/usr/src/ucbhead/syscall.h @@ -0,0 +1,45 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* + * Portions of this source code were derived from Berkeley 4.3 BSD + * under license from the Regents of the University of California. + */ + +/* + * Note that the guard is carefully crafted here. + */ + +#ifndef _SYS_SYSCALL_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#include <sys/syscall.h> + +#endif /* _SYS_SYSCALL_H */ diff --git a/usr/src/ucbhead/ufs/quota.h b/usr/src/ucbhead/ufs/quota.h new file mode 100644 index 0000000000..defdb318eb --- /dev/null +++ b/usr/src/ucbhead/ufs/quota.h @@ -0,0 +1,52 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +/* + * Note that the guard is carefully crafted here. + * Don't change and keep the convention for now. + */ + +#ifndef _SYS_FS_UFS_QUOTA_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#include <sys/types.h> +#include <sys/fs/ufs_quota.h> + +#endif /* _SYS_FS_UFS_QUOTA_H */ diff --git a/usr/src/ucbhead/unistd.h b/usr/src/ucbhead/unistd.h new file mode 100644 index 0000000000..420e070285 --- /dev/null +++ b/usr/src/ucbhead/unistd.h @@ -0,0 +1,180 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#ifndef _UNISTD_H +#define _UNISTD_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#include <sys/fcntl.h> + +#ifdef __cplusplus +extern "C" { +#endif + +/* Symbolic constants for the "access" routine: */ +#define R_OK 4 /* Test for Read permission */ +#define W_OK 2 /* Test for Write permission */ +#define X_OK 1 /* Test for eXecute permission */ +#define F_OK 0 /* Test for existence of File */ + +#define F_ULOCK 0 /* Unlock a previously locked region */ +#define F_LOCK 1 /* Lock a region for exclusive use */ +#define F_TLOCK 2 /* Test and lock a region for exclusive use */ +#define F_TEST 3 /* Test a region for other processes locks */ + + +/* Symbolic constants for the "lseek" routine: */ +#define SEEK_SET 0 /* Set file pointer to "offset" */ +#define SEEK_CUR 1 /* Set file pointer to current plus "offset" */ +#define SEEK_END 2 /* Set file pointer to EOF plus "offset" */ + +/* Path names: */ +#define GF_PATH "/etc/group" /* Path name of the "group" file */ +#define PF_PATH "/etc/passwd" /* Path name of the "passwd" file */ + + +/* command names for POSIX sysconf */ +#define _SC_ARG_MAX 1 +#define _SC_CHILD_MAX 2 +#define _SC_CLK_TCK 3 +#define _SC_NGROUPS_MAX 4 +#define _SC_OPEN_MAX 5 +#define _SC_JOB_CONTROL 6 +#define _SC_SAVED_IDS 7 +#define _SC_VERSION 8 +#define _SC_PASS_MAX 9 +#define _SC_LOGNAME_MAX 10 +#define _SC_PAGESIZE 11 +#define _SC_XOPEN_VERSION 12 +/* 13 reserved for SVr4-ES/MP _SC_NACLS_MAX */ +/* 14 reserved for SVr4-ES/MP _SC_NPROC_CONF */ +/* 15 reserved for SVr4-ES/MP _SC_NPROC_ONLN */ +#define _SC_STREAM_MAX 16 +#define _SC_TZNAME_MAX 17 + +/* command names for POSIX pathconf */ + +#define _PC_LINK_MAX 1 +#define _PC_MAX_CANON 2 +#define _PC_MAX_INPUT 3 +#define _PC_NAME_MAX 4 +#define _PC_PATH_MAX 5 +#define _PC_PIPE_BUF 6 +#define _PC_NO_TRUNC 7 +#define _PC_VDISABLE 8 +#define _PC_CHOWN_RESTRICTED 9 +#define _PC_LAST 9 + +/* + * compile-time symbolic constants, + * Support does not mean the feature is enabled. + * Use pathconf/sysconf to obtain actual configuration value. + */ + +#define _POSIX_JOB_CONTROL 1 +#define _POSIX_SAVED_IDS 1 + +#ifndef _POSIX_VDISABLE +#define _POSIX_VDISABLE 0 +#endif + +#define STDIN_FILENO 0 +#define STDOUT_FILENO 1 +#define STDERR_FILENO 2 + +/* Current version of POSIX */ +#define _POSIX_VERSION 199009L + +/* large file compilation environment setup */ +#if !defined(_LP64) && _FILE_OFFSET_BITS == 64 +#ifdef __PRAGMA_REDEFINE_EXTNAME +#pragma redefine_extname lseek lseek64 +#else +#define lseek lseek64 +#endif +#endif /* !_LP64 && _FILE_OFFSET_BITS == 64 */ + +#if defined(_LP64) && defined(_LARGEFILE64_SOURCE) +#ifdef __PRAGMA_REDEFINE_EXTNAME +#pragma redefine_extname lseek64 lseek +#else +#define lseek64 lseek +#endif +#endif /* _LP64 && _LARGEFILE64_SOURCE */ + +#if defined(__STDC__) +extern pid_t getpid(void); +extern pid_t getppid(void); +extern pid_t getpgrp(void); +extern uid_t getuid(void); +extern int setpgid(pid_t, pid_t); +extern int setpgrp(pid_t, pid_t); /* BSD */ + +extern int stime(const time_t *); + +extern long pathconf(const char *, int); +extern long sysconf(int); + +extern char *getwd(char *); +extern long gethostid(void); + +extern ssize_t read(int, void *, size_t); +extern ssize_t write(int, const void *, size_t); +extern int ioctl(int, int, ...); +extern int close(int); +extern off_t lseek(int, off_t, int); +#else +extern off_t lseek(); +#endif + +#if defined(_LARGEFILE64_SOURCE) && !((_FILE_OFFSET_BITS == 64) && \ + !defined(__PRAGMA_REDEFINE_EXTNAME)) +#if defined(__STDC__) +extern off64_t lseek64(int, off64_t, int); +#else +extern off64_t lseek64(); +#endif +#endif /* _LARGEFILE64_SOURCE... */ + +#ifdef __cplusplus +} +#endif + +#endif /* _UNISTD_H */ diff --git a/usr/src/ucbhead/vfont.h b/usr/src/ucbhead/vfont.h new file mode 100644 index 0000000000..112af12eda --- /dev/null +++ b/usr/src/ucbhead/vfont.h @@ -0,0 +1,79 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +/* + * The structures header and dispatch define the format of a font file. + * + * A font file contains one struct 'header', an array of NUM_DISPATCH struct + * 'dispatch'es, then an array of bytes containing bit maps. + * + * See vfont(5) for more details. + */ + +#ifndef _vfont_h +#define _vfont_h + +#pragma ident "%Z%%M% %I% %E% SMI" + +#ifdef __cplusplus +extern "C" { +#endif + +struct header { + short magic; /* Magic number VFONT_MAGIC */ + unsigned short size; /* Total # bytes of bitmaps */ + short maxx; /* Maximum horizontal glyph size */ + short maxy; /* Maximum vertical glyph size */ + short xtend; /* (unused?) */ +}; +#define VFONT_MAGIC 0436 + +struct dispatch { + unsigned short addr; /* &(glyph) - &(start of bitmaps) */ + short nbytes; /* # bytes of glyphs (0 if no glyph) */ + char up, down, left, right; /* Widths from baseline point */ + short width; /* Logical width, used by troff */ +}; +#define NUM_DISPATCH 256 + +#ifdef __cplusplus +} +#endif + +#endif /* !_vfont_h */ diff --git a/usr/src/ucbhead/vfork.h b/usr/src/ucbhead/vfork.h new file mode 100644 index 0000000000..eb0dcde7b2 --- /dev/null +++ b/usr/src/ucbhead/vfork.h @@ -0,0 +1,56 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* + * this atrocity is necessary on sparc because registers modified + * by the child get propagated back to the parent via the window + * save/restore mechanism. + */ + +#ifndef _vfork_h +#define _vfork_h + +#pragma ident "%Z%%M% %I% %E% SMI" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef __STDC__ +extern int vfork(void); +#else +extern int vfork(); +#endif + +#if defined(__sparc) +#pragma unknown_control_flow(vfork) +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* !_vfork_h */ |