annotate src/osdep/unix/os_sv2.h @ 0:ada5e610ab86

imap-2007e
author yuuji@gentei.org
date Mon, 14 Sep 2009 15:17:45 +0900
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
ada5e610ab86 imap-2007e
yuuji@gentei.org
parents:
diff changeset
1 /* ========================================================================
ada5e610ab86 imap-2007e
yuuji@gentei.org
parents:
diff changeset
2 * Copyright 1988-2006 University of Washington
ada5e610ab86 imap-2007e
yuuji@gentei.org
parents:
diff changeset
3 *
ada5e610ab86 imap-2007e
yuuji@gentei.org
parents:
diff changeset
4 * Licensed under the Apache License, Version 2.0 (the "License");
ada5e610ab86 imap-2007e
yuuji@gentei.org
parents:
diff changeset
5 * you may not use this file except in compliance with the License.
ada5e610ab86 imap-2007e
yuuji@gentei.org
parents:
diff changeset
6 * You may obtain a copy of the License at
ada5e610ab86 imap-2007e
yuuji@gentei.org
parents:
diff changeset
7 *
ada5e610ab86 imap-2007e
yuuji@gentei.org
parents:
diff changeset
8 * http://www.apache.org/licenses/LICENSE-2.0
ada5e610ab86 imap-2007e
yuuji@gentei.org
parents:
diff changeset
9 *
ada5e610ab86 imap-2007e
yuuji@gentei.org
parents:
diff changeset
10 *
ada5e610ab86 imap-2007e
yuuji@gentei.org
parents:
diff changeset
11 * ========================================================================
ada5e610ab86 imap-2007e
yuuji@gentei.org
parents:
diff changeset
12 */
ada5e610ab86 imap-2007e
yuuji@gentei.org
parents:
diff changeset
13
ada5e610ab86 imap-2007e
yuuji@gentei.org
parents:
diff changeset
14 /*
ada5e610ab86 imap-2007e
yuuji@gentei.org
parents:
diff changeset
15 * Program: Operating-system dependent routines -- SVR2 version
ada5e610ab86 imap-2007e
yuuji@gentei.org
parents:
diff changeset
16 *
ada5e610ab86 imap-2007e
yuuji@gentei.org
parents:
diff changeset
17 * Author: Mark Crispin
ada5e610ab86 imap-2007e
yuuji@gentei.org
parents:
diff changeset
18 * Networks and Distributed Computing
ada5e610ab86 imap-2007e
yuuji@gentei.org
parents:
diff changeset
19 * Computing & Communications
ada5e610ab86 imap-2007e
yuuji@gentei.org
parents:
diff changeset
20 * University of Washington
ada5e610ab86 imap-2007e
yuuji@gentei.org
parents:
diff changeset
21 * Administration Building, AG-44
ada5e610ab86 imap-2007e
yuuji@gentei.org
parents:
diff changeset
22 * Seattle, WA 98195
ada5e610ab86 imap-2007e
yuuji@gentei.org
parents:
diff changeset
23 * Internet: MRC@CAC.Washington.EDU
ada5e610ab86 imap-2007e
yuuji@gentei.org
parents:
diff changeset
24 *
ada5e610ab86 imap-2007e
yuuji@gentei.org
parents:
diff changeset
25 * Date: 10 April 1992
ada5e610ab86 imap-2007e
yuuji@gentei.org
parents:
diff changeset
26 * Last Edited: 20 December 2006
ada5e610ab86 imap-2007e
yuuji@gentei.org
parents:
diff changeset
27 */
ada5e610ab86 imap-2007e
yuuji@gentei.org
parents:
diff changeset
28
ada5e610ab86 imap-2007e
yuuji@gentei.org
parents:
diff changeset
29 #include <unistd.h>
ada5e610ab86 imap-2007e
yuuji@gentei.org
parents:
diff changeset
30 #include <string.h>
ada5e610ab86 imap-2007e
yuuji@gentei.org
parents:
diff changeset
31 #define char void
ada5e610ab86 imap-2007e
yuuji@gentei.org
parents:
diff changeset
32 #include <memory.h>
ada5e610ab86 imap-2007e
yuuji@gentei.org
parents:
diff changeset
33 #undef char
ada5e610ab86 imap-2007e
yuuji@gentei.org
parents:
diff changeset
34 #include <sys/types.h>
ada5e610ab86 imap-2007e
yuuji@gentei.org
parents:
diff changeset
35 #include <sys/dir.h>
ada5e610ab86 imap-2007e
yuuji@gentei.org
parents:
diff changeset
36 #include <fcntl.h>
ada5e610ab86 imap-2007e
yuuji@gentei.org
parents:
diff changeset
37 #include <syslog.h>
ada5e610ab86 imap-2007e
yuuji@gentei.org
parents:
diff changeset
38 #include <sys/file.h>
ada5e610ab86 imap-2007e
yuuji@gentei.org
parents:
diff changeset
39 #include <ustat.h>
ada5e610ab86 imap-2007e
yuuji@gentei.org
parents:
diff changeset
40
ada5e610ab86 imap-2007e
yuuji@gentei.org
parents:
diff changeset
41
ada5e610ab86 imap-2007e
yuuji@gentei.org
parents:
diff changeset
42 /* Many versions of SysV get this wrong */
ada5e610ab86 imap-2007e
yuuji@gentei.org
parents:
diff changeset
43
ada5e610ab86 imap-2007e
yuuji@gentei.org
parents:
diff changeset
44 #define setpgrp(a,b) Setpgrp(a,b)
ada5e610ab86 imap-2007e
yuuji@gentei.org
parents:
diff changeset
45 int Setpgrp (int pid,int gid);
ada5e610ab86 imap-2007e
yuuji@gentei.org
parents:
diff changeset
46
ada5e610ab86 imap-2007e
yuuji@gentei.org
parents:
diff changeset
47
ada5e610ab86 imap-2007e
yuuji@gentei.org
parents:
diff changeset
48 /* Different names between BSD and SVR4 */
ada5e610ab86 imap-2007e
yuuji@gentei.org
parents:
diff changeset
49
ada5e610ab86 imap-2007e
yuuji@gentei.org
parents:
diff changeset
50 #define L_SET SEEK_SET
ada5e610ab86 imap-2007e
yuuji@gentei.org
parents:
diff changeset
51 #define L_INCR SEEK_CUR
ada5e610ab86 imap-2007e
yuuji@gentei.org
parents:
diff changeset
52 #define L_XTND SEEK_END
ada5e610ab86 imap-2007e
yuuji@gentei.org
parents:
diff changeset
53
ada5e610ab86 imap-2007e
yuuji@gentei.org
parents:
diff changeset
54 #define lstat stat
ada5e610ab86 imap-2007e
yuuji@gentei.org
parents:
diff changeset
55 #define random lrand48
ada5e610ab86 imap-2007e
yuuji@gentei.org
parents:
diff changeset
56
ada5e610ab86 imap-2007e
yuuji@gentei.org
parents:
diff changeset
57 #define SIGSTOP SIGQUIT
ada5e610ab86 imap-2007e
yuuji@gentei.org
parents:
diff changeset
58
ada5e610ab86 imap-2007e
yuuji@gentei.org
parents:
diff changeset
59 #define S_IFLNK 0120000
ada5e610ab86 imap-2007e
yuuji@gentei.org
parents:
diff changeset
60
ada5e610ab86 imap-2007e
yuuji@gentei.org
parents:
diff changeset
61
ada5e610ab86 imap-2007e
yuuji@gentei.org
parents:
diff changeset
62 /* syslog() emulation */
ada5e610ab86 imap-2007e
yuuji@gentei.org
parents:
diff changeset
63
ada5e610ab86 imap-2007e
yuuji@gentei.org
parents:
diff changeset
64 #define LOG_MAIL (2<<3) /* mail system */
ada5e610ab86 imap-2007e
yuuji@gentei.org
parents:
diff changeset
65 #define LOG_DAEMON (3<<3) /* system daemons */
ada5e610ab86 imap-2007e
yuuji@gentei.org
parents:
diff changeset
66 #define LOG_AUTH (4<<3) /* security/authorization messages */
ada5e610ab86 imap-2007e
yuuji@gentei.org
parents:
diff changeset
67 #define LOG_ALERT 1 /* action must be taken immediately */
ada5e610ab86 imap-2007e
yuuji@gentei.org
parents:
diff changeset
68 #define LOG_CONS 0x02 /* log on the console if errors in sending */
ada5e610ab86 imap-2007e
yuuji@gentei.org
parents:
diff changeset
69 #define LOG_ODELAY 0x04 /* delay open until syslog() is called */
ada5e610ab86 imap-2007e
yuuji@gentei.org
parents:
diff changeset
70 #define LOG_NDELAY 0x08 /* don't delay open */
ada5e610ab86 imap-2007e
yuuji@gentei.org
parents:
diff changeset
71 #define LOG_NOWAIT 0x10 /* if forking to log on console, don't wait() */
ada5e610ab86 imap-2007e
yuuji@gentei.org
parents:
diff changeset
72
ada5e610ab86 imap-2007e
yuuji@gentei.org
parents:
diff changeset
73
ada5e610ab86 imap-2007e
yuuji@gentei.org
parents:
diff changeset
74 /* For setitimer() emulation */
ada5e610ab86 imap-2007e
yuuji@gentei.org
parents:
diff changeset
75
ada5e610ab86 imap-2007e
yuuji@gentei.org
parents:
diff changeset
76 #define ITIMER_REAL 0
ada5e610ab86 imap-2007e
yuuji@gentei.org
parents:
diff changeset
77
ada5e610ab86 imap-2007e
yuuji@gentei.org
parents:
diff changeset
78
ada5e610ab86 imap-2007e
yuuji@gentei.org
parents:
diff changeset
79 /* For opendir() emulation */
ada5e610ab86 imap-2007e
yuuji@gentei.org
parents:
diff changeset
80
ada5e610ab86 imap-2007e
yuuji@gentei.org
parents:
diff changeset
81 typedef struct _dirdesc {
ada5e610ab86 imap-2007e
yuuji@gentei.org
parents:
diff changeset
82 int dd_fd;
ada5e610ab86 imap-2007e
yuuji@gentei.org
parents:
diff changeset
83 long dd_loc;
ada5e610ab86 imap-2007e
yuuji@gentei.org
parents:
diff changeset
84 long dd_size;
ada5e610ab86 imap-2007e
yuuji@gentei.org
parents:
diff changeset
85 char *dd_buf;
ada5e610ab86 imap-2007e
yuuji@gentei.org
parents:
diff changeset
86 } DIR;
ada5e610ab86 imap-2007e
yuuji@gentei.org
parents:
diff changeset
87
ada5e610ab86 imap-2007e
yuuji@gentei.org
parents:
diff changeset
88 struct passwd *getpwent (void);
ada5e610ab86 imap-2007e
yuuji@gentei.org
parents:
diff changeset
89 struct passwd *getpwuid (int uid);
ada5e610ab86 imap-2007e
yuuji@gentei.org
parents:
diff changeset
90 struct passwd *getpwnam (char *name);
ada5e610ab86 imap-2007e
yuuji@gentei.org
parents:
diff changeset
91 struct group *getgrnam (char *name);
ada5e610ab86 imap-2007e
yuuji@gentei.org
parents:
diff changeset
92
ada5e610ab86 imap-2007e
yuuji@gentei.org
parents:
diff changeset
93 char *getenv (char *name);
ada5e610ab86 imap-2007e
yuuji@gentei.org
parents:
diff changeset
94 long gethostid (void);
ada5e610ab86 imap-2007e
yuuji@gentei.org
parents:
diff changeset
95 void *memmove (void *s,void *ct,size_t n);
ada5e610ab86 imap-2007e
yuuji@gentei.org
parents:
diff changeset
96 char *strstr (char *cs,char *ct);
ada5e610ab86 imap-2007e
yuuji@gentei.org
parents:
diff changeset
97 char *strerror (int n);
ada5e610ab86 imap-2007e
yuuji@gentei.org
parents:
diff changeset
98 unsigned long strtoul (char *s,char **endp,int base);
ada5e610ab86 imap-2007e
yuuji@gentei.org
parents:
diff changeset
99 DIR *opendir (char * name);
ada5e610ab86 imap-2007e
yuuji@gentei.org
parents:
diff changeset
100 int closedir (DIR *d);
ada5e610ab86 imap-2007e
yuuji@gentei.org
parents:
diff changeset
101 struct direct *readdir (DIR *d);
ada5e610ab86 imap-2007e
yuuji@gentei.org
parents:
diff changeset
102 typedef int (*select_t) (struct direct *name);
ada5e610ab86 imap-2007e
yuuji@gentei.org
parents:
diff changeset
103 typedef int (*compar_t) (void *d1,void *d2);
ada5e610ab86 imap-2007e
yuuji@gentei.org
parents:
diff changeset
104 int scandir (char *dirname,struct direct ***namelist,select_t select,
ada5e610ab86 imap-2007e
yuuji@gentei.org
parents:
diff changeset
105 compar_t compar);
ada5e610ab86 imap-2007e
yuuji@gentei.org
parents:
diff changeset
106 int alphasort (void *d1,void *d2);
ada5e610ab86 imap-2007e
yuuji@gentei.org
parents:
diff changeset
107 int fsync (int fd);
ada5e610ab86 imap-2007e
yuuji@gentei.org
parents:
diff changeset
108 int openlog (ident,logopt,facility);
ada5e610ab86 imap-2007e
yuuji@gentei.org
parents:
diff changeset
109 int syslog (priority,message,parameters ...);
ada5e610ab86 imap-2007e
yuuji@gentei.org
parents:
diff changeset
110 void *malloc (size_t byteSize);
ada5e610ab86 imap-2007e
yuuji@gentei.org
parents:
diff changeset
111 void free (void *ptr);
ada5e610ab86 imap-2007e
yuuji@gentei.org
parents:
diff changeset
112 void *realloc (void *oldptr,size_t newsize);
ada5e610ab86 imap-2007e
yuuji@gentei.org
parents:
diff changeset
113
ada5e610ab86 imap-2007e
yuuji@gentei.org
parents:
diff changeset
114
ada5e610ab86 imap-2007e
yuuji@gentei.org
parents:
diff changeset
115 #include "env_unix.h"
ada5e610ab86 imap-2007e
yuuji@gentei.org
parents:
diff changeset
116 #include "fs.h"
ada5e610ab86 imap-2007e
yuuji@gentei.org
parents:
diff changeset
117 #include "ftl.h"
ada5e610ab86 imap-2007e
yuuji@gentei.org
parents:
diff changeset
118 #include "nl.h"
ada5e610ab86 imap-2007e
yuuji@gentei.org
parents:
diff changeset
119 #include "tcp.h"
ada5e610ab86 imap-2007e
yuuji@gentei.org
parents:
diff changeset
120 #include "flocksim.h"

yatex.org