unistd.h revision 4fd606d1f5abe38e1f42c38de1d2e895166bd0f4
/** @file
Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials are licensed and made available under
the terms and conditions of the BSD License that accompanies this distribution.
The full text of the license may be found at
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#ifndef _UNISTD_H_
#define _UNISTD_H_
//#include <machine/int_types.h>
//#include <sys/featuretest.h>
#include <sys/EfiSysCall.h>
#define F_ULOCK 0
#define F_LOCK 1
#define F_TLOCK 2
#define F_TEST 3
/* access function */
#define F_OK 0 /* test for existence of file */
int dup(int);
int rename(const char *, const char *);
/* Functions implemented for compatibility. */
int getopt(int, char * const [], const char *);
extern char *optarg; /* getopt(3) external variables */
extern int optind;
char *getpass(const char *);
int usleep(useconds_t);
unsigned int sleep(unsigned int);
#ifndef GETCWD_DECLARED
/** Gets the current working directory.
The getcwd() function shall place an absolute pathname of the current
working directory in the array pointed to by buf, and return buf. The
pathname copied to the array shall contain no components that are
symbolic links. The size argument is the size in bytes of the character
array pointed to by the buf argument.
@param[in,out] Buf The buffer to fill.
@param[in] BufSize The number of bytes in buffer.
@retval NULL The function failed.
@retval NULL Buf was NULL.
@retval NULL Size was 0.
@return buf The function completed successfully. See errno for info.
**/
#define GETCWD_DECLARED
#endif
#ifndef CHDIR_DECLARED
/** Change the current working directory.
The chdir() function shall cause the directory named by the pathname
pointed to by the path argument to become the current working directory;
that is, the starting point for path searches for pathnames not beginning
with '/'.
@param[in] Path The new path to set.
@todo Add non-shell CWD changing.
**/
#define CHDIR_DECLARED
#endif
/** Determine accessibility of a file.
The access() function checks the file, named by the pathname pointed to by
the Path argument, for accessibility according to the bit pattern contained
in Mode.
The value of Mode is either the bitwise-inclusive OR of the access
permissions to be checked (R_OK, W_OK, X_OK) or the existence test (F_OK).
If Path ends in '/' or '\\', the target must be a directory, otherwise it doesn't matter.
A file is executable if it is NOT a directory and it ends in ".efi".
@param[in] Path Path or name of the file to be checked.
@param[in] Mode Access permissions to check for.
@retval 0 Successful completion.
@retval -1 File is not accessible with the given Mode. The error condition
is indicated by errno. Values of errno specific to the access
function include: EACCES, ENOENT, ENOTDIR, ENAMETOOLONG
**/
// Networking
long gethostid(void);
int gethostname(char *, size_t);
int getdomainname(char *, size_t);
int setdomainname(const char *, size_t);
int sethostid(long);
int sethostname(const char *, size_t);
/* Stub functions implemented for porting ease.
These functions always fail or return NULL.
*/
// For Future implementation
int syscall(int, ...);
#if 0 // The following functions are not implemented
unsigned int alarm(unsigned int);
int execl(const char *, const char *, ...);
int execle(const char *, const char *, ...);
int execlp(const char *, const char *, ...);
int execv(const char *, char * const *);
int execve(const char *, char * const *, char * const *);
int execvp(const char *, char * const *);
long fpathconf(int, int);
int link(const char *, const char *);
long pathconf(const char *, int);
int pause(void);
int pipe(int *);
long sysconf(int);
extern int opterr;
extern int optopt;
extern int optreset;
extern char *suboptarg;
int fdatasync(int);
int fsync(int);
int chroot(const char *);
int nice(int);
int encrypt(char *, int);
#ifndef intptr_t
typedef __intptr_t intptr_t;
#define intptr_t __intptr_t
#endif
int brk(void *);
int fchdir(int);
int getdtablesize(void);
int symlink(const char *, const char *);
void sync(void);
/*
* Implementation-defined extensions
*/
int acct(const char *);
int closefrom(int);
int des_cipher(const char *, char *, long, int);
int des_setkey(const char *);
void endusershell(void);
int exect(const char *, char * const *, char * const *);
int fchroot(int);
int getsubopt(char **, char * const *, char **);
__aconst char *getusershell(void);
int initgroups(const char *, gid_t);
int issetugid(void);
int nfssvc(int, void *);
void psignal(unsigned int, const char *);
int rcmd(char **, int, const char *, const char *, const char *, int *);
int revoke(const char *);
int rresvport(int *);
int ruserok(const char *, int, const char *, const char *);
int setlogin(const char *);
void *setmode(const char *);
void setusershell(void);
int swapctl(int, void *, int);
int undelete(const char *);
int rcmd_af(char **, int, const char *, const char *, const char *, int *, int);
int rresvport_af(int *, int);
int iruserok_sa(const void *, int, int, const char *, const char *);
#endif /* Unimplemented functions. */
#endif /* !_UNISTD_H_ */