Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'winsup/cygwin/include')
-rw-r--r--winsup/cygwin/include/cygwin/acl.h24
-rwxr-xr-xwinsup/cygwin/include/cygwin/cygserver.h213
-rwxr-xr-xwinsup/cygwin/include/cygwin/cygserver_process.h168
-rwxr-xr-xwinsup/cygwin/include/cygwin/cygserver_transport.h43
-rwxr-xr-xwinsup/cygwin/include/cygwin/cygserver_transport_pipes.h66
-rwxr-xr-xwinsup/cygwin/include/cygwin/cygserver_transport_sockets.h55
-rw-r--r--winsup/cygwin/include/cygwin/grp.h48
-rw-r--r--winsup/cygwin/include/cygwin/if.h40
-rw-r--r--winsup/cygwin/include/cygwin/ip.h1
-rw-r--r--winsup/cygwin/include/cygwin/ipc.h53
-rw-r--r--winsup/cygwin/include/cygwin/msg.h92
-rw-r--r--winsup/cygwin/include/cygwin/mtio.h8
-rw-r--r--winsup/cygwin/include/cygwin/sem.h95
-rw-r--r--winsup/cygwin/include/cygwin/shm.h94
-rw-r--r--winsup/cygwin/include/cygwin/socket.h6
-rw-r--r--winsup/cygwin/include/cygwin/stat.h88
-rw-r--r--winsup/cygwin/include/cygwin/types.h44
-rw-r--r--winsup/cygwin/include/cygwin/version.h50
-rw-r--r--winsup/cygwin/include/fnmatch.h63
-rw-r--r--winsup/cygwin/include/getopt.h34
-rw-r--r--winsup/cygwin/include/glob.h9
-rw-r--r--winsup/cygwin/include/limits.h15
-rw-r--r--winsup/cygwin/include/netinet/ip.h203
-rw-r--r--winsup/cygwin/include/netinet/tcp.h146
-rw-r--r--winsup/cygwin/include/netinet/udp.h51
-rw-r--r--winsup/cygwin/include/pthread.h27
-rw-r--r--winsup/cygwin/include/sys/cygwin.h33
-rw-r--r--winsup/cygwin/include/sys/ioctl.h4
-rw-r--r--winsup/cygwin/include/sys/ipc.h52
-rw-r--r--winsup/cygwin/include/sys/mount.h8
-rw-r--r--winsup/cygwin/include/sys/resource.h20
-rw-r--r--winsup/cygwin/include/sys/shm.h89
-rw-r--r--winsup/cygwin/include/sys/socket.h13
-rw-r--r--winsup/cygwin/include/sys/soundcard.h82
-rw-r--r--winsup/cygwin/include/sys/statfs.h11
-rw-r--r--winsup/cygwin/include/sys/strace.h10
-rw-r--r--winsup/cygwin/include/sys/sysmacros.h8
-rw-r--r--winsup/cygwin/include/sys/termios.h28
-rw-r--r--winsup/cygwin/include/sys/uio.h9
-rw-r--r--winsup/cygwin/include/sys/un.h2
-rw-r--r--winsup/cygwin/include/sys/vfs.h2
-rw-r--r--winsup/cygwin/include/wchar.h28
42 files changed, 1620 insertions, 515 deletions
diff --git a/winsup/cygwin/include/cygwin/acl.h b/winsup/cygwin/include/cygwin/acl.h
index 3248b2e68..3ea5f91e5 100644
--- a/winsup/cygwin/include/cygwin/acl.h
+++ b/winsup/cygwin/include/cygwin/acl.h
@@ -1,6 +1,6 @@
/* cygwin/acl.h header file for Cygwin.
- Copyright 1999, 2000, 2001 Red Hat, Inc.
+ Copyright 1999, 2000, 2001, 2002 Red Hat, Inc.
Written by C. Vinschen.
This file is part of Cygwin.
@@ -58,12 +58,27 @@ extern "C" {
#define MASK CLASS_OBJ
#define OTHER OTHER_OBJ
+#ifdef __INSIDE_CYGWIN__
+typedef struct __acl16 {
+ int a_type;
+ __uid16_t a_id;
+ mode_t a_perm;
+} __aclent16_t;
+
+typedef struct __acl32 {
+ int a_type;
+ __uid32_t a_id;
+ mode_t a_perm;
+} __aclent32_t;
+#else
typedef struct acl {
- int a_type; /* entry type */
- uid_t a_id; /* UID | GID */
- mode_t a_perm; /* permissions */
+ int a_type; /* entry type */
+ uid_t a_id; /* UID | GID */
+ mode_t a_perm; /* permissions */
} aclent_t;
+#endif
+#ifndef __INSIDE_CYGWIN__
int _EXFUN(acl,(const char *path, int cmd, int nentries, aclent_t *aclbufp));
int _EXFUN(lacl,(const char *path, int cmd, int nentries, aclent_t *aclbufp));
int _EXFUN(facl,(int fd, int cmd, int nentries, aclent_t *aclbufp));
@@ -75,6 +90,7 @@ int _EXFUN(acltopbits,(aclent_t *aclbufp, int nentries, mode_t *pbitsp));
int _EXFUN(aclfrompbits,(aclent_t *aclbufp, int nentries, mode_t *pbitsp));
char *_EXFUN(acltotext,(aclent_t *aclbufp, int aclcnt));
aclent_t *_EXFUN(aclfromtext,(char *acltextp, int *aclcnt));
+#endif
#ifdef __cplusplus
}
diff --git a/winsup/cygwin/include/cygwin/cygserver.h b/winsup/cygwin/include/cygwin/cygserver.h
index 3751863f5..d4ea70fbb 100755
--- a/winsup/cygwin/include/cygwin/cygserver.h
+++ b/winsup/cygwin/include/cygwin/cygserver.h
@@ -1,6 +1,6 @@
/* cygserver.h
- Copyright 2001 Red Hat Inc.
+ Copyright 2001, 2002 Red Hat Inc.
Written by Egor Duda <deo@logos-m.ru>
@@ -13,123 +13,172 @@ details. */
#ifndef _CYGSERVER_H_
#define _CYGSERVER_H_
-#define MAX_REQUEST_SIZE 128
+#ifdef __GNUC__
+#define CYGSERVER_PACKED __attribute__ ((packed))
+#else
+#define CYGSERVER_PACKED
+#endif
#define CYGWIN_SERVER_VERSION_MAJOR 1
#define CYGWIN_SERVER_VERSION_API 1
#define CYGWIN_SERVER_VERSION_MINOR 0
#define CYGWIN_SERVER_VERSION_PATCH 0
-
typedef enum {
- CYGSERVER_UNKNOWN=0,
- CYGSERVER_OK=1,
- CYGSERVER_DEAD=2
+ CYGSERVER_UNKNOWN = 0,
+ CYGSERVER_OK,
+ CYGSERVER_UNAVAIL
} cygserver_states;
-typedef enum {
- CYGSERVER_REQUEST_INVALID = 0,
- CYGSERVER_REQUEST_GET_VERSION,
- CYGSERVER_REQUEST_ATTACH_TTY,
- CYGSERVER_REQUEST_SHUTDOWN,
- CYGSERVER_REQUEST_SHM_GET,
- CYGSERVER_REQUEST_LAST
-} cygserver_request_code;
-
-class request_header
-{
- public:
- ssize_t cb;
- cygserver_request_code req_id;
- ssize_t error_code;
- request_header (cygserver_request_code id, ssize_t ncb) : cb (ncb), req_id (id), error_code (0) {} ;
-}
-#ifdef __GNUC__
- __attribute__ ((packed))
-#endif
-;
+/*---------------------------------------------------------------------------*
+ * class client_request
+ *---------------------------------------------------------------------------*/
-extern void cygserver_init ();
-
-#define INIT_REQUEST(req,id) \
- (req).header.cb = sizeof (req); \
- (req).header.req_id = id;
+class transport_layer_base;
-struct request_get_version
-{
- DWORD major, api, minor, patch;
-}
-#ifdef __GNUC__
- __attribute__ ((packed))
+#ifndef __INSIDE_CYGWIN__
+class process_cache;
#endif
-;
-struct request_shutdown
+class client_request
{
- int foo;
-}
-#ifdef __GNUC__
- __attribute__ ((packed))
+protected:
+ typedef enum {
+ CYGSERVER_REQUEST_INVALID,
+ CYGSERVER_REQUEST_GET_VERSION,
+ CYGSERVER_REQUEST_SHUTDOWN,
+ CYGSERVER_REQUEST_ATTACH_TTY,
+ CYGSERVER_REQUEST_SHM,
+ CYGSERVER_REQUEST_LAST
+ } request_code_t;
+
+ struct header_t
+ {
+ size_t msglen;
+ union
+ {
+ request_code_t request_code;
+ ssize_t error_code;
+ };
+
+ header_t () {};
+ header_t (request_code_t, size_t);
+ } CYGSERVER_PACKED;
+
+public:
+#ifndef __INSIDE_CYGWIN__
+ static void handle_request (transport_layer_base *, process_cache *);
#endif
-;
-struct request_attach_tty
-{
- DWORD pid, master_pid;
- HANDLE from_master, to_master;
-}
-#ifdef __GNUC__
- __attribute__ ((packed))
-#endif
-;
+ client_request (request_code_t request_code,
+ void *buf = NULL,
+ size_t bufsiz = 0);
+ virtual ~client_request ();
+
+ request_code_t request_code () const { return _header.request_code; }
+
+ ssize_t error_code () const { return _header.error_code; };
+ void error_code (ssize_t error_code) { _header.error_code = error_code; };
+
+ size_t msglen () const { return _header.msglen; };
+ void msglen (size_t len) { _header.msglen = len; };
+
+ int make_request ();
+
+protected:
+ virtual void send (transport_layer_base *);
+
+private:
+ header_t _header;
+ void * const _buf;
+ const size_t _buflen;
-class client_request
-{
- public:
- client_request (cygserver_request_code id, ssize_t data_size);
- virtual void send (transport_layer_base *conn);
#ifndef __INSIDE_CYGWIN__
- virtual void serve (transport_layer_base *conn, class process_cache *cache);
+ void handle (transport_layer_base *, process_cache *);
+ virtual void serve (transport_layer_base *, process_cache *) = 0;
#endif
- virtual operator struct request_header ();
- cygserver_request_code req_id () {return header.req_id;};
- virtual ~client_request();
- request_header header;
- char *buffer;
};
+/*---------------------------------------------------------------------------*
+ * class client_request_get_version
+ *---------------------------------------------------------------------------*/
+
class client_request_get_version : public client_request
{
- public:
+private:
+ struct request_get_version
+ {
+ DWORD major, api, minor, patch;
+ } CYGSERVER_PACKED;
+
+public:
+ client_request_get_version ();
+ bool check_version () const;
+
+private:
+ struct request_get_version version;
+
#ifndef __INSIDE_CYGWIN__
- virtual void serve (transport_layer_base *conn, class process_cache *cache);
+ virtual void serve (transport_layer_base *, process_cache *);
#endif
- client_request_get_version::client_request_get_version();
- struct request_get_version version;
};
+/*---------------------------------------------------------------------------*
+ * class client_request_shutdown
+ *
+ * Nb. This whole class is only !__INSIDE_CYGWIN__ since it is used
+ * solely by cygserver itself.
+ *---------------------------------------------------------------------------*/
+
+#ifndef __INSIDE_CYGWIN__
+
class client_request_shutdown : public client_request
{
- public:
-#ifndef __INSIDE_CYGWIN__
- virtual void serve (transport_layer_base *conn, class process_cache *cache);
-#endif
+public:
client_request_shutdown ();
+
+private:
+ virtual void serve (transport_layer_base *, process_cache *);
};
+#endif /* !__INSIDE_CYGWIN__ */
+
+/*---------------------------------------------------------------------------*
+ * class client_request_attach_tty
+ *---------------------------------------------------------------------------*/
+
class client_request_attach_tty : public client_request
{
- public:
-#ifndef __INSIDE_CYGWIN__
- virtual void serve (transport_layer_base *conn, class process_cache *cache);
-#endif
+private:
+ struct request_attach_tty
+ {
+ DWORD pid, master_pid;
+ HANDLE from_master, to_master;
+ } CYGSERVER_PACKED;
+
+public:
+#ifdef __INSIDE_CYGWIN__
+ client_request_attach_tty (DWORD nmaster_pid,
+ HANDLE nfrom_master, HANDLE nto_master);
+#else
client_request_attach_tty ();
- client_request_attach_tty (DWORD npid, DWORD nmaster_pid, HANDLE nfrom_master, HANDLE nto_master);
- HANDLE from_master () {return req.from_master;};
- HANDLE to_master () {return req.to_master;};
+#endif
+
+ HANDLE from_master () const { return req.from_master; };
+ HANDLE to_master () const { return req.to_master; };
+
+protected:
+ virtual void send (transport_layer_base *);
+
+private:
struct request_attach_tty req;
+
+#ifndef __INSIDE_CYGWIN__
+ virtual void serve (transport_layer_base *, process_cache *);
+#endif
};
-extern int cygserver_request (client_request *);
+extern bool check_cygserver_available ();
+extern void cygserver_init ();
-#endif /* _CYGSERVER+H+ */
+#endif /* _CYGSERVER_H_ */
diff --git a/winsup/cygwin/include/cygwin/cygserver_process.h b/winsup/cygwin/include/cygwin/cygserver_process.h
index 4a49212b2..25c634e9e 100755
--- a/winsup/cygwin/include/cygwin/cygserver_process.h
+++ b/winsup/cygwin/include/cygwin/cygserver_process.h
@@ -1,84 +1,164 @@
/* cygserver_process.h
- Copyright 2001 Red Hat Inc.
+ Copyright 2001, 2002 Red Hat Inc.
Written by Robert Collins <rbtcollins@hotmail.com>
- This file is part of Cygwin.
+This file is part of Cygwin.
- This software is a copyrighted work licensed under the terms of the
- Cygwin license. Please consult the file "CYGWIN_LICENSE" for
- details. */
+This software is a copyrighted work licensed under the terms of the
+Cygwin license. Please consult the file "CYGWIN_LICENSE" for
+details. */
#ifndef _CYGSERVER_PROCESS_
#define _CYGSERVER_PROCESS_
-/* needs threaded_queue.h */
+#include <assert.h>
-class process_cleanup:public queue_request
+#include "threaded_queue.h"
+
+class process_cleanup : public queue_request
{
public:
+ process_cleanup (class process *const theprocess)
+ : _process (theprocess)
+ {
+ assert (_process);
+ }
+
+ virtual ~process_cleanup ();
+
virtual void process ();
- process_cleanup (class process *nprocess) : theprocess (nprocess) {};
+
private:
- class process * theprocess;
+ class process *const _process;
};
-class process_process_param:public queue_process_param
-{
- class process_cache *cache;
-public:
- DWORD request_loop ();
- process_process_param ():queue_process_param (true) {};
-};
+class process;
class cleanup_routine
{
+ friend class process;
+
public:
- cleanup_routine () : next (NULL) {};
- class cleanup_routine * next;
+ cleanup_routine (void *const key)
+ : _key (key),
+ _next (NULL)
+ {}
+
+ virtual ~cleanup_routine ();
+
+ bool operator== (const cleanup_routine &rhs) const
+ {
+ return _key == rhs._key;
+ }
+
+ void *key () const { return _key; }
+
/* MUST BE SYNCHRONOUS */
- virtual void cleanup (long winpid);
+ virtual void cleanup (class process *) = 0;
+
+private:
+ void *const _key;
+ cleanup_routine *_next;
};
+class process_cache;
+
class process
{
+ friend class process_cache;
+ friend class process_cleanup;
+
public:
- HANDLE handle ();
- long winpid;
- process (long);
+ process (pid_t cygpid, DWORD winpid);
~process ();
- DWORD exit_code ();
- class process * next;
- long refcount;
- bool add_cleanup_routine (class cleanup_routine *);
- void cleanup ();
+
+ pid_t cygpid () const { return _cygpid; }
+ DWORD winpid () const { return _winpid; }
+ HANDLE handle () const { return _hProcess; }
+
+ bool is_active () const { return _exit_status == STILL_ACTIVE; }
+
+ void hold () { EnterCriticalSection (&_access); }
+ void release () { LeaveCriticalSection (&_access); }
+
+ bool add (cleanup_routine *);
+ bool remove (const cleanup_routine *);
+
private:
+ const pid_t _cygpid;
+ const DWORD _winpid;
+ HANDLE _hProcess;
+ long _cleaning_up;
+ DWORD _exit_status; // Set in the constructor and in exit_code ().
+ cleanup_routine *_routines_head;
/* used to prevent races-on-delete */
- CRITICAL_SECTION access;
- volatile long cleaning_up;
- class cleanup_routine *head;
- HANDLE thehandle;
- DWORD _exit_status;
+ CRITICAL_SECTION _access;
+ class process *_next;
+
+ DWORD check_exit_code ();
+ void cleanup ();
};
-class process_cache:public threaded_queue
+class process_cache
{
+ // Number of special (i.e., non-process) handles in _wait_array.
+ // See wait_for_processes () and sync_wait_array () for details.
+ enum {
+ SPECIALS_COUNT = 2
+ };
+
+ class submission_loop : public queue_submission_loop
+ {
+ public:
+ submission_loop (process_cache *const cache, threaded_queue *const queue)
+ : queue_submission_loop (queue, true),
+ _cache (cache)
+ {
+ assert (_cache);
+ }
+
+ private:
+ process_cache *const _cache;
+
+ virtual void request_loop ();
+ };
+
+ friend class submission_loop;
+
public:
process_cache (unsigned int initial_workers);
- virtual ~ process_cache ();
- class process *process (long);
- /* remove a process from the cache */
- int handle_snapshot (HANDLE *, class process **, ssize_t, int);
- void remove_process (class process *);
- /* threaded_queue methods */
- void process_requests ();
- HANDLE cache_add_trigger;
+ ~process_cache ();
+
+ class process *process (pid_t cygpid, DWORD winpid);
+
+ bool running () const { return _queue.running (); }
+
+ bool start () { return _queue.start (); }
+ bool stop () { return _queue.stop (); }
private:
- virtual void add_task (class process *);
- class process *head;
- CRITICAL_SECTION cache_write_access;
+ threaded_queue _queue;
+ submission_loop _submitter;
+
+ size_t _processes_count;
+ class process *_processes_head; // A list sorted by winpid.
+
+ // Access to the _wait_array and related fields is not thread-safe,
+ // since they are used solely by wait_for_processes () and its callees.
+
+ HANDLE _wait_array[MAXIMUM_WAIT_OBJECTS];
+ class process *_process_array[MAXIMUM_WAIT_OBJECTS];
+
+ HANDLE _cache_add_trigger; // Actually both add and remove.
+ CRITICAL_SECTION _cache_write_access; // Actually both read and write access.
+
+ void wait_for_processes (HANDLE interrupt);
+ size_t sync_wait_array (HANDLE interrupt);
+ void check_and_remove_process (const size_t index);
+
+ class process *find (DWORD winpid, class process **previous = NULL);
};
#endif /* _CYGSERVER_PROCESS_ */
diff --git a/winsup/cygwin/include/cygwin/cygserver_transport.h b/winsup/cygwin/include/cygwin/cygserver_transport.h
index 1ed16edf7..915f35e66 100755
--- a/winsup/cygwin/include/cygwin/cygserver_transport.h
+++ b/winsup/cygwin/include/cygwin/cygserver_transport.h
@@ -1,32 +1,39 @@
-/* cygserver.cc
+/* cygserver_transport.h
- Copyright 2001 Red Hat Inc.
+ Copyright 2001, 2002 Red Hat Inc.
Written by Robert Collins <rbtcollins@hotmail.com>
- This file is part of Cygwin.
+This file is part of Cygwin.
- This software is a copyrighted work licensed under the terms of the
- Cygwin license. Please consult the file "CYGWIN_LICENSE" for
- details. */
+This software is a copyrighted work licensed under the terms of the
+Cygwin license. Please consult the file "CYGWIN_LICENSE" for
+details. */
#ifndef _CYGSERVER_TRANSPORT_
#define _CYGSERVER_TRANSPORT_
-class transport_layer_base *create_server_transport();
-/* the base class does nothing. */
+class transport_layer_base *create_server_transport ();
+
class transport_layer_base
{
- public:
- virtual void listen ();
- virtual class transport_layer_base * accept ();
- virtual void close ();
- virtual ssize_t read (char *buf, size_t len);
- virtual ssize_t write (char *buf, size_t len);
- virtual bool connect();
- virtual void impersonate_client ();
- virtual void revert_to_self ();
- transport_layer_base ();
+public:
+#ifndef __INSIDE_CYGWIN__
+ virtual int listen () = 0;
+ virtual class transport_layer_base *accept (bool *recoverable) = 0;
+#endif
+
+ virtual void close () = 0;
+ virtual ssize_t read (void *buf, size_t len) = 0;
+ virtual ssize_t write (void *buf, size_t len) = 0;
+ virtual int connect () = 0;
+
+#ifndef __INSIDE_CYGWIN__
+ virtual void impersonate_client ();
+ virtual void revert_to_self ();
+#endif
+
+ virtual ~transport_layer_base ();
};
#endif /* _CYGSERVER_TRANSPORT_ */
diff --git a/winsup/cygwin/include/cygwin/cygserver_transport_pipes.h b/winsup/cygwin/include/cygwin/cygserver_transport_pipes.h
index 9afeebfef..4bea2eb13 100755
--- a/winsup/cygwin/include/cygwin/cygserver_transport_pipes.h
+++ b/winsup/cygwin/include/cygwin/cygserver_transport_pipes.h
@@ -1,39 +1,53 @@
-/* cygserver.cc
+/* cygserver_transport_pipes.h
- Copyright 2001 Red Hat Inc.
+ Copyright 2001, 2002 Red Hat Inc.
Written by Robert Collins <rbtcollins@hotmail.com>
- This file is part of Cygwin.
+This file is part of Cygwin.
- This software is a copyrighted work licensed under the terms of the
- Cygwin license. Please consult the file "CYGWIN_LICENSE" for
- details. */
+This software is a copyrighted work licensed under the terms of the
+Cygwin license. Please consult the file "CYGWIN_LICENSE" for
+details. */
#ifndef _CYGSERVER_TRANSPORT_PIPES_
#define _CYGSERVER_TRANSPORT_PIPES_
+
/* Named pipes based transport, for security on NT */
class transport_layer_pipes : public transport_layer_base
{
- public:
- virtual void listen ();
- virtual class transport_layer_pipes * accept ();
- virtual void close ();
- virtual ssize_t read (char *buf, size_t len);
- virtual ssize_t write (char *buf, size_t len);
- virtual bool connect();
- virtual void impersonate_client ();
- virtual void revert_to_self ();
- transport_layer_pipes ();
-
- private:
- /* for pipe based communications */
- void init_security ();
- SECURITY_DESCRIPTOR sd;
- SECURITY_ATTRIBUTES sec_none_nih, sec_all_nih;
- char pipe_name [MAX_PATH];
- HANDLE pipe;
- bool inited;
- transport_layer_pipes (HANDLE new_pipe);
+public:
+#ifndef __INSIDE_CYGWIN__
+ virtual int listen ();
+ virtual class transport_layer_pipes *accept (bool *recoverable);
+#endif
+
+ virtual void close ();
+ virtual ssize_t read (void *buf, size_t len);
+ virtual ssize_t write (void *buf, size_t len);
+ virtual int connect ();
+
+#ifndef __INSIDE_CYGWIN__
+ virtual void impersonate_client ();
+ virtual void revert_to_self ();
+#endif
+
+ transport_layer_pipes ();
+ virtual ~transport_layer_pipes ();
+
+private:
+ /* for pipe based communications */
+ void init_security ();
+
+ //FIXME: allow inited, sd, all_nih_.. to be static members
+ SECURITY_DESCRIPTOR _sd;
+ SECURITY_ATTRIBUTES _sec_all_nih;
+ const char *const _pipe_name;
+ HANDLE _hPipe;
+ const bool _is_accepted_endpoint;
+ bool _is_listening_endpoint;
+
+ transport_layer_pipes (HANDLE hPipe);
};
+
#endif /* _CYGSERVER_TRANSPORT_PIPES_ */
diff --git a/winsup/cygwin/include/cygwin/cygserver_transport_sockets.h b/winsup/cygwin/include/cygwin/cygserver_transport_sockets.h
index 94dc43e38..d960f9c2c 100755
--- a/winsup/cygwin/include/cygwin/cygserver_transport_sockets.h
+++ b/winsup/cygwin/include/cygwin/cygserver_transport_sockets.h
@@ -1,33 +1,46 @@
-/* cygserver.cc
+/* cygserver_transport_sockets.h
- Copyright 2001 Red Hat Inc.
+ Copyright 2001, 2002 Red Hat Inc.
Written by Robert Collins <rbtcollins@hotmail.com>
- This file is part of Cygwin.
+This file is part of Cygwin.
- This software is a copyrighted work licensed under the terms of the
- Cygwin license. Please consult the file "CYGWIN_LICENSE" for
- details. */
+This software is a copyrighted work licensed under the terms of the
+Cygwin license. Please consult the file "CYGWIN_LICENSE" for
+details. */
#ifndef _CYGSERVER_TRANSPORT_SOCKETS_
#define _CYGSERVER_TRANSPORT_SOCKETS_
+
+#include <sys/socket.h>
+#include <sys/un.h>
+
class transport_layer_sockets : public transport_layer_base
{
- public:
- virtual void listen ();
- virtual class transport_layer_sockets * accept ();
- virtual void close ();
- virtual ssize_t read (char *buf, size_t len);
- virtual ssize_t write (char *buf, size_t len);
- virtual bool connect();
- transport_layer_sockets ();
-
- private:
- /* for socket based communications */
- int fd;
- struct sockaddr sockdetails;
- int sdlen;
- transport_layer_sockets (int newfd);
+public:
+#ifndef __INSIDE_CYGWIN__
+ virtual int listen ();
+ virtual class transport_layer_sockets *accept (bool *recoverable);
+#endif
+
+ virtual void close ();
+ virtual ssize_t read (void *buf, size_t len);
+ virtual ssize_t write (void *buf, size_t len);
+ virtual int connect ();
+
+ transport_layer_sockets ();
+ virtual ~transport_layer_sockets ();
+
+private:
+ /* for socket based communications */
+ int _fd;
+ struct sockaddr_un _addr;
+ socklen_t _addr_len;
+ const bool _is_accepted_endpoint;
+ bool _is_listening_endpoint;
+
+ transport_layer_sockets (int fd);
};
+
#endif /* _CYGSERVER_TRANSPORT_SOCKETS_ */
diff --git a/winsup/cygwin/include/cygwin/grp.h b/winsup/cygwin/include/cygwin/grp.h
new file mode 100644
index 000000000..7dcae637d
--- /dev/null
+++ b/winsup/cygwin/include/cygwin/grp.h
@@ -0,0 +1,48 @@
+/* cygwin/grp.h
+
+ Copyright 2002 Red Hat Inc.
+ Written by Corinna Vinschen <corinna@vinschen.de>
+
+This file is part of Cygwin.
+
+This software is a copyrighted work licensed under the terms of the
+Cygwin license. Please consult the file "CYGWIN_LICENSE" for
+details. */
+
+#ifndef _CYGWIN_GRP_H_
+#define _CYGWIN_GRP_H_
+
+#include <sys/types.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef __INSIDE_CYGWIN__
+struct __group16
+{
+ char *gr_name;
+ char *gr_passwd;
+ __gid16_t gr_gid;
+ char **gr_mem;
+};
+
+struct __group32
+{
+ char *gr_name;
+ char *gr_passwd;
+ __gid32_t gr_gid;
+ char **gr_mem;
+};
+
+struct __group32 * getgrgid32 (__gid32_t gid);
+struct __group32 * getgrnam32 (const char *name);
+__gid32_t getgid32 ();
+__gid32_t getegid32 ();
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _CYGWIN_GRP_H_ */
diff --git a/winsup/cygwin/include/cygwin/if.h b/winsup/cygwin/include/cygwin/if.h
index a743ed5ce..b0953de36 100644
--- a/winsup/cygwin/include/cygwin/if.h
+++ b/winsup/cygwin/include/cygwin/if.h
@@ -38,20 +38,20 @@ struct ifreq
{
#define IFNAMSIZ 16
#define IFHWADDRLEN 6
- union
- {
- char ifrn_name[IFNAMSIZ]; /* if name, e.g. "en0" */
- } ifr_ifrn;
-
- union {
- struct sockaddr ifru_addr;
- struct sockaddr ifru_broadaddr;
- struct sockaddr ifru_netmask;
- struct sockaddr ifru_hwaddr;
- short ifru_flags;
- int ifru_metric;
- int ifru_mtu;
- } ifr_ifru;
+ union
+ {
+ char ifrn_name[IFNAMSIZ]; /* if name, e.g. "en0" */
+ } ifr_ifrn;
+
+ union {
+ struct sockaddr ifru_addr;
+ struct sockaddr ifru_broadaddr;
+ struct sockaddr ifru_netmask;
+ struct sockaddr ifru_hwaddr;
+ short ifru_flags;
+ int ifru_metric;
+ int ifru_mtu;
+ } ifr_ifru;
};
#define ifr_name ifr_ifrn.ifrn_name /* interface name */
@@ -73,12 +73,12 @@ struct ifreq
struct ifconf
{
- int ifc_len; /* size of buffer */
- union
- {
- caddr_t ifcu_buf;
- struct ifreq *ifcu_req;
- } ifc_ifcu;
+ int ifc_len; /* size of buffer */
+ union
+ {
+ caddr_t ifcu_buf;
+ struct ifreq *ifcu_req;
+ } ifc_ifcu;
};
#define ifc_buf ifc_ifcu.ifcu_buf /* buffer address */
#define ifc_req ifc_ifcu.ifcu_req /* array of structures */
diff --git a/winsup/cygwin/include/cygwin/ip.h b/winsup/cygwin/include/cygwin/ip.h
deleted file mode 100644
index e4f23c753..000000000
--- a/winsup/cygwin/include/cygwin/ip.h
+++ /dev/null
@@ -1 +0,0 @@
-/* ip.h */
diff --git a/winsup/cygwin/include/cygwin/ipc.h b/winsup/cygwin/include/cygwin/ipc.h
new file mode 100644
index 000000000..8a88a1085
--- /dev/null
+++ b/winsup/cygwin/include/cygwin/ipc.h
@@ -0,0 +1,53 @@
+/* sys/ipc.h
+
+ Copyright 2001, 2002 Red Hat Inc.
+ Written by Robert Collins <rbtcollins@hotmail.com>
+
+This file is part of Cygwin.
+
+This software is a copyrighted work licensed under the terms of the
+Cygwin license. Please consult the file "CYGWIN_LICENSE" for
+details. */
+
+#ifndef _SYS_IPC_H
+#define _SYS_IPC_H
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+struct ipc_perm
+{
+ uid_t uid; /* Owner's user ID. */
+ gid_t gid; /* Owner's group ID. */
+ uid_t cuid; /* Creator's user ID. */
+ gid_t cgid; /* Creator's group ID. */
+ mode_t mode; /* Read/write permission. */
+ key_t key;
+};
+
+/* Mode bits:
+ */
+#define IPC_CREAT 0x0200 /* Create entry if key does not exist. */
+#define IPC_EXCL 0x0400 /* Fail if key exists. */
+#define IPC_NOWAIT 0x0800 /* Error if request must wait. */
+
+/* Keys:
+ */
+#define IPC_PRIVATE ((key_t) 0) /* Private key. */
+
+/* Control commands:
+ */
+#define IPC_RMID 0x1000 /* Remove identifier. */
+#define IPC_SET 0x1001 /* Set options. */
+#define IPC_STAT 0x1002 /* Get options. */
+#define IPC_INFO 0x1003 /* For ipcs(8). */
+
+key_t ftok (const char *path, int id);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _SYS_IPC_H */
diff --git a/winsup/cygwin/include/cygwin/msg.h b/winsup/cygwin/include/cygwin/msg.h
new file mode 100644
index 000000000..14e89f556
--- /dev/null
+++ b/winsup/cygwin/include/cygwin/msg.h
@@ -0,0 +1,92 @@
+/* sys/msg.h
+
+ Copyright 2002 Red Hat Inc.
+ Written by Conrad Scott <conrad.scott@dsl.pipex.com>
+
+This file is part of Cygwin.
+
+This software is a copyrighted work licensed under the terms of the
+Cygwin license. Please consult the file "CYGWIN_LICENSE" for
+details. */
+
+#ifndef _SYS_MSG_H
+#define _SYS_MSG_H
+
+#include <cygwin/ipc.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/* Message operation flags:
+ */
+#define MSG_NOERROR 0x01 /* No error if big message. */
+
+/* Command definitions for the semctl () function:
+ */
+#define MSG_STAT 0x2000 /* For ipcs(8) */
+#define MSG_INFO 0x2001 /* For ipcs(8) */
+
+/* Used for the number of messages in the message queue.
+ */
+typedef long int msgqnum_t;
+
+/* Used for the number of bytes allowed in a message queue.
+ */
+typedef long int msglen_t;
+
+struct msqid_ds
+{
+ struct ipc_perm msg_perm; /* Operation permission structure. */
+ msglen_t msg_cbytes; /* Number of bytes currently on queue. */
+ msgqnum_t msg_qnum; /* Number of messages currently on queue. */
+ msglen_t msg_qbytes; /* Maximum number of bytes allowed on queue. */
+ pid_t msg_lspid; /* Process ID of last msgsnd (). */
+ pid_t msg_lrpid; /* Process ID of last msgrcv (). */
+ timestruc_t msg_stim; /* Time of last msgsnd (). */
+ timestruc_t msg_rtim; /* Time of last msgrcv (). */
+ timestruc_t msg_ctim; /* Time of last change. */
+ long msg_spare4[2];
+};
+
+#define msg_stime msg_stim.tv_sec
+#define msg_rtime msg_rtim.tv_sec
+#define msg_ctime msg_ctim.tv_sec
+
+/* Buffer type for msgctl (IPC_INFO, ...) as used by ipcs(8).
+ */
+struct msginfo
+{
+ unsigned long msgpool; /* Maximum number of message bytes,
+ system wide. */
+ unsigned long msgmax; /* Maximum number of bytes per
+ message. */
+ unsigned long msgmnb; /* Maximum number of bytes on any one
+ message queue. */
+ unsigned long msgmni; /* Maximum number of message queues,
+ system wide. */
+ unsigned long msgtql; /* Maximum number of messages, system
+ wide. */
+ unsigned long msg_spare[4];
+};
+
+/* Buffer type for msgctl (MSG_INFO, ...) as used by ipcs(8).
+ */
+struct msg_info
+{
+ unsigned long msg_ids; /* Number of allocated queues. */
+ unsigned long msg_num; /* Number of messages, system wide. */
+ unsigned long msg_tot; /* Size in bytes of messages, system wide. */
+};
+
+int msgctl (int msqid, int cmd, struct msqid_ds *buf);
+int msgget (key_t key, int msgflg);
+ssize_t msgrcv (int msqid, void *msgp, size_t msgsz, long msgtyp, int msgflg);
+int msgsnd (int msqid, const void *msgp, size_t msgsz, int msgflg);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _SYS_MSG_H */
diff --git a/winsup/cygwin/include/cygwin/mtio.h b/winsup/cygwin/include/cygwin/mtio.h
index 213fc7dc0..04e65234c 100644
--- a/winsup/cygwin/include/cygwin/mtio.h
+++ b/winsup/cygwin/include/cygwin/mtio.h
@@ -20,6 +20,10 @@ details. */
#include <sys/ioctl.h>
#include <asm/socket.h>
+#ifndef DEFTAPE
+#define DEFTAPE "/dev/tape"
+#endif
+
/*
* Structures and definitions for mag tape io control commands
*/
@@ -85,7 +89,8 @@ struct mtget {
* Cygwin: remaining KB.
*/
/* the following registers are device dependent */
- long mt_dsreg; /* status register */
+ long mt_dsreg; /* status register, Cygwin returns current
+ blocksize here. */
long mt_gstat; /* generic (device independent) status */
long mt_erreg; /* error register */
/* The next two fields are not always used */
@@ -99,6 +104,7 @@ struct mtget {
int mt_defblksize;
unsigned long mt_featureslow;
unsigned long mt_featureshigh;
+ unsigned long mt_eotwarningzonesize;
};
/* structure for MTIOCPOS - mag tape get position command */
diff --git a/winsup/cygwin/include/cygwin/sem.h b/winsup/cygwin/include/cygwin/sem.h
new file mode 100644
index 000000000..a3ece9f8a
--- /dev/null
+++ b/winsup/cygwin/include/cygwin/sem.h
@@ -0,0 +1,95 @@
+/* sys/sem.h
+
+ Copyright 2002 Red Hat Inc.
+ Written by Conrad Scott <conrad.scott@dsl.pipex.com>
+
+This file is part of Cygwin.
+
+This software is a copyrighted work licensed under the terms of the
+Cygwin license. Please consult the file "CYGWIN_LICENSE" for
+details. */
+
+#ifndef _SYS_SEM_H
+#define _SYS_SEM_H
+
+#include <cygwin/ipc.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/* Semaphore operation flags:
+ */
+#define SEM_UNDO /* Set up adjust on exit entry. */
+
+/* Command definitions for the semctl () function:
+ */
+#define GETNCNT 0x3000 /* Get semncnt. */
+#define GETPID 0x3001 /* Get sempid. */
+#define GETVAL 0x3002 /* Get semval. */
+#define GETALL 0x3003 /* Get all cases of semval. */
+#define GETZCNT 0x3004 /* Get semzcnt. */
+#define SETVAL 0x3005 /* Set semval. */
+#define SETALL 0x3006 /* Set all cases of semval. */
+
+#define SEM_STAT 0x3010 /* For ipcs(8). */
+#define SEM_INFO 0x3011 /* For ipcs(8). */
+
+struct semid_ds
+{
+ struct ipc_perm sem_perm; /* Operation permission structure. */
+ unsigned short sem_nsems; /* Number of semaphores in set. */
+ timestruc_t sem_otim; /* Last semop () time. */
+ timestruc_t sem_ctim; /* Last time changed by semctl (). */
+ long sem_spare4[2];
+};
+
+#define sem_otime sem_otim.tv_sec
+#define sem_ctime sem_ctim.tv_sec
+
+struct sembuf
+{
+ unsigned short sem_num; /* Semaphore number. */
+ short sem_op; /* Semaphore operation. */
+ short sem_flg; /* Operation flags. */
+};
+
+/* Buffer type for semctl (IPC_INFO, ...) as used by ipcs(8).
+ */
+struct seminfo
+{
+ unsigned long semmni; /* Maximum number of unique semaphore
+ sets, system wide. */
+ unsigned long semmns; /* Maximum number of semaphores,
+ system wide. */
+ unsigned long semmsl; /* Maximum number of semaphores per
+ semaphore set. */
+ unsigned long semopm; /* Maximum number of operations per
+ semop call. */
+ unsigned long semmnu; /* Maximum number of undo structures,
+ system wide. */
+ unsigned long semume; /* Maximum number of undo entries per
+ undo structure. */
+ unsigned long semvmx; /* Maximum semaphore value. */
+ unsigned long semaem; /* Maximum adjust-on-exit value. */
+ unsigned long sem_spare[4];
+};
+
+/* Buffer type for semctl (SEM_INFO, ...) as used by ipcs(8).
+ */
+struct sem_info
+{
+ unsigned long sem_ids; /* Number of allocated semaphore sets. */
+ unsigned long sem_num; /* Number of allocated semaphores. */
+};
+
+int semctl (int semid, int semnum, int cmd, ...);
+int semget (key_t key, int nsems, int semflg);
+int semop (int semid, struct sembuf *sops, size_t nsops);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _SYS_SEM_H */
diff --git a/winsup/cygwin/include/cygwin/shm.h b/winsup/cygwin/include/cygwin/shm.h
new file mode 100644
index 000000000..b6b2d447c
--- /dev/null
+++ b/winsup/cygwin/include/cygwin/shm.h
@@ -0,0 +1,94 @@
+/* sys/shm.h
+
+ Copyright 2001, 2002 Red Hat Inc.
+ Written by Robert Collins <rbtcollins@hotmail.com>
+
+This file is part of Cygwin.
+
+This software is a copyrighted work licensed under the terms of the
+Cygwin license. Please consult the file "CYGWIN_LICENSE" for
+details. */
+
+#ifndef _SYS_SHM_H
+#define _SYS_SHM_H
+
+#include <cygwin/ipc.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/* 64 Kb was hardcoded for x86. MS states this may change, but we need
+ * it in the header file.
+ */
+#define SHMLBA 65536 /* Segment low boundary address multiple. */
+
+/* Shared memory operation flags:
+ */
+#define SHM_RDONLY 0x01 /* Attach read-only (else read-write). */
+#define SHM_RND 0x02 /* Round attach address to SHMLBA. */
+
+/* Command definitions for the semctl () function:
+ */
+#define SHM_STAT 0x4000 /* For ipcs(8) */
+#define SHM_INFO 0x4001 /* For ipcs(8) */
+
+/* Unsigned integer used for the number of current attaches.
+ */
+typedef unsigned int shmatt_t;
+
+struct shmid_ds
+{
+ struct ipc_perm shm_perm; /* Operation permission structure. */
+ size_t shm_segsz; /* Size of segment in bytes. */
+ pid_t shm_lpid; /* Process ID of last operation. */
+ pid_t shm_cpid; /* Process ID of creator. */
+ shmatt_t shm_nattch; /* Number of current attaches. */
+ timestruc_t shm_atim; /* Time of last shmat (). */
+ timestruc_t shm_dtim; /* Time of last shmdt (). */
+ timestruc_t shm_ctim; /* Time of last change by shmctl (). */
+ long shm_spare4[2];
+};
+
+#define shm_atime shm_atim.tv_sec
+#define shm_dtime shm_dtim.tv_sec
+#define shm_ctime shm_ctim.tv_sec
+
+/* Buffer type for shmctl (IPC_INFO, ...) as used by ipcs(8).
+ */
+struct shminfo
+{
+ unsigned long shmmax; /* Maximum size in bytes of a shared
+ memory segment. */
+ unsigned long shmmin; /* Minimum size in bytes of a shared
+ memory segment. */
+ unsigned long shmmni; /* Maximum number of shared memory
+ segments, system wide. */
+ unsigned long shmseg; /* Maximum number of shared memory
+ segments attached per process. */
+ unsigned long shmall; /* Maximum number of bytes of shared
+ memory, system wide. */
+ unsigned long shm_spare[4];
+};
+
+/* Buffer type for shmctl (SHM_INFO, ...) as used by ipcs(8).
+ */
+struct shm_info
+{
+ unsigned long shm_ids; /* Number of allocated segments. */
+ unsigned long shm_tot; /* Size in bytes of allocated segments. */
+ unsigned long shm_atts; /* Number of attached segments, system
+ wide. */
+};
+
+void *shmat (int shmid, const void *shmaddr, int shmflg);
+int shmctl (int shmid, int cmd, struct shmid_ds *buf);
+int shmdt (const void *shmaddr);
+int shmget (key_t key, size_t size, int shmflg);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _SYS_SHM_H */
diff --git a/winsup/cygwin/include/cygwin/socket.h b/winsup/cygwin/include/cygwin/socket.h
index da747fd3d..3a40c12a3 100644
--- a/winsup/cygwin/include/cygwin/socket.h
+++ b/winsup/cygwin/include/cygwin/socket.h
@@ -112,6 +112,8 @@ struct msghdr
#define MSG_OOB 0x1 /* process out-of-band data */
#define MSG_PEEK 0x2 /* peek at incoming message */
#define MSG_DONTROUTE 0x4 /* send without using routing tables */
+#define MSG_WINMASK 0x7 /* flags understood by WinSock calls */
+#define MSG_NOSIGNAL 0x20 /* Don't raise SIGPIPE */
/* Setsockoptions(2) level. Thanks to BSD these must match IPPROTO_xxx */
#define SOL_IP 0
@@ -123,9 +125,11 @@ struct msghdr
#define SOL_UDP 17
/* IP options */
+#ifndef IPTOS_LOWDELAY
#define IPTOS_LOWDELAY 0x10
#define IPTOS_THROUGHPUT 0x08
#define IPTOS_RELIABILITY 0x04
+#endif
/* These need to appear somewhere around here */
#define IP_DEFAULT_MULTICAST_TTL 1
@@ -148,8 +152,10 @@ struct msghdr
#define IPX_TYPE 1
/* TCP options - this way around because someone left a set in the c library includes */
+#ifndef TCP_NODELAY
#define TCP_NODELAY 0x0001
#define TCP_MAXSEG 2
+#endif
/* The various priorities. */
#define SOPRI_INTERACTIVE 0
diff --git a/winsup/cygwin/include/cygwin/stat.h b/winsup/cygwin/include/cygwin/stat.h
new file mode 100644
index 000000000..5772a3754
--- /dev/null
+++ b/winsup/cygwin/include/cygwin/stat.h
@@ -0,0 +1,88 @@
+/* cygwin/stat.h
+
+ Copyright 2002 Red Hat Inc.
+ Written by Corinna Vinschen <corinna@vinschen.de>
+
+This file is part of Cygwin.
+
+This software is a copyrighted work licensed under the terms of the
+Cygwin license. Please consult the file "CYGWIN_LICENSE" for
+details. */
+
+#ifndef _CYGWIN_STAT_H
+#define _CYGWIN_STAT_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef __INSIDE_CYGWIN__
+struct __stat32
+{
+ __dev16_t st_dev;
+ ino_t st_ino;
+ mode_t st_mode;
+ nlink_t st_nlink;
+ __uid16_t st_uid;
+ __gid16_t st_gid;
+ __dev16_t st_rdev;
+ __off32_t st_size;
+ timestruc_t st_atim;
+ timestruc_t st_mtim;
+ timestruc_t st_ctim;
+ blksize_t st_blksize;
+ __blkcnt32_t st_blocks;
+ long st_spare4[2];
+};
+
+struct __stat64
+{
+ __dev32_t st_dev;
+ ino_t st_ino;
+ mode_t st_mode;
+ nlink_t st_nlink;
+ __uid32_t st_uid;
+ __gid32_t st_gid;
+ __dev32_t st_rdev;
+ __off64_t st_size;
+ timestruc_t st_atim;
+ timestruc_t st_mtim;
+ timestruc_t st_ctim;
+ blksize_t st_blksize;
+ __blkcnt64_t st_blocks;
+ long st_spare4[2];
+};
+
+extern int fstat64 (int fd, struct __stat64 *buf);
+extern int stat64 (const char *file_name, struct __stat64 *buf);
+extern int lstat64 (const char *file_name, struct __stat64 *buf);
+
+#endif
+
+struct stat
+{
+ dev_t st_dev;
+ ino_t st_ino;
+ mode_t st_mode;
+ nlink_t st_nlink;
+ uid_t st_uid;
+ gid_t st_gid;
+ dev_t st_rdev;
+ off_t st_size;
+ timestruc_t st_atim;
+ timestruc_t st_mtim;
+ timestruc_t st_ctim;
+ blksize_t st_blksize;
+ blkcnt_t st_blocks;
+ long st_spare4[2];
+};
+
+#define st_atime st_atim.tv_sec
+#define st_mtime st_mtim.tv_sec
+#define st_ctime st_ctim.tv_sec
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _CYGWIN_STAT_H */
diff --git a/winsup/cygwin/include/cygwin/types.h b/winsup/cygwin/include/cygwin/types.h
index 7114b7c4a..69bfa2056 100644
--- a/winsup/cygwin/include/cygwin/types.h
+++ b/winsup/cygwin/include/cygwin/types.h
@@ -1,6 +1,6 @@
/* types.h
- Copyright 2001 Red Hat Inc.
+ Copyright 2001, 2002 Red Hat Inc.
Written by Robert Collins <rbtcollins@hotmail.com>
This file is part of Cygwin.
@@ -17,6 +17,48 @@ extern "C"
#ifndef _CYGWIN_TYPES_H
#define _CYGWIN_TYPES_H
+#include <sys/sysmacros.h>
+
+typedef struct timespec timespec_t, timestruc_t;
+
+typedef long __off32_t;
+typedef long long __off64_t;
+#ifdef __CYGWIN_USE_BIG_TYPES__
+typedef __off64_t off_t;
+#else
+typedef __off32_t off_t;
+#endif
+
+typedef short __dev16_t;
+typedef unsigned long __dev32_t;
+#ifdef __CYGWIN_USE_BIG_TYPES__
+typedef __dev32_t dev_t;
+#else
+typedef __dev16_t dev_t;
+#endif
+
+typedef long blksize_t;
+
+typedef long __blkcnt32_t;
+typedef long long __blkcnt64_t;
+#ifdef __CYGWIN_USE_BIG_TYPES__
+typedef __blkcnt64_t blkcnt_t;
+#else
+typedef __blkcnt32_t blkcnt_t;
+#endif
+
+typedef unsigned short __uid16_t;
+typedef unsigned short __gid16_t;
+typedef unsigned long __uid32_t;
+typedef unsigned long __gid32_t;
+#ifdef __CYGWIN_USE_BIG_TYPES__
+typedef __uid32_t uid_t;
+typedef __gid32_t gid_t;
+#else
+typedef __uid16_t uid_t;
+typedef __gid16_t gid_t;
+#endif
+
#if !defined(__INSIDE_CYGWIN__) || !defined(__cplusplus)
typedef void *pthread_t;
diff --git a/winsup/cygwin/include/cygwin/version.h b/winsup/cygwin/include/cygwin/version.h
index 65adf7c9a..da5591561 100644
--- a/winsup/cygwin/include/cygwin/version.h
+++ b/winsup/cygwin/include/cygwin/version.h
@@ -41,10 +41,10 @@ details. */
the Cygwin library". This version is used to track important
changes to the DLL and is mainly informative in nature. */
- /* The current cygwin version is 1.3.4 */
+ /* The current cygwin version is 1.3.6 */
#define CYGWIN_VERSION_DLL_MAJOR 1003
-#define CYGWIN_VERSION_DLL_MINOR 4
+#define CYGWIN_VERSION_DLL_MINOR 13
/* Major numbers before CYGWIN_VERSION_DLL_EPOCH are
incompatible. */
@@ -93,12 +93,12 @@ details. */
/* API_MAJOR 0.0: Initial version. API_MINOR changes:
1: Export cygwin32_ calls as cygwin_ as well.
2: Export j1, jn, y1, yn.
- 3: Export dll_noncygwin_dllcrt0.
- 4: New socket ioctls, revamped ifconf support.
- 5: Thread support/exports.
- 6: Change in termios handling.
- 7: Export scandir and alphasort.
- 8: Export _ctype_, _sys_errlist, _sys_nerr.
+ 3: Export dll_noncygwin_dllcrt0.
+ 4: New socket ioctls, revamped ifconf support.
+ 5: Thread support/exports.
+ 6: Change in termios handling.
+ 7: Export scandir and alphasort.
+ 8: Export _ctype_, _sys_errlist, _sys_nerr.
9: Mount-related changes, new cygwin_umount export.
Raw device support (tape, floppies).
10: Fast math routine support added.
@@ -114,10 +114,10 @@ details. */
20: regsub, inet_network
21: incompatible change to stdio cr/lf and buffering
22: Export cygwin_logon_user, cygwin_set_impersonation_token.
- geteuid, getegid return effective uid/gid.
- getuid, getgid return real uid/gid.
- seteuid, setegid set only effective uid/gid.
- setuid, setgid set effective and real uid/gid.
+ geteuid, getegid return effective uid/gid.
+ getuid, getgid return real uid/gid.
+ seteuid, setegid set only effective uid/gid.
+ setuid, setgid set effective and real uid/gid.
23: Export new dll_crt0 interface and cygwin_user_data for use
with crt0 startup code.
24: Export poll and _poll.
@@ -132,7 +132,7 @@ details. */
33: Export setlogmask
34: Separated out mount table
35: Export drand48, erand48, jrand48, lcong48, lrand48,
- mrand48, nrand48, seed48, and srand48.
+ mrand48, nrand48, seed48, and srand48.
36: Added _cygwin_S_IEXEC, et al
37: [f]pathconv support _PC_POSIX_PERMISSIONS and _PC_POSIX_SECURITY
38: vscanf, vscanf_r, and random pthread functions
@@ -144,10 +144,30 @@ details. */
44: Export dirfd
45: perprocess change, gamma_r, gammaf_r, lgamma_r, lgammaf_r
46: Remove cygwin_getshared
+ 47: Report EOTWarningZoneSize in struct mtget.
+ 48: Export "posix" regex functions
+ 49: Export setutent, endutent, utmpname, getutent, getutid, getutline.
+ 50: Export fnmatch.
+ 51: Export recvmsg, sendmsg.
+ 52: Export strptime
+ 53: Export strlcat, strlcpy.
+ 54: Export __fpclassifyd, __fpclassifyf, __signbitd, __signbitf.
+ 55: Export fcloseall, fcloseall_r.
+ 56: Make ntsec on by default.
+ 57: Export setgroups.
+ 58: Export memalign, valloc, malloc_trim, malloc_usable_size, mallopt,
+ malloc_stats
+ 59: getsid
+ 60: MSG_NOSIGNAL
+ 61: Export getc_unlocked, getchar_unlocked, putc_unlocked,
+ putchar_unlocked
+ 62: Erroneously bumped.
*/
+ /* Note that we forgot to bump the api for ualarm, strtoll, strtoull */
+
#define CYGWIN_VERSION_API_MAJOR 0
-#define CYGWIN_VERSION_API_MINOR 46
+#define CYGWIN_VERSION_API_MINOR 62
/* There is also a compatibity version number associated with the
shared memory regions. It is incremented when incompatible
@@ -212,3 +232,5 @@ details. */
cygwin_internal (CW_GETVERSIONINFO).
*/
+#define CYGWIN_VERSION_MAGIC(a, b) ((unsigned) (((unsigned short) a) | (unsigned short) b))
+#define CYGWIN_VERSION_MAGIC_VERSION(a) ((unsigned) ((unsigned)a & 0xffff))
diff --git a/winsup/cygwin/include/fnmatch.h b/winsup/cygwin/include/fnmatch.h
new file mode 100644
index 000000000..e4500abe2
--- /dev/null
+++ b/winsup/cygwin/include/fnmatch.h
@@ -0,0 +1,63 @@
+/* $OpenBSD: fnmatch.h,v 1.5 2000/03/24 17:13:23 millert Exp $ */
+/* $NetBSD: fnmatch.h,v 1.5 1994/10/26 00:55:53 cgd Exp $ */
+
+/*-
+ * Copyright (c) 1992, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * @(#)fnmatch.h 8.1 (Berkeley) 6/2/93
+ */
+
+#ifndef _FNMATCH_H_
+#define _FNMATCH_H_
+
+#define FNM_NOMATCH 1 /* Match failed. */
+#define FNM_NOSYS 2 /* Function not supported (unused). */
+
+#define FNM_NOESCAPE 0x01 /* Disable backslash escaping. */
+#define FNM_PATHNAME 0x02 /* Slash must be matched by slash. */
+#define FNM_PERIOD 0x04 /* Period must be matched by period. */
+#ifndef _POSIX_SOURCE
+#define FNM_LEADING_DIR 0x08 /* Ignore /<tail> after Imatch. */
+#define FNM_CASEFOLD 0x10 /* Case insensitive search. */
+#define FNM_IGNORECASE FNM_CASEFOLD
+#define FNM_FILE_NAME FNM_PATHNAME
+#endif
+
+#include <sys/cdefs.h>
+
+__BEGIN_DECLS
+int fnmatch __P((const char *, const char *, int));
+__END_DECLS
+
+#endif /* !_FNMATCH_H_ */
+
+
diff --git a/winsup/cygwin/include/getopt.h b/winsup/cygwin/include/getopt.h
index b05b32fdd..6b6f643b7 100644
--- a/winsup/cygwin/include/getopt.h
+++ b/winsup/cygwin/include/getopt.h
@@ -38,13 +38,6 @@
extern "C" {
#endif
-struct option {
- const char *name;
- int has_arg;
- int *flag;
- int val;
-};
-
extern int opterr; /* if error message should be printed */
extern int optind; /* index into parent argv vector */
extern int optopt; /* character checked for validity */
@@ -53,7 +46,31 @@ extern char *optarg; /* argument associated with option */
int getopt (int, char * const *, const char *);
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __GETOPT_H__ */
+
+#ifndef __UNISTD_GETOPT__
+#ifndef __GETOPT_LONG_H__
+#define __GETOPT_LONG_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct option {
+ const char *name;
+ int has_arg;
+ int *flag;
+ int val;
+};
+
int getopt_long (int, char *const *, const char *, const struct option *, int *);
+#ifndef HAVE_DECL_GETOPT
+#define HAVE_DECL_GETOPT 1
+#endif
#define no_argument 0
#define required_argument 1
@@ -63,4 +80,5 @@ int getopt_long (int, char *const *, const char *, const struct option *, int *)
}
#endif
-#endif /* __GETOPT_H__ */
+#endif /* __GETOPT_LONG_H__ */
+#endif /* __UNISTD_GETOPT__ */
diff --git a/winsup/cygwin/include/glob.h b/winsup/cygwin/include/glob.h
index 3fdf3e8ae..6a393f004 100644
--- a/winsup/cygwin/include/glob.h
+++ b/winsup/cygwin/include/glob.h
@@ -41,8 +41,6 @@
#ifndef _GLOB_H_
#define _GLOB_H_
-/* CYGNUS LOCAL: end */
-
#include <sys/cdefs.h>
#include <sys/types.h>
#include <sys/stat.h>
@@ -68,9 +66,14 @@ typedef struct {
int (*gl_lstat) __P((const char *, struct stat12 *));
int (*gl_stat) __P((const char *, struct stat12 *));
#else
+#if defined (__INSIDE_CYGWIN__)
+ int (*gl_lstat) ();
+ int (*gl_stat) ();
+#else
int (*gl_lstat) __P((const char *, struct stat *));
int (*gl_stat) __P((const char *, struct stat *));
#endif
+#endif
} glob_t;
#define GLOB_APPEND 0x0001 /* Append to output from previous call. */
@@ -93,7 +96,6 @@ typedef struct {
#define GLOB_ABEND (-2) /* Unignored error. */
__BEGIN_DECLS
-/* CYGNUS LOCAL: normal protos */
#undef DLLEXPORT
#ifdef __INSIDE_CYGWIN__
@@ -105,7 +107,6 @@ int DLLEXPORT glob(const char *, int, int (*)(const char *, int), glob_t *);
void DLLEXPORT globfree(glob_t *);
#undef DLLEXPORT
-/* end CYGNUS LOCAL */
__END_DECLS
#endif /* !_GLOB_H_ */
diff --git a/winsup/cygwin/include/limits.h b/winsup/cygwin/include/limits.h
index 715a49ac3..78c475170 100644
--- a/winsup/cygwin/include/limits.h
+++ b/winsup/cygwin/include/limits.h
@@ -88,11 +88,12 @@ details. */
#undef ULONG_MAX
#define ULONG_MAX (LONG_MAX * 2UL + 1)
-#if defined (__GNU_LIBRARY__) ? defined (__USE_GNU) : !defined (__STRICT_ANSI__)
/* Minimum and maximum values a `signed long long int' can hold. */
#ifndef __LONG_LONG_MAX__
#define __LONG_LONG_MAX__ 9223372036854775807LL
#endif
+
+#if defined (__GNU_LIBRARY__) ? defined (__USE_GNU) : !defined (__STRICT_ANSI__)
#undef LONG_LONG_MIN
#define LONG_LONG_MIN (-LONG_LONG_MAX-1)
#undef LONG_LONG_MAX
@@ -103,6 +104,18 @@ details. */
#define ULONG_LONG_MAX (LONG_LONG_MAX * 2ULL + 1)
#endif
+#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+/* Minimum and maximum values a `signed long long int' can hold. */
+#undef LLONG_MIN
+#define LLONG_MIN (-LLONG_MAX-1)
+#undef LLONG_MAX
+#define LLONG_MAX __LONG_LONG_MAX__
+
+/* Maximum value an `unsigned long long int' can hold. (Minimum is 0). */
+#undef ULLONG_MAX
+#define ULLONG_MAX (LLONG_MAX * 2ULL + 1)
+#endif
+
/* Maximum number of iovcnt in a writev */
#undef IOV_MAX
#define IOV_MAX (__INT_MAX__-1)
diff --git a/winsup/cygwin/include/netinet/ip.h b/winsup/cygwin/include/netinet/ip.h
index 33c59f87a..a8dac5b67 100644
--- a/winsup/cygwin/include/netinet/ip.h
+++ b/winsup/cygwin/include/netinet/ip.h
@@ -1,16 +1,199 @@
-/* netinet/ip.h
+/*
+ * Copyright (c) 1982, 1986, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * @(#)ip.h 8.2 (Berkeley) 6/1/94
+ * $FreeBSD: src/sys/netinet/ip.h,v 1.17 1999/12/22 19:13:20 shin Exp $
+ */
- Copyright 1998, 2001 Red Hat, Inc.
+#ifndef _NETINET_IP_H
+#define _NETINET_IP_H
-This file is part of Cygwin.
+/* Added by Wu Yongwei */
+#ifndef LITTLE_ENDIAN
+#define LITTLE_ENDIAN 1234
+#define BIG_ENDIAN 4321
+#endif
+#ifndef BYTE_ORDER
+#define BYTE_ORDER LITTLE_ENDIAN
+#endif
-This software is a copyrighted work licensed under the terms of the
-Cygwin license. Please consult the file "CYGWIN_LICENSE" for
-details. */
+/*
+ * Definitions for internet protocol version 4.
+ * Per RFC 791, September 1981.
+ */
+#define IPVERSION 4
-#ifndef _NETINET_IP_H
-#define _NETINET_IP_H
+/*
+ * Structure of an internet header, naked of options.
+ */
+struct ip {
+#ifdef _IP_VHL
+ u_char ip_vhl; /* version << 4 | header length >> 2 */
+#else
+#if BYTE_ORDER == LITTLE_ENDIAN
+ u_int ip_hl:4, /* header length */
+ ip_v:4; /* version */
+#endif
+#if BYTE_ORDER == BIG_ENDIAN
+ u_int ip_v:4, /* version */
+ ip_hl:4; /* header length */
+#endif
+#endif /* not _IP_VHL */
+ u_char ip_tos; /* type of service */
+ u_short ip_len; /* total length */
+ u_short ip_id; /* identification */
+ u_short ip_off; /* fragment offset field */
+#define IP_RF 0x8000 /* reserved fragment flag */
+#define IP_DF 0x4000 /* dont fragment flag */
+#define IP_MF 0x2000 /* more fragments flag */
+#define IP_OFFMASK 0x1fff /* mask for fragmenting bits */
+ u_char ip_ttl; /* time to live */
+ u_char ip_p; /* protocol */
+ u_short ip_sum; /* checksum */
+ struct in_addr ip_src,ip_dst; /* source and dest address */
+};
+
+#ifdef _IP_VHL
+#define IP_MAKE_VHL(v, hl) ((v) << 4 | (hl))
+#define IP_VHL_HL(vhl) ((vhl) & 0x0f)
+#define IP_VHL_V(vhl) ((vhl) >> 4)
+#define IP_VHL_BORING 0x45
+#endif
+
+#define IP_MAXPACKET 65535 /* maximum packet size */
+
+/*
+ * Definitions for IP type of service (ip_tos)
+ */
+#ifndef IPTOS_LOWDELAY
+#define IPTOS_LOWDELAY 0x10
+#define IPTOS_THROUGHPUT 0x08
+#define IPTOS_RELIABILITY 0x04
+#endif
+#define IPTOS_MINCOST 0x02
+/* ECN bits proposed by Sally Floyd */
+#define IPTOS_CE 0x01 /* congestion experienced */
+#define IPTOS_ECT 0x02 /* ECN-capable transport */
+
+
+/*
+ * Definitions for IP precedence (also in ip_tos) (hopefully unused)
+ */
+#define IPTOS_PREC_NETCONTROL 0xe0
+#define IPTOS_PREC_INTERNETCONTROL 0xc0
+#define IPTOS_PREC_CRITIC_ECP 0xa0
+#define IPTOS_PREC_FLASHOVERRIDE 0x80
+#define IPTOS_PREC_FLASH 0x60
+#define IPTOS_PREC_IMMEDIATE 0x40
+#define IPTOS_PREC_PRIORITY 0x20
+#define IPTOS_PREC_ROUTINE 0x00
+
+/*
+ * Definitions for options.
+ */
+#define IPOPT_COPIED(o) ((o)&0x80)
+#define IPOPT_CLASS(o) ((o)&0x60)
+#define IPOPT_NUMBER(o) ((o)&0x1f)
+
+#define IPOPT_CONTROL 0x00
+#define IPOPT_RESERVED1 0x20
+#define IPOPT_DEBMEAS 0x40
+#define IPOPT_RESERVED2 0x60
+
+#define IPOPT_EOL 0 /* end of option list */
+#define IPOPT_NOP 1 /* no operation */
+
+#define IPOPT_RR 7 /* record packet route */
+#define IPOPT_TS 68 /* timestamp */
+#define IPOPT_SECURITY 130 /* provide s,c,h,tcc */
+#define IPOPT_LSRR 131 /* loose source route */
+#define IPOPT_SATID 136 /* satnet id */
+#define IPOPT_SSRR 137 /* strict source route */
+#define IPOPT_RA 148 /* router alert */
+
+/*
+ * Offsets to fields in options other than EOL and NOP.
+ */
+#define IPOPT_OPTVAL 0 /* option ID */
+#define IPOPT_OLEN 1 /* option length */
+#define IPOPT_OFFSET 2 /* offset within option */
+#define IPOPT_MINOFF 4 /* min value of above */
+
+/*
+ * Time stamp option structure.
+ */
+struct ip_timestamp {
+ u_char ipt_code; /* IPOPT_TS */
+ u_char ipt_len; /* size of structure (variable) */
+ u_char ipt_ptr; /* index of current entry */
+#if BYTE_ORDER == LITTLE_ENDIAN
+ u_int ipt_flg:4, /* flags, see below */
+ ipt_oflw:4; /* overflow counter */
+#endif
+#if BYTE_ORDER == BIG_ENDIAN
+ u_int ipt_oflw:4, /* overflow counter */
+ ipt_flg:4; /* flags, see below */
+#endif
+ union ipt_timestamp {
+ n_long ipt_time[1];
+ struct ipt_ta {
+ struct in_addr ipt_addr;
+ n_long ipt_time;
+ } ipt_ta[1];
+ } ipt_timestamp;
+};
+
+/* flag bits for ipt_flg */
+#define IPOPT_TS_TSONLY 0 /* timestamps only */
+#define IPOPT_TS_TSANDADDR 1 /* timestamps and addresses */
+#define IPOPT_TS_PRESPEC 3 /* specified modules only */
+
+/* bits for security (not byte swapped) */
+#define IPOPT_SECUR_UNCLASS 0x0000
+#define IPOPT_SECUR_CONFID 0xf135
+#define IPOPT_SECUR_EFTO 0x789a
+#define IPOPT_SECUR_MMMM 0xbc4d
+#define IPOPT_SECUR_RESTR 0xaf13
+#define IPOPT_SECUR_SECRET 0xd788
+#define IPOPT_SECUR_TOPSECRET 0x6bc5
+
+/*
+ * Internet implementation parameters.
+ */
+#define MAXTTL 255 /* maximum time to live (seconds) */
+#define IPDEFTTL 64 /* default ttl, from RFC 1340 */
+#define IPFRAGTTL 60 /* time to live for frags, slowhz */
+#define IPTTLDEC 1 /* subtracted when forwarding */
-#include <cygwin/ip.h>
+#define IP_MSS 576 /* default maximum segment size */
-#endif /* _NETINET_IP_H */
+#endif
diff --git a/winsup/cygwin/include/netinet/tcp.h b/winsup/cygwin/include/netinet/tcp.h
index eef9a6116..9fcee6c71 100644
--- a/winsup/cygwin/include/netinet/tcp.h
+++ b/winsup/cygwin/include/netinet/tcp.h
@@ -1,16 +1,144 @@
-/* netinet/tcp.h
+/*
+ * Copyright (c) 1982, 1986, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * @(#)tcp.h 8.1 (Berkeley) 6/10/93
+ * $FreeBSD: src/sys/netinet/tcp.h,v 1.13 2000/01/09 19:17:25 shin Exp $
+ */
- Copyright 2000, 2001 Red Hat, Inc.
+#ifndef _NETINET_TCP_H
+#define _NETINET_TCP_H
-This file is part of Cygwin.
+/* Added by Wu Yongwei */
+#ifndef LITTLE_ENDIAN
+#define LITTLE_ENDIAN 1234
+#define BIG_ENDIAN 4321
+#endif
+#ifndef BYTE_ORDER
+#define BYTE_ORDER LITTLE_ENDIAN
+#endif
-This software is a copyrighted work licensed under the terms of the
-Cygwin license. Please consult the file "CYGWIN_LICENSE" for
-details. */
+typedef u_int32_t tcp_seq;
+typedef u_int32_t tcp_cc; /* connection count per rfc1644 */
-#ifndef _NETINET_TCP_H
-#define _NETINET_TCP_H
+#define tcp6_seq tcp_seq /* for KAME src sync over BSD*'s */
+#define tcp6hdr tcphdr /* for KAME src sync over BSD*'s */
+
+/*
+ * TCP header.
+ * Per RFC 793, September, 1981.
+ */
+struct tcphdr {
+ u_short th_sport; /* source port */
+ u_short th_dport; /* destination port */
+ tcp_seq th_seq; /* sequence number */
+ tcp_seq th_ack; /* acknowledgement number */
+#if BYTE_ORDER == LITTLE_ENDIAN
+ u_int th_x2:4, /* (unused) */
+ th_off:4; /* data offset */
+#endif
+#if BYTE_ORDER == BIG_ENDIAN
+ u_int th_off:4, /* data offset */
+ th_x2:4; /* (unused) */
+#endif
+ u_char th_flags;
+#define TH_FIN 0x01
+#define TH_SYN 0x02
+#define TH_RST 0x04
+#define TH_PUSH 0x08
+#define TH_ACK 0x10
+#define TH_URG 0x20
+#define TH_FLAGS (TH_FIN|TH_SYN|TH_RST|TH_ACK|TH_URG)
-/* Maybe add some definitions, someday */
+ u_short th_win; /* window */
+ u_short th_sum; /* checksum */
+ u_short th_urp; /* urgent pointer */
+};
+
+#define TCPOPT_EOL 0
+#define TCPOPT_NOP 1
+#define TCPOPT_MAXSEG 2
+#define TCPOLEN_MAXSEG 4
+#define TCPOPT_WINDOW 3
+#define TCPOLEN_WINDOW 3
+#define TCPOPT_SACK_PERMITTED 4 /* Experimental */
+#define TCPOLEN_SACK_PERMITTED 2
+#define TCPOPT_SACK 5 /* Experimental */
+#define TCPOPT_TIMESTAMP 8
+#define TCPOLEN_TIMESTAMP 10
+#define TCPOLEN_TSTAMP_APPA (TCPOLEN_TIMESTAMP+2) /* appendix A */
+#define TCPOPT_TSTAMP_HDR \
+ (TCPOPT_NOP<<24|TCPOPT_NOP<<16|TCPOPT_TIMESTAMP<<8|TCPOLEN_TIMESTAMP)
+
+#define TCPOPT_CC 11 /* CC options: RFC-1644 */
+#define TCPOPT_CCNEW 12
+#define TCPOPT_CCECHO 13
+#define TCPOLEN_CC 6
+#define TCPOLEN_CC_APPA (TCPOLEN_CC+2)
+#define TCPOPT_CC_HDR(ccopt) \
+ (TCPOPT_NOP<<24|TCPOPT_NOP<<16|(ccopt)<<8|TCPOLEN_CC)
+
+/*
+ * Default maximum segment size for TCP.
+ * With an IP MSS of 576, this is 536,
+ * but 512 is probably more convenient.
+ * This should be defined as MIN(512, IP_MSS - sizeof (struct tcpiphdr)).
+ */
+#define TCP_MSS 512
+
+/*
+ * Default maximum segment size for TCP6.
+ * With an IP6 MSS of 1280, this is 1220,
+ * but 1024 is probably more convenient. (xxx kazu in doubt)
+ * This should be defined as MIN(1024, IP6_MSS - sizeof (struct tcpip6hdr))
+ */
+#define TCP6_MSS 1024
+
+#define TCP_MAXWIN 65535 /* largest value for (unscaled) window */
+#define TTCP_CLIENT_SND_WND 4096 /* dflt send window for T/TCP client */
+
+#define TCP_MAX_WINSHIFT 14 /* maximum window shift */
+
+#define TCP_MAXHLEN (0xf<<2) /* max length of header in bytes */
+#define TCP_MAXOLEN (TCP_MAXHLEN - sizeof(struct tcphdr))
+ /* max space left for options */
+
+/*
+ * User-settable options (used with setsockopt).
+ */
+#ifndef TCP_NODELAY
+#define TCP_NODELAY 0x01 /* don't delay send to coalesce packets */
+#define TCP_MAXSEG 0x02 /* set maximum segment size */
+#endif
+#define TCP_NOPUSH 0x04 /* don't push last block of write */
+#define TCP_NOOPT 0x08 /* don't use TCP options */
#endif
diff --git a/winsup/cygwin/include/netinet/udp.h b/winsup/cygwin/include/netinet/udp.h
new file mode 100644
index 000000000..61932720b
--- /dev/null
+++ b/winsup/cygwin/include/netinet/udp.h
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 1982, 1986, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * @(#)udp.h 8.1 (Berkeley) 6/10/93
+ * $FreeBSD: src/sys/netinet/udp.h,v 1.7 1999/08/28 00:49:34 peter Exp $
+ */
+
+#ifndef _NETINET_UDP_H
+#define _NETINET_UDP_H
+
+/*
+ * Udp protocol header.
+ * Per RFC 768, September, 1981.
+ */
+struct udphdr {
+ u_short uh_sport; /* source port */
+ u_short uh_dport; /* destination port */
+ u_short uh_ulen; /* udp length */
+ u_short uh_sum; /* udp checksum */
+};
+
+#endif
diff --git a/winsup/cygwin/include/pthread.h b/winsup/cygwin/include/pthread.h
index 486635da7..96aa4deea 100644
--- a/winsup/cygwin/include/pthread.h
+++ b/winsup/cygwin/include/pthread.h
@@ -42,8 +42,9 @@ extern "C"
#define PTHREAD_CANCEL_ENABLE 0
#define PTHREAD_CANCEL_DEFERRED 0
#define PTHREAD_CANCEL_DISABLE 1
-#define PTHREAD_CANCELED
-#define PTHREAD_COND_INITIALIZER
+#define PTHREAD_CANCELED ((void *)-1)
+/* this should be a value that can never be a valid address */
+#define PTHREAD_COND_INITIALIZER (void *)21
#define PTHREAD_CREATE_DETACHED 1
/* the default : joinable */
#define PTHREAD_CREATE_JOINABLE 0
@@ -83,7 +84,7 @@ int pthread_attr_setscope (pthread_attr_t *, int);
#ifdef _POSIX_THREAD_ATTR_STACKADDR
/* These functions may be implementable via some low level trickery. For now they are
- * Not supported or implemented. The prototypes are here so if someone greps the
+ * Not supported or implemented. The prototypes are here so if someone greps the
* source they will see these comments
*/
int pthread_attr_getstackaddr (const pthread_attr_t *, void **);
@@ -96,16 +97,26 @@ int pthread_attr_setstacksize (pthread_attr_t *, size_t);
#endif
int pthread_cancel (pthread_t);
-/* Macros for cleanup_push and pop;
+/* Macros for cleanup_push and pop;
* The function definitions are
void pthread_cleanup_push (void (*routine)(void*), void *arg);
void pthread_cleanup_pop (int execute);
*/
typedef void (*__cleanup_routine_type) (void *);
-
-#define pthread_cleanup_push(fn, arg) { __cleanup_routine_type __cleanup_routine=fn; \
-void *__cleanup_param=arg;
-#define pthread_cleanup_pop(execute) if (execute) __cleanup_routine(__cleanup_param); }
+typedef struct _pthread_cleanup_handler
+{
+ __cleanup_routine_type function;
+ void *arg;
+ struct _pthread_cleanup_handler *next;
+} __pthread_cleanup_handler;
+
+void _pthread_cleanup_push (__pthread_cleanup_handler *handler);
+void _pthread_cleanup_pop (int execute);
+
+#define pthread_cleanup_push(_fn, _arg) { __pthread_cleanup_handler __cleanup_handler = \
+ { _fn, _arg, NULL }; \
+ _pthread_cleanup_push( &__cleanup_handler );
+#define pthread_cleanup_pop(_execute) _pthread_cleanup_pop( _execute ); }
/* Condition variables */
int pthread_cond_broadcast (pthread_cond_t *);
diff --git a/winsup/cygwin/include/sys/cygwin.h b/winsup/cygwin/include/sys/cygwin.h
index 1d53f636b..f8feda4c7 100644
--- a/winsup/cygwin/include/sys/cygwin.h
+++ b/winsup/cygwin/include/sys/cygwin.h
@@ -1,6 +1,6 @@
/* sys/cygwin.h
- Copyright 1997, 1998, 2000, 2001 Red Hat, Inc.
+ Copyright 1997, 1998, 2000, 2001, 2002 Red Hat, Inc.
This file is part of Cygwin.
@@ -64,7 +64,13 @@ typedef enum
CW_GET_CYGDRIVE_PREFIXES,
CW_GETPINFO_FULL,
CW_INIT_EXCEPTIONS,
- CW_GET_CYGDRIVE_INFO
+ CW_GET_CYGDRIVE_INFO,
+ CW_SET_CYGWIN_REGISTRY_NAME,
+ CW_GET_CYGWIN_REGISTRY_NAME,
+ CW_STRACE_TOGGLE,
+ CW_STRACE_ACTIVE,
+ CW_CYGWIN_PID_TO_WINPID,
+ CW_EXTRACT_DOMAIN_AND_USER
} cygwin_getinfo_types;
#define CW_NEXTPID 0x80000000 // or with pid to get next one
@@ -89,7 +95,7 @@ enum
PID_USETTY = 0x1000, // Setting this enables or disables cygwin's
// tty support. This is inherited by
// all execed or forked processes.
- PID_UNUSED2 = 0x2000, // child has execed
+ PID_ALLPIDS = 0x2000, // child has execed
PID_EXECED = 0x4000, // redirect to original pid info block
PID_NOREDIR = 0x8000, // don't redirect if execed
PID_EXITED = 0x80000000 // Free entry.
@@ -203,14 +209,25 @@ extern int cygwin_attach_handle_to_fd (char *, int, HANDLE, mode_t, DWORD);
#define TTY_CONSOLE 0x40000000
+#define EXTERNAL_PINFO_VERSION_16_BIT 0
+#define EXTERNAL_PINFO_VERSION_32_BIT 1
+#define EXTERNAL_PINFO_VERSION EXTERNAL_PINFO_VERSION_32_BIT
+
+#ifndef _SYS_TYPES_H
+typedef unsigned short __uid16_t;
+typedef unsigned short __gid16_t;
+typedef unsigned long __uid32_t;
+typedef unsigned long __gid32_t;
+#endif
+
struct external_pinfo
{
pid_t pid;
pid_t ppid;
HANDLE hProcess;
DWORD dwProcessId, dwSpawnedProcessId;
- uid_t uid;
- gid_t gid;
+ __uid16_t uid;
+ __gid16_t gid;
pid_t pgid;
pid_t sid;
int ctty;
@@ -223,9 +240,13 @@ struct external_pinfo
char progname[MAX_PATH];
DWORD strace_mask;
- HANDLE strace_file;
+ DWORD version;
DWORD process_state;
+
+ /* Only available if version >= EXTERNAL_PINFO_VERSION_32_BIT */
+ __uid32_t uid32;
+ __gid32_t gid32;
};
DWORD cygwin_internal (cygwin_getinfo_types, ...);
diff --git a/winsup/cygwin/include/sys/ioctl.h b/winsup/cygwin/include/sys/ioctl.h
index 93f73a69c..fd9515fb1 100644
--- a/winsup/cygwin/include/sys/ioctl.h
+++ b/winsup/cygwin/include/sys/ioctl.h
@@ -1,6 +1,6 @@
/* sys/ioctl.h
- Copyright 1998, 2001 Red Hat, Inc.
+ Copyright 1998, 2001, 2002 Red Hat, Inc.
This file is part of Cygwin.
@@ -23,7 +23,7 @@ details. */
__BEGIN_DECLS
-int ioctl (int __fd, int __cmd, void *);
+int ioctl (int __fd, int __cmd, ...);
__END_DECLS
diff --git a/winsup/cygwin/include/sys/ipc.h b/winsup/cygwin/include/sys/ipc.h
deleted file mode 100644
index 8ddec6d50..000000000
--- a/winsup/cygwin/include/sys/ipc.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/* sys/ipc.h
-
- Copyright 2001 Red Hat Inc.
- Written by Robert Collins <rbtcollins@hotmail.com>
-
-This file is part of Cygwin.
-
-This software is a copyrighted work licensed under the terms of the
-Cygwin license. Please consult the file "CYGWIN_LICENSE" for
-details. */
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-#ifndef _SYS_IPC_H
-#define _SYS_IPC_H
-
-/* sys/types must be included before sys/ipc.h. We aren't meant to automatically
- * include it however
- */
-
-struct ipc_perm {
- uid_t uid;
- gid_t gid;
- uid_t cuid;
- gid_t cgid;
- mode_t mode;
-};
-
-/* the mode flags used with the _get functions use the low order 9 bits for a mode
- * request
- */
-#define IPC_CREAT 0x0200
-#define IPC_EXCL 0x0400
-#define IPC_NOWAIT 0x0800
-
-/* this is a value that will _never_ be a valid key from ftok */
-#define IPC_PRIVATE -2
-
-#define IPC_RMID 0x0003
-#define IPC_SET 0x0002
-#define IPC_STAT 0x0001
-
-key_t ftok(const char *, int);
-
-#endif /* _SYS_IPC_H */
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/winsup/cygwin/include/sys/mount.h b/winsup/cygwin/include/sys/mount.h
index 00b7a0137..26e02cba2 100644
--- a/winsup/cygwin/include/sys/mount.h
+++ b/winsup/cygwin/include/sys/mount.h
@@ -21,10 +21,14 @@ enum
MOUNT_BINARY = 0x002, /* "binary" format read/writes */
MOUNT_SYSTEM = 0x008, /* mount point came from system table */
MOUNT_EXEC = 0x010, /* Any file in the mounted directory gets 'x' bit */
- MOUNT_AUTO = 0x020, /* mount point refers to auto device mount */
+ MOUNT_CYGDRIVE = 0x020, /* mount point refers to cygdriv device mount */
MOUNT_CYGWIN_EXEC = 0x040, /* file or directory is or contains a cygwin
executable */
- MOUNT_MIXED = 0x080, /* reads are text, writes are binary */
+ MOUNT_MIXED = 0x080, /* reads are text, writes are binary
+ not yet implemented */
+ MOUNT_NOTEXEC = 0x100, /* don't check files for executable magic */
+ MOUNT_DEVFS = 0x200, /* /device "filesystem" */
+ MOUNT_PROC = 0x400 /* /proc "filesystem" */
};
int mount (const char *, const char *, unsigned __flags);
diff --git a/winsup/cygwin/include/sys/resource.h b/winsup/cygwin/include/sys/resource.h
index c68a206e1..c1fe544a9 100644
--- a/winsup/cygwin/include/sys/resource.h
+++ b/winsup/cygwin/include/sys/resource.h
@@ -50,16 +50,16 @@ struct rusage {
long ru_ixrss; /* XXX: 0 */
long ru_idrss; /* XXX: sum of rm_asrss */
long ru_isrss; /* XXX: 0 */
- long ru_minflt; /* any page faults not requiring I/O */
- long ru_majflt; /* any page faults requiring I/O */
- long ru_nswap; /* swaps */
- long ru_inblock; /* block input operations */
- long ru_oublock; /* block output operations */
- long ru_msgsnd; /* messages sent */
- long ru_msgrcv; /* messages received */
- long ru_nsignals; /* signals received */
- long ru_nvcsw; /* voluntary context switches */
- long ru_nivcsw; /* involuntary " */
+ long ru_minflt; /* any page faults not requiring I/O */
+ long ru_majflt; /* any page faults requiring I/O */
+ long ru_nswap; /* swaps */
+ long ru_inblock; /* block input operations */
+ long ru_oublock; /* block output operations */
+ long ru_msgsnd; /* messages sent */
+ long ru_msgrcv; /* messages received */
+ long ru_nsignals; /* signals received */
+ long ru_nvcsw; /* voluntary context switches */
+ long ru_nivcsw; /* involuntary " */
#define ru_last ru_nivcsw
};
diff --git a/winsup/cygwin/include/sys/shm.h b/winsup/cygwin/include/sys/shm.h
deleted file mode 100644
index 208c5f29f..000000000
--- a/winsup/cygwin/include/sys/shm.h
+++ /dev/null
@@ -1,89 +0,0 @@
-/* sys/shm.h
-
- Copyright 2001 Red Hat Inc.
- Written by Robert Collins <rbtcollins@hotmail.com>
-
-This file is part of Cygwin.
-
-This software is a copyrighted work licensed under the terms of the
-Cygwin license. Please consult the file "CYGWIN_LICENSE" for
-details. */
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-#ifndef _SYS_SHM_H
-#define _SYS_SHM_H
-
-#include <sys/ipc.h>
-
-#define SHM_RDONLY 1
-/* 64 Kb was hardcoded for x86. MS states this may change, but we need it in the header
- * file.
- */
-#define SHMLBA 65536
-#define SHM_RND 1
-
-typedef long int shmatt_t;
-
-#if defined(__INSIDE_CYGWIN__) && defined(__cplusplus)
-
-class _shmattach {
-public:
- void *data;
- int shmflg;
- class _shmattach *next;
-};
-
-class shmid_ds {
-public:
- struct ipc_perm shm_perm;
- size_t shm_segsz;
- pid_t shm_lpid;
- pid_t shm_cpid;
- shmatt_t shm_nattch;
- time_t shm_atime;
- time_t shm_dtime;
- time_t shm_ctime;
- void *mapptr;
-};
-
-class shmnode {
-public:
- class shmid_ds * shmds;
- int shm_id;
- class shmnode *next;
- key_t key;
- HANDLE filemap;
- HANDLE attachmap;
- class _shmattach *attachhead;
-};
-
-#else
-/* this is what we return when queried. It has no bitwise correspondence
- * the internal structures
- */
-struct shmid_ds {
- struct ipc_perm shm_perm;
- size_t shm_segsz;
- pid_t shm_lpid;
- pid_t shm_cpid;
- shmatt_t shm_nattch;
- time_t shm_atime;
- time_t shm_dtime;
- time_t shm_ctime;
-};
-#endif /* __INSIDE_CYGWIN__ */
-
-void *shmat(int, const void *, int);
-int shmctl(int, int, struct shmid_ds *);
-int shmdt(const void *);
-int shmget(key_t, size_t, int);
-
-#endif /* _SYS_SHM_H */
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/winsup/cygwin/include/sys/socket.h b/winsup/cygwin/include/sys/socket.h
index ca76419eb..3bda9f9bf 100644
--- a/winsup/cygwin/include/sys/socket.h
+++ b/winsup/cygwin/include/sys/socket.h
@@ -32,11 +32,14 @@ extern "C"
int getpeername (int, struct sockaddr *__peer, int *);
int getsockname (int, struct sockaddr *__addr, int *);
int listen (int, int __n);
- int recv (int, void *__buff, int __len, unsigned int __flags);
- int recvfrom (int, char *__buff, int __len, int __flags,
- struct sockaddr *__from, int *__fromlen);
- int send (int, const void *__buff, int __len, unsigned int __flags);
- int sendto (int, const void *, int, unsigned int, const struct sockaddr *, int);
+ int recv (int, void *__buff, int __len, int __flags);
+ int recvfrom (int, void *__buff, int __len, int __flags,
+ struct sockaddr *__from, int *__fromlen);
+ int recvmsg(int s, struct msghdr *msg, int flags);
+ int send (int, const void *__buff, int __len, int __flags);
+ int sendmsg(int s, const struct msghdr *msg, int flags);
+ int sendto (int, const void *, int __len, int __flags,
+ const struct sockaddr *__to, int __tolen);
int setsockopt (int __s, int __level, int __optname, const void *optval, int __optlen);
int getsockopt (int __s, int __level, int __optname, void *__optval, int *__optlen);
int shutdown (int, int);
diff --git a/winsup/cygwin/include/sys/soundcard.h b/winsup/cygwin/include/sys/soundcard.h
index 1a40bff61..79341c547 100644
--- a/winsup/cygwin/include/sys/soundcard.h
+++ b/winsup/cygwin/include/sys/soundcard.h
@@ -53,10 +53,10 @@
#define SNDCARD_UART6850 8
#define SNDCARD_GUS16 9
#define SNDCARD_MSS 10
-#define SNDCARD_PSS 11
+#define SNDCARD_PSS 11
#define SNDCARD_SSCAPE 12
-#define SNDCARD_PSS_MPU 13
-#define SNDCARD_PSS_MSS 14
+#define SNDCARD_PSS_MPU 13
+#define SNDCARD_PSS_MSS 14
#define SNDCARD_SSCAPE_MSS 15
#define SNDCARD_TRXPRO 16
#define SNDCARD_TRXPRO_SB 17
@@ -112,7 +112,7 @@
#define _SIOW(x,y,t) ((int)(SIOC_IN|((sizeof(t)&SIOCPARM_MASK)<<16)|(x<<8)|y))
/* this should be _SIORW, but stdio got there first */
#define _SIOWR(x,y,t) ((int)(SIOC_INOUT|((sizeof(t)&SIOCPARM_MASK)<<16)|(x<<8)|y))
-#define _SIOC_SIZE(x) ((x>>16)&SIOCPARM_MASK)
+#define _SIOC_SIZE(x) ((x>>16)&SIOCPARM_MASK)
#define _SIOC_DIR(x) (x & 0xf0000000)
#define _SIOC_NONE SIOC_VOID
#define _SIOC_READ SIOC_OUT
@@ -194,7 +194,7 @@ typedef struct seq_event_rec {
* Gravis UltraSound. It tries to be universal format for uploading
* sample based patches but is probably too limited.
*
- * (PBD) As Hannu guessed, the GUS structure is too limited for
+ * (PBD) As Hannu guessed, the GUS structure is too limited for
* the WaveFront, but this is the right place for a constant definition.
*/
@@ -220,7 +220,7 @@ struct patch_info {
#define WAVE_SUSTAIN_ON 0x20 /* bit 5 = Turn sustaining on. (Env. pts. 3)*/
#define WAVE_ENVELOPES 0x40 /* bit 6 = Enable envelopes - 1 */
#define WAVE_FAST_RELEASE 0x80 /* bit 7 = Shut off immediately after note off */
- /* (use the env_rate/env_offs fields). */
+ /* (use the env_rate/env_offs fields). */
/* Linux specific bits */
#define WAVE_VIBRATO 0x00010000 /* The vibrato info is valid */
#define WAVE_TREMOLO 0x00020000 /* The tremolo info is valid */
@@ -234,7 +234,7 @@ struct patch_info {
int len; /* Size of the wave data in bytes */
int loop_start, loop_end; /* Byte offsets from the beginning */
-/*
+/*
* The base_freq and base_note fields are used when computing the
* playback speed for a note. The base_note defines the tone frequency
* which is heard if the sample is played using the base_freq as the
@@ -263,7 +263,7 @@ struct patch_info {
unsigned char env_rate[ 6 ]; /* GUS HW ramping rate */
unsigned char env_offset[ 6 ]; /* 255 == 100% */
- /*
+ /*
* The tremolo, vibrato and scale info are not supported yet.
* Enable by setting the mode bits WAVE_TREMOLO, WAVE_VIBRATO or
* WAVE_SCALE
@@ -272,18 +272,18 @@ struct patch_info {
unsigned char tremolo_sweep;
unsigned char tremolo_rate;
unsigned char tremolo_depth;
-
+
unsigned char vibrato_sweep;
unsigned char vibrato_rate;
unsigned char vibrato_depth;
int scale_frequency;
unsigned int scale_factor; /* from 0 to 2048 or 0 to 2 */
-
- int volume;
+
+ int volume;
int fractions;
int reserved1;
- int spare[2];
+ int spare[2];
char data[1]; /* The waveform data starts here */
};
@@ -300,7 +300,7 @@ struct sysex_info {
* /dev/sequencer input events.
*
* The data written to the /dev/sequencer is a stream of events. Events
- * are records of 4 or 8 bytes. The first byte defines the size.
+ * are records of 4 or 8 bytes. The first byte defines the size.
* Any number of events can be written with a write call. There
* is a set of macros for sending these events. Use these macros if you
* want to maximize portability of your program.
@@ -408,7 +408,7 @@ struct sysex_info {
#define CTRL_EXPRESSION 253 /* Obsolete */
#define CTRL_MAIN_VOLUME 252 /* Obsolete */
#define SEQ_BALANCE 11
-#define SEQ_VOLMODE 12
+#define SEQ_VOLMODE 12
/*
* Volume mode decides how volumes are used
@@ -433,13 +433,13 @@ struct sysex_info {
* of the associated synthesizer device. There is no limit to the size
* of the extended events. These events are not queued but executed
* immediately when the write() is called (execution can take several
- * seconds of time).
+ * seconds of time).
*
* When a SEQ_FULLSIZE message is written to the device, it must
* be written using exactly one write() call. Other events cannot
* be mixed to the same write.
- *
- * For FM synths (YM3812/OPL3) use struct sbi_instrument and write it to the
+ *
+ * For FM synths (YM3812/OPL3) use struct sbi_instrument and write it to the
* /dev/sequencer. Don't write other data together with the instrument structure
* Set the key field of the structure to FM_PATCH. The device field is used to
* route the patch to the corresponding device.
@@ -461,7 +461,7 @@ struct sbi_instrument {
#define FM_PATCH _PATCHKEY(0x01)
#define OPL3_PATCH _PATCHKEY(0x03)
short device; /* Synth# (0-4) */
- int channel; /* Program# to be initialized */
+ int channel; /* Program# to be initialized */
sbi_instr_data operators; /* Register settings for operator cells (.SBI format) */
};
@@ -480,13 +480,13 @@ struct synth_info { /* Read only */
#define SAMPLE_TYPE_BASIC 0x10
#define SAMPLE_TYPE_GUS SAMPLE_TYPE_BASIC
-#define SAMPLE_TYPE_WAVEFRONT 0x11
+#define SAMPLE_TYPE_WAVEFRONT 0x11
int perc_mode; /* No longer supported */
int nr_voices;
int nr_drums; /* Obsolete field */
int instr_bank_size;
- unsigned int capabilities;
+ unsigned int capabilities;
#define SYNTH_CAP_PERCMODE 0x00000001 /* No longer used */
#define SYNTH_CAP_OPL3 0x00000002 /* Set if OPL3 supported */
#define SYNTH_CAP_INPUT 0x00000004 /* Input (MIDI) device */
@@ -625,7 +625,7 @@ typedef struct buffmem_desc {
/*
* Application's profile defines the way how playback underrun situations should be handled.
- *
+ *
* APF_NORMAL (the default) and APF_NETWORK make the driver to cleanup the
* playback buffer whenever an underrun occurs. This consumes some time
* prevents looping the existing buffer.
@@ -687,7 +687,7 @@ typedef struct copr_debug_buf {
int command; /* Used internally. Set to 0 */
int parm1;
int parm2;
- int flags;
+ int flags;
int len; /* Length of data in bytes */
} copr_debug_buf;
@@ -696,7 +696,7 @@ typedef struct copr_msg {
unsigned char data[4000];
} copr_msg;
-#define SNDCTL_COPR_RESET _SIO ('C', 0)
+#define SNDCTL_COPR_RESET _SIO ('C', 0)
#define SNDCTL_COPR_LOAD _SIOWR('C', 1, copr_buffer)
#define SNDCTL_COPR_RDATA _SIOWR('C', 2, copr_debug_buf)
#define SNDCTL_COPR_RCODE _SIOWR('C', 3, copr_debug_buf)
@@ -710,12 +710,12 @@ typedef struct copr_msg {
/*********************************************
* IOCTL commands for /dev/mixer
*/
-
-/*
+
+/*
* Mixer devices
*
* There can be up to 20 different analog mixer channels. The
- * SOUND_MIXER_NRDEVICES gives the currently supported maximum.
+ * SOUND_MIXER_NRDEVICES gives the currently supported maximum.
* The SOUND_MIXER_READ_DEVMASK returns a bitmask which tells
* the devices supported by the particular mixer.
*/
@@ -735,7 +735,7 @@ typedef struct copr_msg {
#define SOUND_MIXER_RECLEV 11 /* Recording level */
#define SOUND_MIXER_IGAIN 12 /* Input gain */
#define SOUND_MIXER_OGAIN 13 /* Output gain */
-/*
+/*
* The AD1848 codec and compatibles have three line level inputs
* (line, aux1 and aux2). Since each card manufacturer have assigned
* different meanings to these inputs, it's inpractical to assign
@@ -940,7 +940,7 @@ typedef struct mixer_vol_table {
#define SOUND_MIXER_GETLEVELS _SIOWR('M', 116, mixer_vol_table)
#define SOUND_MIXER_SETLEVELS _SIOWR('M', 117, mixer_vol_table)
-/*
+/*
* An ioctl for identifying the driver version. It will return value
* of the SOUND_VERSION macro used when compiling the driver.
* This call was introduced in OSS version 3.6 and it will not work
@@ -954,7 +954,7 @@ typedef struct mixer_vol_table {
/*
* The 4 most significant bits of byte 0 specify the class of
- * the event:
+ * the event:
*
* 0x8X = system level events,
* 0x9X = device/port specific events, event[1] = device/port,
@@ -1014,7 +1014,7 @@ typedef struct mixer_vol_table {
*/
#define LOCL_STARTAUDIO 1
-#if (!defined(__KERNEL__) && !defined(KERNEL) && !defined(INKERNEL) && !defined(_KERNEL)) || defined(USE_SEQ_MACROS)
+#if (!defined(__KERNEL__) && !defined(KERNEL) && !defined(INKERNEL) && !defined(_KERNEL)) || defined(USE_SEQ_MACROS)
/*
* Some convenience macros to simplify programming of the
* /dev/sequencer interface
@@ -1087,16 +1087,16 @@ extern int OSS_write_patch2(int fd, unsigned char *buf, int len);
/*
* This variation of the sequencer macros is used just to format one event
* using fixed buffer.
- *
+ *
* The program using the macro library must define the following macros before
* using this library.
*
- * #define _seqbuf name of the buffer (unsigned char[])
+ * #define _seqbuf name of the buffer (unsigned char[])
* #define _SEQ_ADVBUF(len) If the applic needs to know the exact
* size of the event, this macro can be used.
* Otherwise this must be defined as empty.
* #define _seqbufptr Define the name of index variable or 0 if
- * not required.
+ * not required.
*/
#define _SEQ_NEEDBUF(len) /* empty */
#endif
@@ -1157,7 +1157,7 @@ extern int OSS_write_patch2(int fd, unsigned char *buf, int len);
* sending any MIDI bytes but it's absolutely not possible. Trying to do
* so _will_ cause problems with MPU401 intelligent mode).
*
- * Sysex messages are sent in blocks of 1 to 6 bytes. Longer messages must be
+ * Sysex messages are sent in blocks of 1 to 6 bytes. Longer messages must be
* sent by calling SEQ_SYSEX() several times (there must be no other events
* between them). First sysex fragment must have 0xf0 in the first byte
* and the last byte (buf[len-1] of the last fragment must be 0xf7. No byte
@@ -1225,11 +1225,11 @@ extern int OSS_write_patch2(int fd, unsigned char *buf, int len);
*/
#define _TIMER_EVENT(ev, parm) {_SEQ_NEEDBUF(8);\
- _seqbuf[_seqbufptr+0] = EV_TIMING; \
- _seqbuf[_seqbufptr+1] = (ev); \
+ _seqbuf[_seqbufptr+0] = EV_TIMING; \
+ _seqbuf[_seqbufptr+1] = (ev); \
_seqbuf[_seqbufptr+2] = 0;\
_seqbuf[_seqbufptr+3] = 0;\
- *(unsigned int *)&_seqbuf[_seqbufptr+4] = (parm); \
+ *(unsigned int *)&_seqbuf[_seqbufptr+4] = (parm); \
_SEQ_ADVBUF(8);}
#define SEQ_START_TIMER() _TIMER_EVENT(TMR_START, 0)
@@ -1247,16 +1247,16 @@ extern int OSS_write_patch2(int fd, unsigned char *buf, int len);
*/
#define _LOCAL_EVENT(ev, parm) {_SEQ_NEEDBUF(8);\
- _seqbuf[_seqbufptr+0] = EV_SEQ_LOCAL; \
- _seqbuf[_seqbufptr+1] = (ev); \
+ _seqbuf[_seqbufptr+0] = EV_SEQ_LOCAL; \
+ _seqbuf[_seqbufptr+1] = (ev); \
_seqbuf[_seqbufptr+2] = 0;\
_seqbuf[_seqbufptr+3] = 0;\
- *(unsigned int *)&_seqbuf[_seqbufptr+4] = (parm); \
+ *(unsigned int *)&_seqbuf[_seqbufptr+4] = (parm); \
_SEQ_ADVBUF(8);}
#define SEQ_PLAYAUDIO(devmask) _LOCAL_EVENT(LOCL_STARTAUDIO, devmask)
/*
- * Events for the level 1 interface only
+ * Events for the level 1 interface only
*/
#define SEQ_MIDIOUT(device, byte) {_SEQ_NEEDBUF(4);\
diff --git a/winsup/cygwin/include/sys/statfs.h b/winsup/cygwin/include/sys/statfs.h
new file mode 100644
index 000000000..51ad3c6b1
--- /dev/null
+++ b/winsup/cygwin/include/sys/statfs.h
@@ -0,0 +1,11 @@
+/* sys/statfs.h
+
+ Copyright 2002 Red Hat, Inc.
+
+This file is part of Cygwin.
+
+This software is a copyrighted work licensed under the terms of the
+Cygwin license. Please consult the file "CYGWIN_LICENSE" for
+details. */
+
+#include <sys/vfs.h>
diff --git a/winsup/cygwin/include/sys/strace.h b/winsup/cygwin/include/sys/strace.h
index 87cc1d785..b43ab886f 100644
--- a/winsup/cygwin/include/sys/strace.h
+++ b/winsup/cygwin/include/sys/strace.h
@@ -43,7 +43,8 @@ public:
int active;
int lmicrosec;
int execing;
- strace() : version(1) {}
+ int inited;
+ void hello ();
void prntf (unsigned, const char *func, const char *, ...) /*__attribute__ ((regparm(3)))*/;
void vprntf (unsigned, const char *func, const char *, va_list ap) /*__attribute__ ((regparm(3)))*/;
void wm (int message, int word, int lon) __attribute__ ((regparm(3)));
@@ -77,6 +78,13 @@ extern strace strace;
#define _STRACE_MALLOC 0x20000 // trace malloc calls
#define _STRACE_THREAD 0x40000 // thread-locking calls
#define _STRACE_NOTALL 0x80000 // don't include if _STRACE_ALL
+#if defined (DEBUGGING)
+# define _STRACE_ON strace.active = 1;
+# define _STRACE_OFF strace.active = 0;
+#else
+# define _STRACE_ON
+# define _STRACE_OFF
+#endif
#ifdef __cplusplus
extern "C" {
diff --git a/winsup/cygwin/include/sys/sysmacros.h b/winsup/cygwin/include/sys/sysmacros.h
index cc3a69160..2c9c69923 100644
--- a/winsup/cygwin/include/sys/sysmacros.h
+++ b/winsup/cygwin/include/sys/sysmacros.h
@@ -11,8 +11,14 @@ details. */
#ifndef _SYS_SYSMACROS_H
#define _SYS_SYSMACROS_H
+#ifdef __CYGWIN_USE_BIG_TYPES__
+#define major(dev) ((int)(((dev) >> 16) & 0xffff))
+#define minor(dev) ((int)((dev) & 0xffff))
+#define makedev(major, minor) (((major) << 16) | ((minor) & 0xffff))
+#else
#define major(dev) ((int)(((dev) >> 8) & 0xff))
#define minor(dev) ((int)((dev) & 0xff))
-#define makedev(major, minor) (((major) << 8) | (minor))
+#define makedev(major, minor) (((major) << 8) | ((minor) & 0xff))
+#endif
#endif /* _SYS_SYSMACROS_H */
diff --git a/winsup/cygwin/include/sys/termios.h b/winsup/cygwin/include/sys/termios.h
index a87f10627..20a84aa78 100644
--- a/winsup/cygwin/include/sys/termios.h
+++ b/winsup/cygwin/include/sys/termios.h
@@ -13,6 +13,26 @@ details. */
#ifndef _SYS_TERMIOS_H
#define _SYS_TERMIOS_H
+#define TIOCMGET 0x5415
+#define TIOCMSET 0x5418
+#define TIOCINQ 0x541B
+
+/* TIOCINQ is utilized instead of FIONREAD which has been
+accupied for other purposes under CYGWIN.
+Other UNIX ioctl requests has been omited because
+effects of their work one can achive by standard
+POSIX commands */
+
+
+#define TIOCM_DTR 0x002
+#define TIOCM_RTS 0x004
+#define TIOCM_CTS 0x020
+#define TIOCM_CAR 0x040
+#define TIOCM_RNG 0x080
+#define TIOCM_DSR 0x100
+#define TIOCM_CD TIOCM_CAR
+#define TIOCM_RI TIOCM_RNG
+
#define TCOOFF 0
#define TCOON 1
#define TCIOFF 2
@@ -195,6 +215,14 @@ details. */
#define NCCS 18
+/* `c_cc' member of 'struct termios' structure can be disabled by
+ using the value _POSIX_VDISABLE. */
+#define _POSIX_VDISABLE '\0'
+
+/* Compare a character C to a value VAL from the `c_cc' array in a
+ `struct termios'. If VAL is _POSIX_VDISABLE, no character can match it. */
+#define CCEQ(val, c) ((c) == (val) && (val) != _POSIX_VDISABLE)
+
typedef unsigned char cc_t;
typedef unsigned int tcflag_t;
typedef unsigned int speed_t;
diff --git a/winsup/cygwin/include/sys/uio.h b/winsup/cygwin/include/sys/uio.h
index d355ac5b6..e28f14e7e 100644
--- a/winsup/cygwin/include/sys/uio.h
+++ b/winsup/cygwin/include/sys/uio.h
@@ -1,6 +1,6 @@
/* sys/uio.h
- Copyright 1996, 2000, 2001 Red Hat, Inc.
+ Copyright 1996, 2000, 2001, 2002 Red Hat, Inc.
This file is part of Cygwin.
@@ -24,9 +24,10 @@ __BEGIN_DECLS
* Define the uio buffers used for writev, readv.
*/
-struct iovec {
- caddr_t iov_base;
- int iov_len;
+struct iovec
+{
+ void *iov_base;
+ size_t iov_len;
};
extern ssize_t readv __P ((int filedes, const struct iovec *vector, int count));
diff --git a/winsup/cygwin/include/sys/un.h b/winsup/cygwin/include/sys/un.h
index 25588e2b2..4e3eee82b 100644
--- a/winsup/cygwin/include/sys/un.h
+++ b/winsup/cygwin/include/sys/un.h
@@ -21,6 +21,6 @@ struct sockaddr_un {
/* Evaluates the actual length of `sockaddr_un' structure. */
#define SUN_LEN(p) ((size_t)(((struct sockaddr_un *) NULL)->sun_path) \
- + strlen ((p)->sun_path))
+ + strlen ((p)->sun_path))
#endif
diff --git a/winsup/cygwin/include/sys/vfs.h b/winsup/cygwin/include/sys/vfs.h
index f0f3eb96c..57b6f9232 100644
--- a/winsup/cygwin/include/sys/vfs.h
+++ b/winsup/cygwin/include/sys/vfs.h
@@ -12,7 +12,7 @@ details. */
#define _SYS_VFS_H_
struct statfs {
- long f_type; /* type of filesystem (see below) */
+ long f_type; /* type of filesystem */
long f_bsize; /* optimal transfer block size */
long f_blocks; /* total data blocks in file system */
long f_bfree; /* free blocks in fs */
diff --git a/winsup/cygwin/include/wchar.h b/winsup/cygwin/include/wchar.h
deleted file mode 100644
index eabdaa725..000000000
--- a/winsup/cygwin/include/wchar.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/* wchar.h
-
- Copyright 1998, 1999, 2000, 2001 Red Hat, Inc.
-
-This file is part of Cygwin.
-
-This software is a copyrighted work licensed under the terms of the
-Cygwin license. Please consult the file "CYGWIN_LICENSE" for
-details. */
-
-#ifndef _WCHAR_H
-#define _WCHAR_H
-
-#include <sys/cdefs.h>
-
-/* Get wchar_t and wint_t from <stddef.h>. */
-#define __need_wchar_t
-#define __need_wint_t
-#include <stddef.h>
-
-__BEGIN_DECLS
-
-int wcscmp (const wchar_t *__s1, const wchar_t *__s2);
-size_t wcslen (const wchar_t *__s1);
-
-__END_DECLS
-
-#endif /* _WCHAR_H */