1 /* 2 * Copyright (c) 1993, 1994, 1995, 1996 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that: (1) source code distributions 7 * retain the above copyright notice and this paragraph in its entirety, (2) 8 * distributions including binary code include the above copyright notice and 9 * this paragraph in its entirety in the documentation or other materials 10 * provided with the distribution, and (3) all advertising materials mentioning 11 * features or use of this software display the following acknowledgement: 12 * ``This product includes software developed by the University of California, 13 * Lawrence Berkeley Laboratory and its contributors.'' Neither the name of 14 * the University nor the names of its contributors may be used to endorse 15 * or promote products derived from this software without specific prior 16 * written permission. 17 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED 18 * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF 19 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 20 * 21 * @(#) $Header: os-solaris2.h,v 1.16 96/07/05 22:11:23 leres Exp $ (LBL) 22 */ 23 24 /* Signal routines are this type */ 25 #define SIGRET void 26 /* Signal routines use "return SIGRETVAL;" */ 27 #define SIGRETVAL 28 /* The wait() status variable is this type */ 29 #define WAITSTATUS int 30 31 #define major(x) ((int)(((unsigned)(x)>>8)&0377)) 32 #define minor(x) ((int)((x)&0377)) 33 34 /* Prototypes missing in SunOS 5 */ 35 int daemon(int, int); 36 int dn_expand(u_char *, u_char *, u_char *, u_char *, int); 37 int dn_skipname(u_char *, u_char *); 38 int getdtablesize(void); 39 int gethostname(char *, int); 40 char *getusershell(void); 41 char *getwd(char *); 42 int iruserok(u_int, int, char *, char *); 43 #ifdef __STDC__ 44 struct utmp; 45 void login(struct utmp *); 46 #endif 47 int logout(const char *); 48 int res_query(char *, int, int, u_char *, int); 49 int setenv(const char *, const char *, int); 50 #if defined(_STDIO_H) && defined(HAVE_SETLINEBUF) 51 int setlinebuf(FILE *); 52 #endif 53 int sigblock(int); 54 int sigsetmask(int); 55 char *strerror(int); 56 int snprintf(char *, size_t, const char *, ...); 57 int strcasecmp(const char *, const char *); 58 void unsetenv(const char *); 59 #ifdef __STDC__ 60 struct timeval; 61 #endif 62 int utimes(const char *, struct timeval *); 63 64 /* Solaris signal compat */ 65 #ifndef sigmask 66 #define sigmask(m) (1 << ((m)-1)) 67 #endif 68 #ifndef signal 69 #define signal(s, f) sigset(s, f) 70 #endif 71 72 /* Solaris random compat */ 73 #ifndef srandom 74 #define srandom(seed) srand48((long)seed) 75 #endif 76 #ifndef random 77 #define random() lrand48() 78 #endif 79 80 #ifndef CBREAK 81 #define CBREAK O_CBREAK 82 #define CRMOD O_CRMOD 83 #define RAW O_RAW 84 #define TBDELAY O_TBDELAY 85 #endif 86 87 #ifndef TIOCPKT_DATA 88 #define TIOCPKT_DATA 0x00 /* data packet */ 89 #define TIOCPKT_FLUSHREAD 0x01 /* flush packet */ 90 #define TIOCPKT_FLUSHWRITE 0x02 /* flush packet */ 91 #define TIOCPKT_STOP 0x04 /* stop output */ 92 #define TIOCPKT_START 0x08 /* start output */ 93 #define TIOCPKT_NOSTOP 0x10 /* no more ^S, ^Q */ 94 #define TIOCPKT_DOSTOP 0x20 /* now do ^S ^Q */ 95 #define TIOCPKT_IOCTL 0x40 /* state change of pty driver */ 96 #endif 97 98 #ifndef STDERR_FILENO 99 #define STDERR_FILENO 2 100 #define STDOUT_FILENO 1 101 #define STDIN_FILENO 0 102 #endif 103 104 #ifndef FD_SET 105 #define FD_SET(n, p) ((p)->fds_bits[0] |= (1<<(n))) 106 #define FD_CLR(n, p) ((p)->fds_bits[0] &= ~(1<<(n))) 107 #define FD_ISSET(n, p) ((p)->fds_bits[0] & (1<<(n))) 108 #define FD_ZERO(p) ((p)->fds_bits[0] = 0) 109 #endif 110 111 #ifndef S_ISTXT 112 #define S_ISTXT S_ISVTX 113 #endif 114