| 1 |
/* ======================================================================== |
| 2 |
* Copyright 1988-2006 University of Washington |
| 3 |
* |
| 4 |
* Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 |
* you may not use this file except in compliance with the License. |
| 6 |
* You may obtain a copy of the License at |
| 7 |
* |
| 8 |
* http://www.apache.org/licenses/LICENSE-2.0 |
| 9 |
* |
| 10 |
* |
| 11 |
* ======================================================================== |
| 12 |
*/ |
| 13 |
|
| 14 |
/* |
| 15 |
* Program: Operating-system dependent routines -- SVR2 version |
| 16 |
* |
| 17 |
* Author: Mark Crispin |
| 18 |
* Networks and Distributed Computing |
| 19 |
* Computing & Communications |
| 20 |
* University of Washington |
| 21 |
* Administration Building, AG-44 |
| 22 |
* Seattle, WA 98195 |
| 23 |
* Internet: [email protected] |
| 24 |
* |
| 25 |
* Date: 10 April 1992 |
| 26 |
* Last Edited: 30 August 2006 |
| 27 |
*/ |
| 28 |
|
| 29 |
#include "tcp_unix.h" /* must be before osdep includes tcp.h */ |
| 30 |
#include "mail.h" |
| 31 |
#include "osdep.h" |
| 32 |
#include <ctype.h> |
| 33 |
#include <stdio.h> |
| 34 |
#include <sys/stat.h> |
| 35 |
#include <netinet/in.h> |
| 36 |
#include <arpa/inet.h> |
| 37 |
#include <netdb.h> |
| 38 |
#include <errno.h> |
| 39 |
extern int errno; |
| 40 |
#include <pwd.h> |
| 41 |
#include <sys/socket.h> |
| 42 |
#include <time.h> |
| 43 |
#define KERNEL |
| 44 |
#include <sys/time.h> |
| 45 |
#undef KERNEL |
| 46 |
#include "misc.h" |
| 47 |
|
| 48 |
#define DIR_SIZE(d) sizeof (DIR) |
| 49 |
|
| 50 |
extern int sys_nerr; |
| 51 |
extern char *sys_errlist[]; |
| 52 |
|
| 53 |
#define toint(c) ((c)-'0') |
| 54 |
#define isodigit(c) (((unsigned)(c)>=060)&((unsigned)(c)<=067)) |
| 55 |
|
| 56 |
#define NBBY 8 /* number of bits in a byte */ |
| 57 |
#define FD_SETSIZE 256 |
| 58 |
|
| 59 |
typedef long fd_mask; |
| 60 |
#define NFDBITS (sizeof(fd_mask) * NBBY) |
| 61 |
/* bits per mask */ |
| 62 |
#define howmany(x, y) (((x)+((y)-1))/(y)) |
| 63 |
|
| 64 |
typedef struct fd_set { |
| 65 |
fd_mask fds_bits[howmany(FD_SETSIZE, NFDBITS)]; |
| 66 |
} fd_set; |
| 67 |
|
| 68 |
#define FD_SET(n, p) ((p)->fds_bits[(n)/NFDBITS] |= \ |
| 69 |
(1 << ((n) % NFDBITS))) |
| 70 |
#define FD_CLR(n, p) ((p)->fds_bits[(n)/NFDBITS] &= \ |
| 71 |
~(1 << ((n) % NFDBITS))) |
| 72 |
#define FD_ISSET(n, p) ((p)->fds_bits[(n)/NFDBITS] & \ |
| 73 |
(1 << ((n) % NFDBITS))) |
| 74 |
#define FD_ZERO(p) bzero((char *)(p), sizeof(*(p))) |
| 75 |
|
| 76 |
|
| 77 |
#include "fs_unix.c" |
| 78 |
#include "ftl_unix.c" |
| 79 |
#include "nl_unix.c" |
| 80 |
#include "env_unix.c" |
| 81 |
#include "tcp_unix.c" |
| 82 |
#include "gr_wait.c" |
| 83 |
#include "flocksim.c" |
| 84 |
#include "opendir.c" |
| 85 |
#include "scandir.c" |
| 86 |
#include "memmove2.c" |
| 87 |
#include "strstr.c" |
| 88 |
#include "strerror.c" |
| 89 |
#include "strtoul.c" |
| 90 |
#include "tz_sv4.c" |
| 91 |
#include "gethstid.c" |
| 92 |
#include "fsync.c" |
| 93 |
#undef setpgrp |
| 94 |
#include "setpgrp.c" |
| 95 |
|
| 96 |
/* Emulator for BSD syslog() routine |
| 97 |
* Accepts: priority |
| 98 |
* message |
| 99 |
* parameters |
| 100 |
*/ |
| 101 |
|
| 102 |
int syslog (int priority,char *message,char *parameters) |
| 103 |
{ |
| 104 |
/* nothing here for now */ |
| 105 |
} |
| 106 |
|
| 107 |
|
| 108 |
/* Emulator for BSD openlog() routine |
| 109 |
* Accepts: identity |
| 110 |
* options |
| 111 |
* facility |
| 112 |
*/ |
| 113 |
|
| 114 |
int openlog (char *ident,int logopt,int facility) |
| 115 |
{ |
| 116 |
/* nothing here for now */ |
| 117 |
} |
| 118 |
|
| 119 |
|
| 120 |
/* Emulator for BSD ftruncate() routine |
| 121 |
* Accepts: file descriptor |
| 122 |
* length |
| 123 |
*/ |
| 124 |
|
| 125 |
int ftruncate (int fd,unsigned long length) |
| 126 |
{ |
| 127 |
return -1; /* gotta figure out how to do this */ |
| 128 |
} |