VirtualBox

source: kBuild/trunk/src/kash/shfile.h@ 1196

Last change on this file since 1196 was 884, checked in by bird, 18 years ago

hacking...

File size: 2.3 KB
Line 
1/* $Id: $ */
2/** @file
3 *
4 * File management.
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#ifndef ___shfile_h___
28#define ___shfile_h___
29
30#include "shtypes.h"
31
32/**
33 * One file.
34 */
35typedef struct shfile
36{
37 int fd; /**< The shell file descriptor number. */
38 int flags; /**< Open flags. */
39 intptr_t native; /**< The native file descriptor number. */
40} shfile;
41
42/**
43 * The file descriptor table for a shell.
44 */
45typedef struct shfdtab
46{
47 shmtx mtx; /**< Mutex protecting any operations on the table and it's handles. */
48 char *cwd; /**< The current directory for this shell instance. */
49 unsigned size; /**< The size of the table (number of entries). */
50 shfile *tab; /**< Pointer to the table. */
51} shfdtab;
52
53
54int shfile_open(shfdtab *, const char *, unsigned);
55int shfile_pipe(shfdtab *, int [2]);
56int shfile_close(shfdtab *, unsigned);
57int shfile_fcntl(shfdtab *, int fd, int cmd, int arg);
58#ifdef _MSC_VER
59# define F_DUPFD 0
60# define F_GETFD 1
61# define F_SETFD 2
62# define F_GETFL 3
63# define F_SETFL 4
64# define FD_CLOEXEC 1
65#else
66# include <sys/fcntl.h>
67#endif
68
69int shfile_stat(shfdtab *, const char *, struct stat *);
70int shfile_lstat(shfdtab *, const char *, struct stat *);
71int shfile_chdir(shfdtab *, const char *);
72char *shfile_getcwd(shfdtab *, char *, int);
73
74#endif
75
Note: See TracBrowser for help on using the repository browser.

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