* cygwin.din: Export _getmode and getmode to allow querying of binary state of
an fd. * external.cc (cygwin_internal): Add handling of perfile_table setting. * fhandler.cc (perfile_table): New global. (fhandler_base::get_default_fmode): New method to return a file's default mode based on its name. (fhandler_base::open): Use get_default_mode method to determine a file's mode. Record file mode in file flags. * fhandler.h (fhandler_base): Declare get_default_fmode * syscalls.cc (getmode): New function. * sys/cygwin.h (__cygwin_perfile): New structure. (cygwin_getinfo_types): Move outside of WINVER conditional. (per_process): Move inside of WINVER conditional.
This commit is contained in:
@ -36,6 +36,59 @@ extern void cygwin_premain1 (int argc, char **argv);
|
||||
extern void cygwin_premain2 (int argc, char **argv);
|
||||
extern void cygwin_premain3 (int argc, char **argv);
|
||||
|
||||
struct __cygwin_perfile
|
||||
{
|
||||
char *name;
|
||||
unsigned flags;
|
||||
};
|
||||
|
||||
#ifdef _PATH_PASSWD
|
||||
extern HANDLE cygwin_logon_user (const struct passwd *, const char *);
|
||||
#endif
|
||||
|
||||
/* External interface stuff */
|
||||
|
||||
typedef enum
|
||||
{
|
||||
CW_LOCK_PINFO,
|
||||
CW_UNLOCK_PINFO,
|
||||
CW_GETTHREADNAME,
|
||||
CW_GETPINFO,
|
||||
CW_SETPINFO,
|
||||
CW_SETTHREADNAME,
|
||||
CW_GETVERSIONINFO,
|
||||
CW_READ_V1_MOUNT_TABLES,
|
||||
CW_USER_DATA,
|
||||
CW_PERFILE
|
||||
} cygwin_getinfo_types;
|
||||
|
||||
#define CW_NEXTPID 0x80000000 // or with pid to get next one
|
||||
|
||||
/* Flags associated with process_state */
|
||||
enum
|
||||
{
|
||||
PID_NOT_IN_USE = 0x0000, // Free entry.
|
||||
PID_IN_USE = 0x0001, // Entry in use.
|
||||
PID_ZOMBIE = 0x0002, // Child exited: no parent wait.
|
||||
PID_STOPPED = 0x0004, // Waiting for SIGCONT.
|
||||
PID_TTYIN = 0x0008, // Waiting for terminal input.
|
||||
PID_TTYOU = 0x0010, // Waiting for terminal output.
|
||||
PID_ORPHANED = 0x0020, // Member of an orphaned process group.
|
||||
PID_ACTIVE = 0x0040, // Pid accepts signals.
|
||||
PID_CYGPARENT = 0x0080, // Set if parent was a cygwin app.
|
||||
PID_SPLIT_HEAP = 0x0100, // Set if the heap has been split,
|
||||
// which means we can't fork again.
|
||||
PID_CLEAR = 0x0200, // Flag that pid should be cleared from parent's
|
||||
// wait list
|
||||
PID_SOCKETS_USED = 0x0400, // Set if process uses Winsock.
|
||||
PID_INITIALIZING = 0x0800, // Set until ready to receive signals.
|
||||
PID_USETTY = 0x1000, // Setting this enables or disables cygwin's
|
||||
// tty support. This is inherited by
|
||||
// all execed or forked processes.
|
||||
PID_REPARENT = 0x2000 // child has execed
|
||||
};
|
||||
|
||||
#ifdef WINVER
|
||||
/* This lives in the app and is initialized before jumping into the DLL.
|
||||
It should only contain stuff which the user's process needs to see, or
|
||||
which is needed before the user pointer is initialized, or is needed to
|
||||
@ -126,11 +179,6 @@ struct per_process
|
||||
};
|
||||
#define per_process_overwrite ((unsigned) &(((struct per_process *) NULL)->resourcelocks))
|
||||
|
||||
#ifdef _PATH_PASSWD
|
||||
extern HANDLE cygwin_logon_user (const struct passwd *, const char *);
|
||||
#endif
|
||||
|
||||
#ifdef WINVER
|
||||
extern void cygwin_set_impersonation_token (const HANDLE);
|
||||
|
||||
/* included if <windows.h> is included */
|
||||
@ -139,21 +187,6 @@ extern int cygwin_attach_handle_to_fd (char *, int, HANDLE, mode_t, DWORD);
|
||||
|
||||
#include <sys/resource.h>
|
||||
|
||||
/* External interface stuff */
|
||||
|
||||
typedef enum
|
||||
{
|
||||
CW_LOCK_PINFO,
|
||||
CW_UNLOCK_PINFO,
|
||||
CW_GETTHREADNAME,
|
||||
CW_GETPINFO,
|
||||
CW_SETPINFO,
|
||||
CW_SETTHREADNAME,
|
||||
CW_GETVERSIONINFO,
|
||||
CW_READ_V1_MOUNT_TABLES,
|
||||
CW_USER_DATA
|
||||
} cygwin_getinfo_types;
|
||||
|
||||
struct external_pinfo
|
||||
{
|
||||
pid_t pid;
|
||||
@ -182,32 +215,6 @@ struct external_pinfo
|
||||
DWORD cygwin_internal (cygwin_getinfo_types, ...);
|
||||
#endif /*WINVER*/
|
||||
|
||||
#define CW_NEXTPID 0x80000000 // or with pid to get next one
|
||||
|
||||
/* Flags associated with process_state */
|
||||
enum
|
||||
{
|
||||
PID_NOT_IN_USE = 0x0000, // Free entry.
|
||||
PID_IN_USE = 0x0001, // Entry in use.
|
||||
PID_ZOMBIE = 0x0002, // Child exited: no parent wait.
|
||||
PID_STOPPED = 0x0004, // Waiting for SIGCONT.
|
||||
PID_TTYIN = 0x0008, // Waiting for terminal input.
|
||||
PID_TTYOU = 0x0010, // Waiting for terminal output.
|
||||
PID_ORPHANED = 0x0020, // Member of an orphaned process group.
|
||||
PID_ACTIVE = 0x0040, // Pid accepts signals.
|
||||
PID_CYGPARENT = 0x0080, // Set if parent was a cygwin app.
|
||||
PID_SPLIT_HEAP = 0x0100, // Set if the heap has been split,
|
||||
// which means we can't fork again.
|
||||
PID_CLEAR = 0x0200, // Flag that pid should be cleared from parent's
|
||||
// wait list
|
||||
PID_SOCKETS_USED = 0x0400, // Set if process uses Winsock.
|
||||
PID_INITIALIZING = 0x0800, // Set until ready to receive signals.
|
||||
PID_USETTY = 0x1000, // Setting this enables or disables cygwin's
|
||||
// tty support. This is inherited by
|
||||
// all execed or forked processes.
|
||||
PID_REPARENT = 0x2000 // child has execed
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
};
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user