mirror of
https://github.com/PowerShell/Win32-OpenSSH.git
synced 2025-07-24 14:35:35 +02:00
3-6 C1
Moving conflicting defs to internal header
This commit is contained in:
parent
0b3db0aa3e
commit
fc9a325988
@ -28,43 +28,3 @@
|
||||
|
||||
/*fd flags*/
|
||||
#define FD_CLOEXEC 0x1
|
||||
|
||||
|
||||
/*
|
||||
* open() flags and modes
|
||||
* all commented out macros are defined in fcntl.h
|
||||
* they are listed here so as to cross check any conflicts with macros explicitly
|
||||
* defined below.
|
||||
*/
|
||||
/*open access modes. only one of these can be specified*/
|
||||
/* #define O_RDONLY 0x0 */
|
||||
/* #define O_WRONLY 0x1 */
|
||||
/* #define O_RDWR 0x2 */
|
||||
/* open file creation and file status flags can be bitwise-or'd*/
|
||||
/* #define O_APPEND 0x8 /*file is opened in append mode*/
|
||||
#ifndef O_NONBLOCK
|
||||
#define O_NONBLOCK 0x0004 /*io operations wont block*/
|
||||
#endif
|
||||
/* #define O_CREAT 0x100 /*If the file does not exist it will be created*/
|
||||
/*
|
||||
* If the file exists and is a regular file, and the file is successfully
|
||||
* opened O_RDWR or O_WRONLY, its length shall be truncated to 0, and the mode
|
||||
* and owner shall be unchanged
|
||||
*/
|
||||
/* #define O_TRUNC 0x200 */
|
||||
/* If O_CREAT and O_EXCL are set, open() shall fail if the file exists */
|
||||
/* #define O_EXCL 0x400 */
|
||||
/* #define O_BINARY 0x8000 //Gives raw data (while O_TEXT normalises line endings */
|
||||
// open modes
|
||||
#ifndef S_IRUSR
|
||||
#define S_IRUSR 00400 //user has read permission
|
||||
#endif // ! S_IRUSR
|
||||
#ifndef S_IWUSR
|
||||
#define S_IWUSR 00200 //user has write permission
|
||||
#endif
|
||||
#ifndef S_IRGRP
|
||||
#define S_IRGRP 00040 //group has read permission
|
||||
#endif
|
||||
#ifndef S_IROTH
|
||||
#define S_IROTH 00004 //others have read permission
|
||||
#endif
|
@ -58,6 +58,7 @@ int w32_dup2(int oldfd, int newfd);
|
||||
|
||||
/* misc */
|
||||
unsigned int w32_alarm(unsigned int seconds);
|
||||
typedef void(*sighandler_t)(int);
|
||||
#define signal w32_signal
|
||||
#define mysignal w32_signal
|
||||
|
||||
@ -89,3 +90,13 @@ unsigned int w32_alarm(unsigned int seconds);
|
||||
#define EPFNOSUPPORT WSAEPFNOSUPPORT
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* these routines are temporarily defined here to allow transition
|
||||
* from older POSIX wrapper to the newer one. After complete transition
|
||||
* these should move to a internal header.
|
||||
*/
|
||||
int w32_temp_DelChildToWatch(HANDLE processtowatch);
|
||||
HANDLE w32_fd_to_handle(int fd);
|
||||
int w32_allocate_fd_for_handle(HANDLE h);
|
||||
|
||||
|
@ -585,4 +585,46 @@ w32_dup2(int oldfd, int newfd) {
|
||||
errno = EOPNOTSUPP;
|
||||
debug("ERROR: dup2 is not implemented yet");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
unsigned int
|
||||
w32_alarm(unsigned int seconds) {
|
||||
/*TODO - implement alarm */
|
||||
return 0;
|
||||
}
|
||||
|
||||
sighandler_t w32_signal(int signum, sighandler_t handler) {
|
||||
/*TODO - implement signal()*/
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
w32_temp_DelChildToWatch(HANDLE processtowatch) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
HANDLE
|
||||
w32_fd_to_handle(int fd) {
|
||||
return fd_table.w32_ios[fd]->handle;
|
||||
}
|
||||
|
||||
int w32_allocate_fd_for_handle(HANDLE h) {
|
||||
int min_index = fd_table_get_min_index();
|
||||
struct w32_io* pio;
|
||||
|
||||
if (min_index == -1) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
pio = malloc(sizeof(struct w32_io));
|
||||
if (pio == NULL) {
|
||||
errno = ENOMEM;
|
||||
return -1;
|
||||
}
|
||||
memset(pio, 0, sizeof(struct w32_io));
|
||||
|
||||
pio->type = FILE_FD;
|
||||
pio->handle = h;
|
||||
fd_table_set(pio, min_index);
|
||||
return min_index;
|
||||
}
|
||||
|
@ -118,3 +118,42 @@ int fileio_isatty(struct w32_io* pio);
|
||||
FILE* fileio_fdopen(struct w32_io* pio, const char *mode);
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* open() flags and modes
|
||||
* all commented out macros are defined in fcntl.h
|
||||
* they are listed here so as to cross check any conflicts with macros explicitly
|
||||
* defined below.
|
||||
*/
|
||||
/*open access modes. only one of these can be specified*/
|
||||
/* #define O_RDONLY 0x0 */
|
||||
/* #define O_WRONLY 0x1 */
|
||||
/* #define O_RDWR 0x2 */
|
||||
/* open file creation and file status flags can be bitwise-or'd*/
|
||||
/* #define O_APPEND 0x8 /*file is opened in append mode*/
|
||||
#ifndef O_NONBLOCK
|
||||
#define O_NONBLOCK 0x0004 /*io operations wont block*/
|
||||
#endif
|
||||
/* #define O_CREAT 0x100 /*If the file does not exist it will be created*/
|
||||
/*
|
||||
* If the file exists and is a regular file, and the file is successfully
|
||||
* opened O_RDWR or O_WRONLY, its length shall be truncated to 0, and the mode
|
||||
* and owner shall be unchanged
|
||||
*/
|
||||
/* #define O_TRUNC 0x200 */
|
||||
/* If O_CREAT and O_EXCL are set, open() shall fail if the file exists */
|
||||
/* #define O_EXCL 0x400 */
|
||||
/* #define O_BINARY 0x8000 //Gives raw data (while O_TEXT normalises line endings */
|
||||
// open modes
|
||||
#ifndef S_IRUSR
|
||||
#define S_IRUSR 00400 //user has read permission
|
||||
#endif // ! S_IRUSR
|
||||
#ifndef S_IWUSR
|
||||
#define S_IWUSR 00200 //user has write permission
|
||||
#endif
|
||||
#ifndef S_IRGRP
|
||||
#define S_IRGRP 00040 //group has read permission
|
||||
#endif
|
||||
#ifndef S_IROTH
|
||||
#define S_IROTH 00004 //others have read permission
|
||||
#endif
|
Loading…
x
Reference in New Issue
Block a user