diff options
author | Christopher Faylor <me@cgf.cx> | 2000-02-17 19:38:33 +0000 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2000-02-17 19:38:33 +0000 |
commit | 1fd5e000ace55b323124c7e556a7a864b972a5c4 (patch) | |
tree | dc4fcf1e5e22a040716ef92c496b8d94959b2baa /winsup/cygwin/include/sys | |
parent | 369d8a8fd5e887eca547bf34bccfdf755c9e5397 (diff) | |
download | cygnal-1fd5e000ace55b323124c7e556a7a864b972a5c4.tar.gz cygnal-1fd5e000ace55b323124c7e556a7a864b972a5c4.tar.bz2 cygnal-1fd5e000ace55b323124c7e556a7a864b972a5c4.zip |
import winsup-2000-02-17 snapshot
Diffstat (limited to 'winsup/cygwin/include/sys')
24 files changed, 1001 insertions, 0 deletions
diff --git a/winsup/cygwin/include/sys/acl.h b/winsup/cygwin/include/sys/acl.h new file mode 100644 index 000000000..3fbef06da --- /dev/null +++ b/winsup/cygwin/include/sys/acl.h @@ -0,0 +1,17 @@ +/* sys/acl.h header file for Cygwin. + + Copyright 1999, 2000 Cygnus Solutions. + Written by C. Vinschen. + +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_ACL_H +#define _SYS_ACL_H + +#include <cygwin/acl.h> + +#endif /* _SYS_ACL_H */ diff --git a/winsup/cygwin/include/sys/cdefs.h b/winsup/cygwin/include/sys/cdefs.h new file mode 100644 index 000000000..bb99f7d0b --- /dev/null +++ b/winsup/cygwin/include/sys/cdefs.h @@ -0,0 +1,12 @@ +#ifndef _SYS_CDEFS_H +#define _SYS_CDEFS_H +#ifdef __cplusplus +#define __BEGIN_DECLS extern "C" { +#define __END_DECLS } +#else +#define __BEGIN_DECLS +#define __END_DECLS +#endif +#define __P(protos) protos /* full-blown ANSI C */ +#endif + diff --git a/winsup/cygwin/include/sys/copying.dj b/winsup/cygwin/include/sys/copying.dj new file mode 100644 index 000000000..7d048f70d --- /dev/null +++ b/winsup/cygwin/include/sys/copying.dj @@ -0,0 +1,41 @@ +This is the file "copying.dj". It does not apply to any sources +copyrighted by UCB Berkeley or the Free Software Foundation. + + Copyright Information for sources and executables that are marked + Copyright (C) DJ Delorie + 24 Kirsten Ave + Rochester NH 03867-2954 + +This document is Copyright (C) DJ Delorie and may be distributed +verbatim, but changing it is not allowed. + +Source code copyright DJ Delorie is distributed under the terms of the +GNU General Public Licence, with the following exceptions: + +* Any existing copyright or authorship information in any given source +file must remain intact. If you modify a source file, a notice to that +effect must be added to the authorship information in the source file. + +* binaries provided in djgpp may be distributed without sources ONLY if +the recipient is given sufficient information to obtain a copy of djgpp +themselves. This primarily applies to go32.exe, emu387, stub.exe, and +the graphics drivers. + +* modified versions of the binaries provided in djgpp must be +distributed under the terms of the GPL. + +* objects and libraries linked into an application may be distributed +without sources. + +----- + +Changes to source code copyright BSD or FSF are copyright DJ Delorie, but +fall under the terms of the original copyright. + +A copy of the file "COPYING" is included with this document. If you did not +receive a copy of "COPYING", you may obtain one from whence this document +was obtained, or by writing: + Free Software Foundation + 675 Mass Ave + Cambridge, MA 02139 + USA diff --git a/winsup/cygwin/include/sys/cygwin.h b/winsup/cygwin/include/sys/cygwin.h new file mode 100644 index 000000000..3a3dd6e9b --- /dev/null +++ b/winsup/cygwin/include/sys/cygwin.h @@ -0,0 +1,44 @@ +#ifndef _SYS_CYGWIN_H +#define _SYS_CYGWIN_H + +#include <sys/types.h> + +#ifdef __cplusplus +extern "C" { +#endif + +extern pid_t cygwin32_winpid_to_pid (int); +extern void cygwin32_win32_to_posix_path_list (const char *, char *); +extern int cygwin32_win32_to_posix_path_list_buf_size (const char *); +extern void cygwin32_posix_to_win32_path_list (const char *, char *); +extern int cygwin32_posix_to_win32_path_list_buf_size (const char *); +extern int cygwin32_conv_to_win32_path (const char *, char *); +extern int cygwin32_conv_to_full_win32_path (const char *, char *); +extern void cygwin32_conv_to_posix_path (const char *, char *); +extern void cygwin32_conv_to_full_posix_path (const char *, char *); +extern int cygwin32_posix_path_list_p (const char *); +extern void cygwin32_split_path (const char *, char *, char *); + +extern pid_t cygwin_winpid_to_pid (int); +extern int cygwin_win32_to_posix_path_list (const char *, char *); +extern int cygwin_win32_to_posix_path_list_buf_size (const char *); +extern int cygwin_posix_to_win32_path_list (const char *, char *); +extern int cygwin_posix_to_win32_path_list_buf_size (const char *); +extern int cygwin_conv_to_win32_path (const char *, char *); +extern int cygwin_conv_to_full_win32_path (const char *, char *); +extern int cygwin_conv_to_posix_path (const char *, char *); +extern int cygwin_conv_to_full_posix_path (const char *, char *); +extern int cygwin_posix_path_list_p (const char *); +extern void cygwin_split_path (const char *, char *, char *); + +#ifdef _GNU_H_WINDOWS32_BASE +/* included if <windows.h> is included */ +extern int cygwin32_attach_handle_to_fd (char *, int, HANDLE, int, int); +extern int cygwin_attach_handle_to_fd (char *, int, HANDLE, mode_t, unsigned); +#endif + +#ifdef __cplusplus +}; +#endif + +#endif /* _SYS_CYGWIN_H */ diff --git a/winsup/cygwin/include/sys/file.h b/winsup/cygwin/include/sys/file.h new file mode 100644 index 000000000..79f5f65f5 --- /dev/null +++ b/winsup/cygwin/include/sys/file.h @@ -0,0 +1,31 @@ +/* This is file FILE.H */ +/* +** Copyright (C) 1991 DJ Delorie, 24 Kirsten Ave, Rochester NH 03867-2954 +** +** This file is distributed under the terms listed in the document +** "copying.dj", available from DJ Delorie at the address above. +** A copy of "copying.dj" should accompany this file; if not, a copy +** should be available from where this file was obtained. This file +** may not be distributed without a verbatim copy of "copying.dj". +** +** This file is distributed WITHOUT ANY WARRANTY; without even the implied +** warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +*/ + +#ifndef _FILE_H_ +#define _FILE_H_ + +#include <fcntl.h> + +#define L_SET 0 +#define L_CURR 1 +#define L_INCR 1 +#define L_XTND 2 + + +#define F_OK 0 /* does file exist */ +#define X_OK 1 /* is it executable by caller */ +#define W_OK 2 /* is it writable by caller */ +#define R_OK 4 /* is it readable by caller */ + +#endif diff --git a/winsup/cygwin/include/sys/ioctl.h b/winsup/cygwin/include/sys/ioctl.h new file mode 100644 index 000000000..8164de85e --- /dev/null +++ b/winsup/cygwin/include/sys/ioctl.h @@ -0,0 +1,20 @@ +/* sys/ioctl.h */ + +#ifndef _SYS_IOCTL_H +#define _SYS_IOCTL_H + +#include <sys/cdefs.h> + +/* /dev/windows ioctls */ + +#define WINDOWS_POST 0 /* Set write() behavior to PostMessage() */ +#define WINDOWS_SEND 1 /* Set write() behavior to SendMessage() */ +#define WINDOWS_HWND 2 /* Set hWnd for read() calls */ + +__BEGIN_DECLS + +int ioctl (int __fd, int __cmd, void *); + +__END_DECLS + +#endif diff --git a/winsup/cygwin/include/sys/mman.h b/winsup/cygwin/include/sys/mman.h new file mode 100644 index 000000000..9f36bc323 --- /dev/null +++ b/winsup/cygwin/include/sys/mman.h @@ -0,0 +1,40 @@ +#ifndef _SYS_MMAN_H_ +#define _SYS_MMAN_H_ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#include <stddef.h> +#include <sys/types.h> + +#define PROT_NONE 0 +#define PROT_READ 1 +#define PROT_WRITE 2 +#define PROT_EXEC 4 + +#define MAP_FILE 0 +#define MAP_SHARED 1 +#define MAP_PRIVATE 2 +#define MAP_TYPE 0xF +#define MAP_FIXED 0x10 +#define MAP_ANONYMOUS 0x20 +#define MAP_ANON MAP_ANONYMOUS + +/* + * Flags for msync. + */ +#define MS_ASYNC 1 +#define MS_SYNC 2 +#define MS_INVALIDATE 4 + +extern caddr_t mmap (caddr_t __addr, size_t __len, int __prot, int __flags, int __fd, off_t __off); +extern int munmap (caddr_t __addr, size_t __len); +extern int mprotect (caddr_t __addr, size_t __len, int __prot); +extern int msync (caddr_t __addr, size_t __len, int __flags); + +#ifdef __cplusplus +}; +#endif /* __cplusplus */ + +#endif /* _SYS_MMAN_H_ */ diff --git a/winsup/cygwin/include/sys/mount.h b/winsup/cygwin/include/sys/mount.h new file mode 100644 index 000000000..2c4ad30a3 --- /dev/null +++ b/winsup/cygwin/include/sys/mount.h @@ -0,0 +1,25 @@ +#ifndef _SYS_MOUNT_H +#define _SYS_MOUNT_H + +#ifdef __cplusplus +extern "C" { +#endif + +enum + { + /* MOUNT_SYMLINK = 1, place holder. Do not use it. */ + MOUNT_BINARY = 2, /* "binary" format read/writes */ + MOUNT_SYSTEM = 8, /* mount point came from system table */ + MOUNT_EXEC = 16, /* Any file in the mounted directory gets 'x' bit */ + MOUNT_AUTO = 32 /* mount point refers to auto device mount */ + }; + +int mount (const char *, const char *, unsigned __flags); +int umount (const char *); +int cygwin_umount (const char *__path, unsigned __flags); + +#ifdef __cplusplus +}; +#endif + +#endif /* _SYS_MOUNT_H */ diff --git a/winsup/cygwin/include/sys/mtio.h b/winsup/cygwin/include/sys/mtio.h new file mode 100644 index 000000000..e21e4fff5 --- /dev/null +++ b/winsup/cygwin/include/sys/mtio.h @@ -0,0 +1,11 @@ +/* + * sys/mtio.h header file for Cygwin. + * + */ + +#ifndef _SYS_MTIO_H +#define _SYS_MTIO_H + +#include <cygwin/mtio.h> + +#endif /* _SYS_MTIO_H */ diff --git a/winsup/cygwin/include/sys/resource.h b/winsup/cygwin/include/sys/resource.h new file mode 100644 index 000000000..42907bc7b --- /dev/null +++ b/winsup/cygwin/include/sys/resource.h @@ -0,0 +1,40 @@ +#ifndef _SYS_RESOURCE_H_ +#define _SYS_RESOURCE_H_ + +#include <sys/time.h> + +#ifdef __cplusplus +extern "C" { +#endif + +#define RUSAGE_SELF 0 /* calling process */ +#define RUSAGE_CHILDREN -1 /* terminated child processes */ + +struct rusage { + struct timeval ru_utime; /* user time used */ + struct timeval ru_stime; /* system time used */ + long ru_maxrss; + 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 " */ +#define ru_last ru_nivcsw +}; + +int getrusage (int __who, struct rusage *__rusage); + +#ifdef __cplusplus +} +#endif + +#endif + diff --git a/winsup/cygwin/include/sys/select.h b/winsup/cygwin/include/sys/select.h new file mode 100644 index 000000000..d4e811437 --- /dev/null +++ b/winsup/cygwin/include/sys/select.h @@ -0,0 +1,35 @@ +/* select.h + Copyright 1998 Cygnus Solutions. + + Written by Geoffrey Noer <noer@cygnus.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_SELECT_H +#define _SYS_SELECT_H + +#if !defined (_POSIX_SOURCE) && !defined (__INSIDE_CYGWIN_NET__) + +#include <sys/cdefs.h> + +/* Get fd_set, and macros like FD_SET */ +#include <sys/types.h> + +/* Get definition of timeval. */ +#include <sys/time.h> +#include <time.h> + +__BEGIN_DECLS + +int select __P ((int __n, fd_set *__readfds, fd_set *__writefds, + fd_set *__exceptfds, struct timeval *__timeout)); + +__END_DECLS + +#endif /* !_POSIX_SOURCE, !__INSIDE_CYGWIN_NET__ */ + +#endif /* sys/select.h */ diff --git a/winsup/cygwin/include/sys/smallprint.h b/winsup/cygwin/include/sys/smallprint.h new file mode 100644 index 000000000..617e12a8c --- /dev/null +++ b/winsup/cygwin/include/sys/smallprint.h @@ -0,0 +1,17 @@ +#ifndef _SYS_SMALLPRINT_H +#define _SYS_SMALLPRINT_H + +#include <stdarg.h> + +#ifdef __cplusplus +extern "C" { +#endif + +int __small_sprintf (char *__dst, const char *__fmt, ...); +int __small_vsprintf (char *__dst, const char *__fmt, va_list __ap); + +#ifdef __cplusplus +}; +#endif + +#endif /* _SYS_SMALLPRINT_H */ diff --git a/winsup/cygwin/include/sys/socket.h b/winsup/cygwin/include/sys/socket.h new file mode 100644 index 000000000..13217a068 --- /dev/null +++ b/winsup/cygwin/include/sys/socket.h @@ -0,0 +1,38 @@ +#ifndef _SYS_SOCKET_H +#define _SYS_SOCKET_H + +#include <features.h> +#include <cygwin/socket.h> +#include <sys/time.h> + +#ifdef __cplusplus +extern "C" +{ +#endif + +#ifndef __INSIDE_CYGWIN_NET__ + int accept (int, struct sockaddr *__peer, int *); + int bind (int, struct sockaddr *__my_addr, int __addrlen); + int connect (int, const struct sockaddr *, int); + 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 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); + int socket (int __family, int __type, int __protocol); + int socketpair (int __domain, int __type, int __protocol, int *__socket_vec); + + struct servent *getservbyname (const char *__name, const char *__proto); +#endif + +#ifdef __cplusplus +}; +#endif + +#endif /* _SYS_SOCKET_H */ diff --git a/winsup/cygwin/include/sys/strace.h b/winsup/cygwin/include/sys/strace.h new file mode 100644 index 000000000..7ee509983 --- /dev/null +++ b/winsup/cygwin/include/sys/strace.h @@ -0,0 +1,96 @@ +/* sys/strace.h */ + +/* This file contains routines for tracing system calls and other internal + phenomenon. + + When tracing system calls, try to use the same style throughout: + + result = syscall (arg1, arg2, arg3) [optional extra stuff] + + If a system call can block (eg: read, write, wait), print another message + before hanging so the user will know why the program has stopped. + + Note: __seterrno will also print a trace message. Have that printed + *first*. This will make it easy to always know what __seterrno is + refering to. For the same reason, try not to have __seterrno messages + printed alone. +*/ + +#ifndef _SYS_STRACE_H +#define _SYS_STRACE_H + +#ifdef __cplusplus +extern "C" { +#endif + +#define _STRACE_INTERFACE_ACTIVATE_ADDR -1 + +/* Bitmasks of tracing messages to print. */ + +#define _STRACE_ALL 0x00001 // so behaviour of strace=1 is unchanged +#define _STRACE_FLUSH 0x00002 // flush output buffer after every message +#define _STRACE_INHERIT 0x00004 // children inherit mask from parent +#define _STRACE_UHOH 0x00008 // unusual or weird phenomenon +#define _STRACE_SYSCALL 0x00010 // system calls +#define _STRACE_STARTUP 0x00020 // argc/envp printout at startup +#define _STRACE_DEBUG 0x00040 // info to help debugging +#define _STRACE_PARANOID 0x00080 // paranoid info +#define _STRACE_TERMIOS 0x00100 // info for debugging termios stuff +#define _STRACE_SELECT 0x00200 // info on ugly select internals +#define _STRACE_WM 0x00400 // trace windows messages (enable _strace_wm) +#define _STRACE_SIGP 0x00800 // trace signal and process handling +#define _STRACE_MINIMAL 0x01000 // very minimal strace output +#define _STRACE_EXITDUMP 0x04000 // dump strace cache on exit +#define _STRACE_CACHE 0x08000 // cache strace messages +#define _STRACE_NOMUTEX 0x10000 // don't use mutex for synchronization +#define _STRACE_MALLOC 0x20000 // trace malloc calls +#define _STRACE_THREAD 0x40000 // thread-locking calls +#define _STRACE_NOTALL 0x80000 // don't include if _STRACE_ALL + +void small_printf (const char *, ...); + +#ifdef NOSTRACE +#define strace_printf(category, fmt...) 0 +#define strace_printf_wrap(category, fmt...) 0 +#define strace_printf_wrap1(category, fmt...) 0 +#define strace_wm(category, msg...) 0 +#else +/* Output message to strace log */ +void strace_printf (unsigned, const char *, ...); +void __system_printf (const char *, ...); + +#define system_printf(fmt, args...) \ + __system_printf("%F: " fmt, __PRETTY_FUNCTION__ , ## args) + +void _strace_wm (int __message, int __word, int __lon); + +#define strace_printf_wrap(what, fmt, args...) \ + ((void) ({\ + if (strace_active) \ + strace_printf(_STRACE_ ## what, "%F: " fmt, __PRETTY_FUNCTION__ , ## args); \ + 0; \ + })) +#define strace_printf_wrap1(what, fmt, args...) \ + ((void) ({\ + if (strace_active) \ + strace_printf((_STRACE_ ## what) | _STRACE_NOTALL, "%F: " fmt, __PRETTY_FUNCTION__ , ## args); \ + 0; \ + })) +#endif /*NOSTRACE*/ + +#define debug_printf(fmt, args...) strace_printf_wrap(DEBUG, fmt , ## args) +#define syscall_printf(fmt, args...) strace_printf_wrap(SYSCALL, fmt , ## args) +#define paranoid_printf(fmt, args...) strace_printf_wrap(PARANOID, fmt , ## args) +#define termios_printf(fmt, args...) strace_printf_wrap(TERMIOS, fmt , ## args) +#define select_printf(fmt, args...) strace_printf_wrap(SELECT, fmt , ## args) +#define wm_printf(fmt, args...) strace_printf_wrap(WM, fmt , ## args) +#define sigproc_printf(fmt, args...) strace_printf_wrap(SIGP, fmt , ## args) +#define minimal_printf(fmt, args...) strace_printf_wrap1(MINIMAL, fmt , ## args) +#define malloc_printf(fmt, args...) strace_printf_wrap1(MALLOC, fmt , ## args) +#define thread_printf(fmt, args...) strace_printf_wrap1(THREAD, fmt , ## args) + +#ifdef __cplusplus +} +#endif + +#endif /* _SYS_STRACE_H */ diff --git a/winsup/cygwin/include/sys/syslog.h b/winsup/cygwin/include/sys/syslog.h new file mode 100644 index 000000000..65c6688f2 --- /dev/null +++ b/winsup/cygwin/include/sys/syslog.h @@ -0,0 +1,73 @@ +#ifndef _SYS_LOG_H +#define _SYS_LOG_H + +#include <sys/cdefs.h> +#define LOG_EMERG 0 +#define LOG_ALERT 1 +#define LOG_CRIT 2 +#define LOG_ERR 3 +#define LOG_WARNING 4 +#define LOG_NOTICE 5 +#define LOG_INFO 6 +#define LOG_DEBUG 7 + +#define LOG_PRIMASK 0x07 + +#define LOG_PRI(p) ((p) & LOG_PRIMASK) +#define LOG_MAKEPRI(fac, pri) (((fac) << 3) | (pri)) + +#define LOG_KERN (0<<3) +#define LOG_USER (1<<3) +#define LOG_MAIL (2<<3) +#define LOG_DAEMON (3<<3) +#define LOG_AUTH (4<<3) +#define LOG_SYSLOG (5<<3) +#define LOG_LPR (6<<3) +#define LOG_NEWS (7<<3) +#define LOG_UUCP (8<<3) +#define LOG_CRON (9<<3) +#define LOG_AUTHPRIV (10<<3) +#define LOG_FTP (11<<3) + +/* Codes through 15 are reserved for system use */ +#define LOG_LOCAL0 (16<<3) +#define LOG_LOCAL1 (17<<3) +#define LOG_LOCAL2 (18<<3) +#define LOG_LOCAL3 (19<<3) +#define LOG_LOCAL4 (20<<3) +#define LOG_LOCAL5 (21<<3) +#define LOG_LOCAL6 (22<<3) +#define LOG_LOCAL7 (23<<3) + +#define LOG_NFACILITIES 24 +#define LOG_FACMASK 0x03f8 +#define LOG_FAC(p) (((p) & LOG_FACMASK) >> 3) + +#define LOG_MASK(pri) (1 << (pri)) +#define LOG_UPTO(pri) ((1 << ((pri)+1)) - 1) + +/* + * Option flags for openlog. + * + * LOG_ODELAY no longer does anything. + * LOG_NDELAY is the inverse of what it used to be. + */ +#define LOG_PID 0x01 /* log the pid with each message */ +#define LOG_CONS 0x02 /* log on the console if errors in sending */ +#define LOG_ODELAY 0x04 /* delay open until first syslog() (default) */ +#define LOG_NDELAY 0x08 /* don't delay open */ +#define LOG_NOWAIT 0x10 /* don't wait for console forks: DEPRECATED */ +#define LOG_PERROR 0x20 /* log to stderr as well */ + +__BEGIN_DECLS + + +void closelog (void); +void openlog (const char *, int, int); +int setlogmask (int); +void syslog (int, const char *, ...); + +__END_DECLS + + +#endif /* _SYS_LOG_H */ diff --git a/winsup/cygwin/include/sys/sysmacros.h b/winsup/cygwin/include/sys/sysmacros.h new file mode 100644 index 000000000..ecf3a3ae7 --- /dev/null +++ b/winsup/cygwin/include/sys/sysmacros.h @@ -0,0 +1,8 @@ +#ifndef _SYS_SYSMACROS_H +#define _SYS_SYSMACROS_H + +#define major(dev) ((int)(((dev) >> 8) & 0xff)) +#define minor(dev) ((int)((dev) & 0xff)) +#define makedev(major, minor) (((major) << 8) | (minor)) + +#endif /* _SYS_SYSMACROS_H */ diff --git a/winsup/cygwin/include/sys/termio.h b/winsup/cygwin/include/sys/termio.h new file mode 100644 index 000000000..75b815146 --- /dev/null +++ b/winsup/cygwin/include/sys/termio.h @@ -0,0 +1,2 @@ +#include <sys/termios.h> + diff --git a/winsup/cygwin/include/sys/termios.h b/winsup/cygwin/include/sys/termios.h new file mode 100644 index 000000000..b0a242a33 --- /dev/null +++ b/winsup/cygwin/include/sys/termios.h @@ -0,0 +1,295 @@ +/* sys/termios.h */ + +#ifndef _SYS_TERMIOS_H +#define _SYS_TERMIOS_H + +#define TCOOFF 0 +#define TCOON 1 +#define TCIOFF 2 +#define TCION 3 + +#define TCGETA 5 +#define TCSETA 6 +#define TCSETAW 7 +#define TCSETAF 8 + +#define TCIFLUSH 0 +#define TCOFLUSH 1 +#define TCIOFLUSH 2 +#define TCFLSH 3 + +#define TCSAFLUSH 1 +#define TCSANOW 2 +#define TCSADRAIN 3 +#define TCSADFLUSH 4 + +#define TIOCPKT 6 + +#define TIOCPKT_DATA 0 +#define TIOCPKT_FLUSHREAD 1 +#define TIOCPKT_FLUSHWRITE 2 +#define TIOCPKT_STOP 4 +#define TIOCPKT_START 8 +#define TIOCPKT_NOSTOP 16 +#define TIOCPKT_DOSTOP 32 + +#define FIONBIO 0x8004667e /* To be compatible with socket version */ + +#define CTRL(ch) ((ch)&0x1F) + +#define CNUL 0 +#define CDEL 0x0007f +#define CESC '\\' +#define CINTR CTRL('C') +#define CQUIT 0x0001c +#define CERASE CTRL('H') +#define CKILL CTRL('U') +#define CEOT CTRL('D') +#define CEOL 0 +#define CEOL2 0 +#define CEOF CTRL('D') +#define CSTART CTRL('Q') +#define CSTOP CTRL('S') +#define CSWTCH 0x0001a +#define NSWTCH 0 +#define CSUSP CTRL('Z') +#define CDSUSP CTRL('Y') +#define CRPRNT CTRL('R') +#define CFLUSH CTRL('O') +#define CWERASE CTRL('W') +#define CLNEXT CTRL('V') + +/* iflag bits */ +#define IGNBRK 0x00001 +#define BRKINT 0x00002 +#define IGNPAR 0x00004 +#define IMAXBEL 0x00008 +#define INPCK 0x00010 +#define ISTRIP 0x00020 +#define INLCR 0x00040 +#define IGNCR 0x00080 +#define ICRNL 0x00100 +#define IXON 0x00400 +#define IXOFF 0x01000 +#define IUCLC 0x04000 +#define IXANY 0x08000 +#define PARMRK 0x10000 + +/* oflag bits */ + +#define OPOST 0x00001 +#define OLCUC 0x00002 +#define OCRNL 0x00004 +#define ONLCR 0x00008 +#define ONOCR 0x00010 +#define ONLRET 0x00020 +#define OFILL 0x00040 +#define CRDLY 0x00180 +#define CR0 0x00000 +#define CR1 0x00080 +#define CR2 0x00100 +#define CR3 0x00180 +#define NLDLY 0x00200 +#define NL0 0x00000 +#define NL1 0x00200 +#define BSDLY 0x00400 +#define BS0 0x00000 +#define BS1 0x00400 +#define TABDLY 0x01800 +#define TAB0 0x00000 +#define TAB1 0x00800 +#define TAB2 0x01000 +#define TAB3 0x01800 +#define XTABS 0x01800 +#define VTDLY 0x02000 +#define VT0 0x00000 +#define VT1 0x02000 +#define FFDLY 0x04000 +#define FF0 0x00000 +#define FF1 0x04000 +#define OFDEL 0x08000 + +/* cflag bits */ + +/* Baud rate values. These must fit in speed_t, which is unsigned + char. See also the extended baud rates below. These baud rates + set an additional bit. */ +#define CBAUD 0x0100f +#define B0 0x00000 +#define B50 0x00001 +#define B75 0x00002 +#define B110 0x00003 +#define B134 0x00004 +#define B150 0x00005 +#define B200 0x00006 +#define B300 0x00007 +#define B600 0x00008 +#define B1200 0x00009 +#define B1800 0x0000a +#define B2400 0x0000b +#define B4800 0x0000c +#define B9600 0x0000d +#define B19200 0x0000e +#define B38400 0x0000f + +#define CSIZE 0x00030 +#define CS5 0x00000 +#define CS6 0x00010 +#define CS7 0x00020 +#define CS8 0x00030 +#define CSTOPB 0x00040 +#define CREAD 0x00080 +#define PARENB 0x00100 +#define PARODD 0x00200 +#define HUPCL 0x00400 +#define CLOCAL 0x00800 +#define CBAUDEX 0x0100f +#define B57600 0x01001 +#define B115200 0x01002 +#define B128000 0x01003 +#define B256000 0x01003 +#define CRTSXOFF 0x04000 +#define CRTSCTS 0x08000 + +/* lflag bits */ +#define ISIG 0x0001 +#define ICANON 0x0002 +#define ECHO 0x0004 +#define ECHOE 0x0008 +#define ECHOK 0x0010 +#define ECHONL 0x0020 +#define NOFLSH 0x0040 +#define TOSTOP 0x0080 +#define IEXTEN 0x0100 +#define FLUSHO 0x0200 +#define ECHOKE 0x0400 +#define ECHOCTL 0x0800 + +#define VDISCARD 1 +#define VEOL 2 +#define VEOL2 3 +#define VEOF 4 +#define VERASE 5 +#define VINTR 6 +#define VKILL 7 +#define VLNEXT 8 +#define VMIN 9 +#define VQUIT 10 +#define VREPRINT 11 +#define VSTART 12 +#define VSTOP 13 +#define VSUSP 14 +#define VSWTC 15 +#define VTIME 16 +#define VWERASE 17 + +#define NCCS 18 + +typedef unsigned char cc_t; +typedef unsigned int tcflag_t; +typedef unsigned int speed_t; +typedef unsigned short otcflag_t; +typedef unsigned char ospeed_t; + +struct __oldtermios { + otcflag_t c_iflag; + otcflag_t c_oflag; + otcflag_t c_cflag; + otcflag_t c_lflag; + char c_line; + cc_t c_cc[NCCS]; + ospeed_t c_ispeed; + ospeed_t c_ospeed; +}; + +struct termios { + tcflag_t c_iflag; + tcflag_t c_oflag; + tcflag_t c_cflag; + tcflag_t c_lflag; + char c_line; + cc_t c_cc[NCCS]; + speed_t c_ispeed; + speed_t c_ospeed; +}; + +#ifdef CYGWIN_VERSION_DLL_IS_OLD_TERMIOS +#ifdef __GNUC__ +# define __tonew_termios(ti) \ + ({ \ + struct termios *__newti; \ + \ + if (!CYGWIN_VERSION_DLL_IS_OLD_TERMIOS) \ + __newti = (struct termios *) ti; \ + else \ + { \ + __newti = (struct termios *) alloca(sizeof(struct termios)); \ + __newti->c_iflag = ((struct __oldtermios *)ti)->c_iflag; \ + __newti->c_oflag = ((struct __oldtermios *)ti)->c_oflag; \ + __newti->c_cflag = ((struct __oldtermios *)ti)->c_cflag; \ + __newti->c_lflag = ((struct __oldtermios *)ti)->c_lflag; \ + __newti->c_line = ((struct __oldtermios *)ti)->c_line; \ + __newti->c_ispeed = ((struct __oldtermios *)ti)->c_ispeed; \ + __newti->c_ospeed = ((struct __oldtermios *)ti)->c_ospeed; \ + memcpy (__newti->c_cc, ((struct __oldtermios *)ti)->c_cc, sizeof(__newti->c_cc)); \ + } \ + __newti; \ + }) + +# define __makenew_termios(ti) \ + (CYGWIN_VERSION_DLL_IS_OLD_TERMIOS ? \ + (struct termios *) alloca (sizeof (struct termios)) : (ti)) + +# define __toapp_termios(toti, fromti) \ + ({ \ + if (!CYGWIN_VERSION_DLL_IS_OLD_TERMIOS) \ + toti = fromti; \ + else \ + { \ + ((struct __oldtermios *)toti)->c_iflag = fromti->c_iflag; \ + ((struct __oldtermios *)toti)->c_oflag = fromti->c_oflag; \ + ((struct __oldtermios *)toti)->c_cflag = fromti->c_cflag; \ + ((struct __oldtermios *)toti)->c_lflag = fromti->c_lflag; \ + ((struct __oldtermios *)toti)->c_line = fromti->c_line; \ + ((struct __oldtermios *)toti)->c_ispeed = fromti->c_ispeed; \ + ((struct __oldtermios *)toti)->c_ospeed = fromti->c_ospeed; \ + memcpy (((struct __oldtermios*)toti)->c_cc, fromti->c_cc, sizeof(fromti->c_cc)); \ + } \ + toti; \ + }) +#endif /*__GNUC__*/ +#endif + +#define termio termios + +#define cfgetospeed(tp) ((tp)->c_ospeed) +#define cfgetispeed(tp) ((tp)->c_ispeed) +#define cfsetospeed(tp,s) (((tp)->c_ospeed = (s)), 0) +#define cfsetispeed(tp,s) (((tp)->c_ispeed = (s)), 0) + +#ifdef __cplusplus +extern "C" { +#endif + +int tcgetattr (int, struct termios *); +int tcsetattr (int, int, const struct termios *); +int tcsendbreak (int, int); +int tcdrain (int); +int tcflush (int, int); +int tcflow (int, int); + +#ifdef __cplusplus +} +#endif + +/* Extra stuff to make porting stuff easier. */ +struct winsize +{ + unsigned short ws_row, ws_col; + unsigned short ws_xpixel, ws_ypixel; +}; + +#define TIOCGWINSZ (('T' << 8) | 1) +#define TIOCSWINSZ (('T' << 8) | 2) + +#endif /* _SYS_TERMIOS_H */ diff --git a/winsup/cygwin/include/sys/ttychars.h b/winsup/cygwin/include/sys/ttychars.h new file mode 100644 index 000000000..2d313646f --- /dev/null +++ b/winsup/cygwin/include/sys/ttychars.h @@ -0,0 +1 @@ +/* ttychars.h */ diff --git a/winsup/cygwin/include/sys/uio.h b/winsup/cygwin/include/sys/uio.h new file mode 100644 index 000000000..dad9dc17f --- /dev/null +++ b/winsup/cygwin/include/sys/uio.h @@ -0,0 +1,25 @@ +#ifndef _UIO_H_ +#define _UIO_H_ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/* For size_t */ +#include <stddef.h> +/* For ssize_t */ +#include <sys/types.h> + +/* + * Define the uio buffers used for writev, readv. + */ + +struct iovec { + caddr_t iov_base; + int iov_len; +}; + +#ifdef __cplusplus +}; +#endif /* __cplusplus */ +#endif /* _UIO_H_ */ diff --git a/winsup/cygwin/include/sys/un.h b/winsup/cygwin/include/sys/un.h new file mode 100644 index 000000000..6f49c7b06 --- /dev/null +++ b/winsup/cygwin/include/sys/un.h @@ -0,0 +1,16 @@ +#ifndef _SYS_UN_H +#define _SYS_UN_H + +/* POSIX requires only at least 100 bytes */ +#define UNIX_PATH_LEN 108 + +struct sockaddr_un { + unsigned short sun_family; /* address family AF_LOCAL/AF_UNIX */ + char sun_path[UNIX_PATH_LEN]; /* 108 bytes of socket address */ +}; + +/* Evaluates the actual length of `sockaddr_un' structure. */ +#define SUN_LEN(p) ((size_t)(((struct sockaddr_un *) NULL)->sun_path) \ + + strlen ((p)->sun_path)) + +#endif diff --git a/winsup/cygwin/include/sys/utsname.h b/winsup/cygwin/include/sys/utsname.h new file mode 100644 index 000000000..bbfa9a6d0 --- /dev/null +++ b/winsup/cygwin/include/sys/utsname.h @@ -0,0 +1,23 @@ +#ifndef _SYS_UTSNAME_H +#define _SYS_UTSNAME_H + +#ifdef __cplusplus +extern "C" { +#endif + +struct utsname +{ + char sysname[20]; + char nodename[20]; + char release[20]; + char version[20]; + char machine[20]; +}; + +int uname (struct utsname *); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/winsup/cygwin/include/sys/vfs.h b/winsup/cygwin/include/sys/vfs.h new file mode 100644 index 000000000..4d3b0b6e0 --- /dev/null +++ b/winsup/cygwin/include/sys/vfs.h @@ -0,0 +1,28 @@ +#ifndef _SYS_VFS_H_ +#define _SYS_VFS_H_ + +struct statfs { + long f_type; /* type of filesystem (see below) */ + long f_bsize; /* optimal transfer block size */ + long f_blocks; /* total data blocks in file system */ + long f_bfree; /* free blocks in fs */ + long f_bavail; /* free blocks avail to non-superuser */ + long f_files; /* total file nodes in file system */ + long f_ffree; /* free file nodes in fs */ + long f_fsid; /* file system id */ + long f_namelen; /* maximum length of filenames */ + long f_spare[6]; /* spare for later */ +}; + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +int statfs (const char *__path, struct statfs *__buf); +int fstatfs (int __fd, struct statfs *__buf); + +#ifdef __cplusplus +}; +#endif /* __cplusplus */ + +#endif /*_SYS_VFS_H_*/ diff --git a/winsup/cygwin/include/sys/wait.h b/winsup/cygwin/include/sys/wait.h new file mode 100644 index 000000000..a9648eec2 --- /dev/null +++ b/winsup/cygwin/include/sys/wait.h @@ -0,0 +1,63 @@ +#ifndef _SYS_WAIT_H +#define _SYS_WAIT_H + +#include <sys/types.h> +#include <sys/resource.h> + +#ifdef __cplusplus +extern "C" { +#endif + +#define WNOHANG 1 +#define WUNTRACED 2 + +/* A status looks like: + <2 bytes info> <2 bytes code> + + <code> == 0, child has exited, info is the exit value + <code> == 1..7e, child has exited, info is the signal number. + <code> == 7f, child has stopped, info was the signal number. + <code> == 80, there was a core dump. +*/ + +#define WIFEXITED(w) (((w) & 0xff) == 0) +#define WIFSIGNALED(w) (((w) & 0x7f) > 0 && (((w) & 0x7f) < 0x7f)) +#define WIFSTOPPED(w) (((w) & 0xff) == 0x7f) +#define WEXITSTATUS(w) (((w) >> 8) & 0xff) +#define WTERMSIG(w) ((w) & 0x7f) +#define WSTOPSIG WEXITSTATUS + +pid_t wait (int *); +pid_t waitpid (pid_t, int *, int); +pid_t wait3 (int *__status, int __options, struct rusage *__rusage); +pid_t wait4 (pid_t __pid, int *__status, int __options, struct rusage *__rusage); + +union wait + { + int w_status; + struct + { + unsigned int __w_termsig:7; /* Terminating signal. */ + unsigned int __w_coredump:1; /* Set if dumped core. */ + unsigned int __w_retcode:8; /* Return code if exited normally. */ + unsigned int:16; + } __wait_terminated; + struct + { + unsigned int __w_stopval:8; /* W_STOPPED if stopped. */ + unsigned int __w_stopsig:8; /* Stopping signal. */ + unsigned int:16; + } __wait_stopped; + }; + +#define w_termsig __wait_terminated.__w_termsig +#define w_coredump __wait_terminated.__w_coredump +#define w_retcode __wait_terminated.__w_retcode +#define w_stopsig __wait_stopped.__w_stopsig +#define w_stopval __wait_stopped.__w_stopval + +#ifdef __cplusplus +}; +#endif + +#endif |