VirtualBox

source: kBuild/trunk/src/kash/shinstance.c@ 1225

Last change on this file since 1225 was 1225, checked in by bird, 17 years ago

stubbed the sh stuff.

  • Property svn:eol-style set to LF
File size: 4.1 KB
Line 
1/* $Id: $ */
2/** @file
3 *
4 * The shell instance methods.
5 *
6 * Copyright (c) 2007 knut st. osmundsen <[email protected]>
7 *
8 *
9 * This file is part of kBuild.
10 *
11 * kBuild is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 * kBuild is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with kBuild; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 *
25 */
26
27#include <string.h>
28#include "shinstance.h"
29
30
31/**
32 * Creates a root shell instance.
33 *
34 * @param inherit The shell to inherit from. If NULL inherit from environment and such.
35 * @param argc The argument count.
36 * @param argv The argument vector.
37 *
38 * @returns pointer to root shell on success, NULL on failure.
39 */
40shinstance *sh_create_root_shell(shinstance *inherit, int argc, char **argv)
41{
42 shinstance *psh;
43
44 psh = malloc(sizeof(*psh));
45 if (psh)
46 {
47 memset(psh, 0, sizeof(*psh));
48
49 /* memalloc.c */
50 psh->stacknleft = MINSIZE;
51 psh->herefd = -1;
52 psh->stackp = &psh->stackbase;
53 psh->stacknxt = psh->stackbase.space;
54
55 /* input.c */
56 psh->plinno = 1;
57 psh->init_editline = 0;
58 psh->parsefile = &psh->basepf;
59
60 /* output.c */
61 psh->output.bufsize = OUTBUFSIZ;
62 psh->output.fd = 1;
63 psh->errout.bufsize = 100;
64 psh->errout.fd = 2;
65 psh->memout.fd = MEM_OUT;
66 psh->out1 = &psh->output;
67 psh->out2 = &psh->errout;
68
69 /* jobs.c */
70 psh->backgndpid = -1;
71#if JOBS
72 psh->curjob = -1;
73#endif
74 psh->ttyfd = -1;
75
76 }
77 return psh;
78}
79
80
81char *sh_getenv(shinstance *psh, const char *var)
82{
83 return NULL;
84}
85
86char **sh_environ(shinstance *psh)
87{
88 static char *s_null[2] = {0,0};
89 return &s_null[0];
90}
91
92const char *sh_gethomedir(shinstance *psh, const char *user)
93{
94 return NULL;
95}
96
97int sh_sigaction(int signo, const struct sh_sigaction *newp, struct sh_sigaction *oldp)
98{
99 return -1;
100}
101
102sh_sig_t sh_signal(shinstance *psh, int signo, sh_sig_t handler)
103{
104 return (sh_sig_t)-1;
105}
106
107int sh_siginterrupt(shinstance *psh, int signo, int interrupt)
108{
109 return -1;
110}
111
112void sh_sigemptyset(sh_sigset_t *setp)
113{
114
115}
116
117int sh_sigprocmask(shinstance *psh, int operation, sh_sigset_t const *newp, sh_sigset_t *oldp)
118{
119 return -1;
120}
121
122void sh_abort(shinstance *psh)
123{
124}
125
126void sh_raise_sigint(shinstance *psh)
127{
128
129}
130
131int sh_kill(shinstance *psh, pid_t pid, int signo)
132{
133 return -1;
134}
135
136int sh_killpg(shinstance *psh, pid_t pgid, int signo)
137{
138 return -1;
139}
140
141clock_t sh_times(shinstance *psh, shtms *tmsp)
142{
143 return 0;
144}
145
146int sh_sysconf_clk_tck(void)
147{
148 return 1;
149}
150
151pid_t sh_fork(shinstance *psh)
152{
153 return -1;
154}
155
156pid_t sh_waitpid(shinstance *psh, pid_t pid, int *statusp, int flags)
157{
158 return -1;
159}
160
161void sh__exit(shinstance *psh, int rc)
162{
163}
164
165int sh_execve(shinstance *psh, const char *exe, const char * const *argv, const char * const *envp)
166{
167 return -1;
168}
169
170uid_t sh_getuid(shinstance *psh)
171{
172 return 0;
173}
174
175uid_t sh_geteuid(shinstance *psh)
176{
177 return 0;
178}
179
180gid_t sh_getgid(shinstance *psh)
181{
182 return 0;
183}
184
185gid_t sh_getegid(shinstance *psh)
186{
187 return 0;
188}
189
190pid_t sh_getpid(shinstance *psh)
191{
192 return 0;
193}
194
195pid_t sh_getpgrp(shinstance *psh)
196{
197 return 0;
198}
199
200pid_t sh_getpgid(shinstance *psh, pid_t pid)
201{
202 return pid;
203}
204
205int sh_setpgid(shinstance *psh, pid_t pid, pid_t pgid)
206{
207 return -1;
208}
209
210pid_t sh_tcgetpgrp(shinstance *psh, int fd)
211{
212 return -1;
213}
214
215int sh_tcsetpgrp(shinstance *psh, int fd, pid_t pgrp)
216{
217 return -1;
218}
219
220int sh_getrlimit(shinstance *psh, int resid, shrlimit *limp)
221{
222 return -1;
223}
224
225int sh_setrlimit(shinstance *psh, int resid, const shrlimit *limp)
226{
227 return -1;
228}
229
Note: See TracBrowser for help on using the repository browser.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette