aboutsummaryrefslogtreecommitdiffstats
path: root/arch/um/include/os.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
commit1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch)
tree0bba044c4ce775e45a88a51686b5d9f90697ea9d /arch/um/include/os.h
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!
Diffstat (limited to 'arch/um/include/os.h')
-rw-r--r--arch/um/include/os.h183
1 files changed, 183 insertions, 0 deletions
diff --git a/arch/um/include/os.h b/arch/um/include/os.h
new file mode 100644
index 000000000000..07340c8cf203
--- /dev/null
+++ b/arch/um/include/os.h
@@ -0,0 +1,183 @@
1/*
2 * Copyright (C) 2002 Jeff Dike (jdike@karaya.com)
3 * Licensed under the GPL
4 */
5
6#ifndef __OS_H__
7#define __OS_H__
8
9#include "asm/types.h"
10#include "../os/include/file.h"
11
12#define OS_TYPE_FILE 1
13#define OS_TYPE_DIR 2
14#define OS_TYPE_SYMLINK 3
15#define OS_TYPE_CHARDEV 4
16#define OS_TYPE_BLOCKDEV 5
17#define OS_TYPE_FIFO 6
18#define OS_TYPE_SOCK 7
19
20/* os_access() flags */
21#define OS_ACC_F_OK 0 /* Test for existence. */
22#define OS_ACC_X_OK 1 /* Test for execute permission. */
23#define OS_ACC_W_OK 2 /* Test for write permission. */
24#define OS_ACC_R_OK 4 /* Test for read permission. */
25#define OS_ACC_RW_OK (OS_ACC_W_OK | OS_ACC_R_OK) /* Test for RW permission */
26
27/*
28 * types taken from stat_file() in hostfs_user.c
29 * (if they are wrong here, they are wrong there...).
30 */
31struct uml_stat {
32 int ust_dev; /* device */
33 unsigned long long ust_ino; /* inode */
34 int ust_mode; /* protection */
35 int ust_nlink; /* number of hard links */
36 int ust_uid; /* user ID of owner */
37 int ust_gid; /* group ID of owner */
38 unsigned long long ust_size; /* total size, in bytes */
39 int ust_blksize; /* blocksize for filesystem I/O */
40 unsigned long long ust_blocks; /* number of blocks allocated */
41 unsigned long ust_atime; /* time of last access */
42 unsigned long ust_mtime; /* time of last modification */
43 unsigned long ust_ctime; /* time of last change */
44};
45
46struct openflags {
47 unsigned int r : 1;
48 unsigned int w : 1;
49 unsigned int s : 1; /* O_SYNC */
50 unsigned int c : 1; /* O_CREAT */
51 unsigned int t : 1; /* O_TRUNC */
52 unsigned int a : 1; /* O_APPEND */
53 unsigned int e : 1; /* O_EXCL */
54 unsigned int cl : 1; /* FD_CLOEXEC */
55};
56
57#define OPENFLAGS() ((struct openflags) { .r = 0, .w = 0, .s = 0, .c = 0, \
58 .t = 0, .a = 0, .e = 0, .cl = 0 })
59
60static inline struct openflags of_read(struct openflags flags)
61{
62 flags.r = 1;
63 return(flags);
64}
65
66static inline struct openflags of_write(struct openflags flags)
67{
68 flags.w = 1;
69 return(flags);
70}
71
72static inline struct openflags of_rdwr(struct openflags flags)
73{
74 return(of_read(of_write(flags)));
75}
76
77static inline struct openflags of_set_rw(struct openflags flags, int r, int w)
78{
79 flags.r = r;
80 flags.w = w;
81 return(flags);
82}
83
84static inline struct openflags of_sync(struct openflags flags)
85{
86 flags.s = 1;
87 return(flags);
88}
89
90static inline struct openflags of_create(struct openflags flags)
91{
92 flags.c = 1;
93 return(flags);
94}
95
96static inline struct openflags of_trunc(struct openflags flags)
97{
98 flags.t = 1;
99 return(flags);
100}
101
102static inline struct openflags of_append(struct openflags flags)
103{
104 flags.a = 1;
105 return(flags);
106}
107
108static inline struct openflags of_excl(struct openflags flags)
109{
110 flags.e = 1;
111 return(flags);
112}
113
114static inline struct openflags of_cloexec(struct openflags flags)
115{
116 flags.cl = 1;
117 return(flags);
118}
119
120extern int os_stat_file(const char *file_name, struct uml_stat *buf);
121extern int os_stat_fd(const int fd, struct uml_stat *buf);
122extern int os_access(const char *file, int mode);
123extern void os_print_error(int error, const char* str);
124extern int os_get_exec_close(int fd, int *close_on_exec);
125extern int os_set_exec_close(int fd, int close_on_exec);
126extern int os_ioctl_generic(int fd, unsigned int cmd, unsigned long arg);
127extern int os_window_size(int fd, int *rows, int *cols);
128extern int os_new_tty_pgrp(int fd, int pid);
129extern int os_get_ifname(int fd, char *namebuf);
130extern int os_set_slip(int fd);
131extern int os_set_owner(int fd, int pid);
132extern int os_sigio_async(int master, int slave);
133extern int os_mode_fd(int fd, int mode);
134
135extern int os_seek_file(int fd, __u64 offset);
136extern int os_open_file(char *file, struct openflags flags, int mode);
137extern int os_read_file(int fd, void *buf, int len);
138extern int os_write_file(int fd, const void *buf, int count);
139extern int os_file_size(char *file, long long *size_out);
140extern int os_file_modtime(char *file, unsigned long *modtime);
141extern int os_pipe(int *fd, int stream, int close_on_exec);
142extern int os_set_fd_async(int fd, int owner);
143extern int os_clear_fd_async(int fd);
144extern int os_set_fd_block(int fd, int blocking);
145extern int os_accept_connection(int fd);
146extern int os_create_unix_socket(char *file, int len, int close_on_exec);
147extern int os_shutdown_socket(int fd, int r, int w);
148extern void os_close_file(int fd);
149extern int os_rcv_fd(int fd, int *helper_pid_out);
150extern int create_unix_socket(char *file, int len, int close_on_exec);
151extern int os_connect_socket(char *name);
152extern int os_file_type(char *file);
153extern int os_file_mode(char *file, struct openflags *mode_out);
154extern int os_lock_file(int fd, int excl);
155
156extern unsigned long os_process_pc(int pid);
157extern int os_process_parent(int pid);
158extern void os_stop_process(int pid);
159extern void os_kill_process(int pid, int reap_child);
160extern void os_kill_ptraced_process(int pid, int reap_child);
161extern void os_usr1_process(int pid);
162extern int os_getpid(void);
163
164extern int os_map_memory(void *virt, int fd, unsigned long long off,
165 unsigned long len, int r, int w, int x);
166extern int os_protect_memory(void *addr, unsigned long len,
167 int r, int w, int x);
168extern int os_unmap_memory(void *addr, int len);
169extern void os_flush_stdout(void);
170extern unsigned long long os_usecs(void);
171
172#endif
173
174/*
175 * Overrides for Emacs so that we follow Linus's tabbing style.
176 * Emacs will notice this stuff at the end of the file and automatically
177 * adjust the settings for this buffer only. This must remain at the end
178 * of the file.
179 * ---------------------------------------------------------------------------
180 * Local variables:
181 * c-file-style: "linux"
182 * End:
183 */