UWIN Overview

The UWIN package allows UNIX applications to be built and run on Windows XP/2000/NT/ME/98/95 with few, if any, changes necessary. UWIN source and binaries are available under the open source Common Public License 1.0 at AT&T AST/UWIN open source downloads.

UWIN contains:

  • Libraries that emulate a UNIX environment by implementing the UNIX Application Programming Interface (API)
  • Include files and development tools such as cc(1), yacc(1), lex(1), and make(1).
  • ksh(1) (the Korn Shell) and over 250 utilities such as ls(1), sed(1), cp(1), stty(1), etc.

Most of the UNIX API is implemented by the POSIX.DLL dynamically loaded (shared) library. Programs linked with POSIX.DLL run under the WIN32 subsystem instead of the POSIX subsystem, so programs can freely intermix UNIX and WIN32 library calls. A cc(1) command is provided to compile and link programs for UWIN on Windows using traditional UNIX build tools such as make(1). The cc(1) command is a front end the the underlying compiler that performs the actual compilation and linking. It can be used with the Microsoft Visual C/C++ 5.X compiler, the Visual C/C++ 6.X compiler, the Visual C/C++ 7.X compiler, the Digital Mars C/C++ compiler, compiler, the Borland C/C++ compiler, and the Mingw compiler. The GNU compiler and development tools are also available for download to UWIN.

UWIN runs best on Windows XP/NT/2000 with NTFS, but will run in degraded mode with the FAT file system, and further degradation with Windows ME/98/95. See the README file for more details.

UWIN provides the following functionality for WIN32 applications:

Process control and management:
While processes can be created using the fork(2) function, UWIN includes a spawn family of functions that combines the functionality of fork/exec for efficiency. With the exec family of functions, an existing process can be overlaid with another process. Each process has a unique process id and each process belongs to a process group. The vfork(2) function is also an efficient way to create processes.
File descriptor semantics:
Open files, pipes, sockets, fifos, and character and block special devices files have file descriptors associated with them. They can be duped and inherited with UNIX semantics.
UNIX signal semantics:
Nearly all of the UNIX signals are provided, including job control signals so that ksh(1) can stop and restart jobs. A process can catch, block or ignore signals. Signals can be sent to processes or to process groups. Applications compiled with the -D_BSDCOMPAT flag obey UCB UNIX signal semantics.
Support for devices:
UWIN provides character and block devices with major and minor numbers as found on UNIX systems. Support for direct access to floppy drives (/dev/fd0), and SCSI tape drives (/dev/mt0), as well as ptys and ttys is available.
Terminal interface for consoles, sockets, and serial lines:
The POSIX termios interface is supported for consoles with vt100 emulation. Serial lines, and sockets that have been designated as virtual terminals. UWIN supports pseudo-ttys.
Use of the mouse with console windows:
The left mouse button in a console window can be used to select text and copy to the clipboard. The right button (or middle button on a three button mouse) can be used to paste text from the clipboard. The /dev/clipboard pseudo-device can be used to redirect command input and output to the clipboard. The /dev/windows pseudo-device can be used within select(2) to block until mouse or keyboard events are received.
UCB sockets based on WINSOCK:
The socket interface uses the UCB header files and naming conventions, but is implemented as calls to WINSOCK. Sockets are file descriptors and obey file descriptor semantics. Both internet domain protocol (i.e. AF_INET family) and UNIX domain sockets (AF_UNIX family) are provided. The multicast socket protocol is supported. The connect stream library, which provides a higher level and easier to user interface, is also provided.
Pathname mapping from UNIX to Windows:
UWIN provides UNIX style naming for all files with / as the filename delimiter by creating mounts. The / directory location can be selected at installation. Each drive letter in Windows is mounted in a single letter directory name under / so that /a/file is the UWIN name for a:\file. In addition, certain directories are implicitly mounted such as /sys on the system directory, /win on the windows directory, and /msdev on the directory containing the Microsoft development kit if installed. The character and block special devices are in /dev and use naming conventions found on most UNIX systems. UWIN also supports UNC (universal naming convention) names for files that begin with //. An API function is provided to map the UNIX name into the Windows name. The mapping is available from ksh as well.
UNIX naming conventions:
The PATH variable is a : separated list of directories rather than a ; separated list. The cc command generates files with a .o suffix by default. However, some characters such as \, *, ?, |, &, <. >, and : are not valid as part of file names. By default, directories are mounted without case distinction. However, the mount command allows directories to be mounted as case sensitive so that the files makefile and Makefile are distinct. In addition, there is a registry key that can be set to make the default case sensitive.
Mapping to and from UNIX ids/permissions to NT/2000/XP permissions:
Windows NT/2000/XP subject identifiers are mapped to UNIX user ids and group ids. UNIX permissions are mapped onto Windows NT/2000/XP file ACLs. The Administrator can use chown() to change the owner and or group of a file.
File control locking:
UNIX file control advisory locking is supported by UWIN with deadlock detection.
Memory mapping and shared memory:
Both mmap() and the system V shared memory facilities are provided.
System V IPC:
The System V semaphore and message calls are implemented.
Runtime linking of dynamically linked libraries:
The dlopen(), dlsym() interface from System V Release 4 is provided.
Error mapping from Windows to UNIX:
Errors returned by WIN32 functions are mapped into UNIX errnos.
i-node numbers:
An i-node number is returned when reading a file and when stating a file.
Hard links:
Hard links are supported on both NTFS and FAT file systems.
Symbolic links:
Symbolic links to files and directories can be created in UWIN and are implemented as Windows shortcuts. A .lnk suffix will be appended to these file names but will not appear when reading directories with UWIN. Shortcuts created by Windows appear as symbolic links in UWIN but do not have the .lnk suffix removed.
Fifo's:
Fifo's (UNIX named pipes) can be created with mkfifo() and opened as an ordinary file.
Setuid and setgid programs:
Users can authorize setuid and/or setgid programs to be run on their behalf and use chmod() to turn on setuid permission for a program. The program must be on an NTFS file system.
inet Daemons and commands:
UWIN 3.2 comes with the UCB inet daemon, the telnet daemon, the rlogin daemon, and the rsh daemon. It also includes the telnet, ftp, rsh, and rlogin programs. The ssh daemon and program can be built from the source but is not included because of possible export restrictions.
Access of Registry through the File System:
UWIN treats the Windows registry as a file system with registry keys treated as files, and keys that have sub-keys treated as directories. You can use UWIN tools directly on registry keys. The registry is automatically mounted under /reg during startup.
ssh and ssh daemon:
A compilation of openssh-3.6p1. Cron daemon: UWIN comes with a cron daemon that is used for running at and cron jobs. The cron daemon is started by /etc/rc on Windows NT/2000/XP.
AT&T open source utilities:
Most of the UWIN utilities are based on the AT&T open source utilities that are portable across virtually all systems and are based on the POSIX and X/Open standards. The utilities generate their own manual pages.
Development tools:
UWIN comes with cc and ncc compiler wrappers that use the Visual C/C++ compiler to build UWIN or native applications respectively. Development tools such as yacc, lex, ar, nm and rcs are also provided. UWIN provides both the traditional make and the much more powerful AT&T nmake building tool.
Support for multibyte locales:
Most of the utilities and libraries support localization to different locales including multibyte locales. The iconv utility can be used to convert from one character set to another. X11 server and utilities: A compilation of X11R6.5 is available as add on packages.

The KornShell, (ksh) can be started by double clicking the icon labeled "ksh for Windows NT" in the UWIN 3.2 program group. In addition The KornShell runs in a console window, just like the MS-DOS command shell. Once ksh is running, all of the UNIX utilities can be executed. In addition, ksh can execute native Windows applications. The UWIN console provides an emulation of the VT100 terminal so that programs that use the curses library should work. All the environment variables of Windows that have been initialized when ksh has been started can be accessed from ksh. Some variables, such as PATH, which are understood by both Windows and UNIX utilities, but which use different formats, are converted to UNIX formats when executing UNIX utilities, and converted back when executing Windows utilities. The environment variable DOSPATHVARS can be set to the names of additional variables that get converted to and from native path formats.

Online documentation is obtained by clicking on the UWIN quick reference icon. Most commands generate their own documentation when you invoke the command as command --man. In addition man -b command will display command documentation in a browser window.


Building UWIN from source

Starting with release 4.0 UWIN source is available for download. To build UWIN from the source you must first download and install the UWIN 4.0 (or newer) binary uwin-base and uwin-dev packages.
  • Pick a package root directory $PACKAGEROOT. If you have administrative privileges then PACKAGEROOT=/usr will be fine.
  • Change directory to $PACKAGEROOT and download the uwin source package tarball into the lib/package/tgz directory.
  • Read the source package:
         package read
    
  • Build the binaries from the source:
         package make
    
    All generated files will be placed in the INSTALLROOT=$PACKAGEROOT/arch/win32.i386 directory tree.
  • posix.dll will be installed in $INSTALLROOT/sys.
  • In order to install /sys/posix.dll from $INSTALLROOT/sys/posix.dll you must stop all UWIN processes (e.g., run /etc/stop_uwin.) Also, be sure to save a copy of the previous posix.dll; a botched posix.dll could potentially and completely disable UWIN.
  • Once the initial package make completes you can run nmake(1) from any subdirectory in the $INSTALLROOT/src tree. package make essentially sets up the PACKAGEROOT, INSTALLROOT, PATH, and VPATH environment variables and runs nmake install cc- from the $INSTALLROOT/src directory.
  • If you want to build just one component:
         export VPATH=$INSTALLROOT:$PACKAGEROOT
         export CDPATH=:..:$INSTALLROOT/src/cmd:$INSTALLROOT/src/lib:$INSTALLROOT/src/uwin
         cd component # e.g., libposix
         nmake install # or all or foo.o
    
  • Do we think recursive make is harmful? No -- not if you use the right make. nmake(1) scans the makefiles rooted at the current directory and determines the proper recursive makefile build order. Any ast, graphviz, or ast nmake based package tarball can be read into $PACKAGEROOT/src; the next nmake invocation will build the new package components in the proper order.


Documentation

Currently available documentation:


UWIN Alternatives


Feedback Survey

User feedback, good or bad, will help shape future releases. Please take a few minutes and fill out a UWIN survey.


Mail groups

See AST and UWIN mail groups for UWIN mail group subscruption and archive details.


UWIN users mailgroup
Information and Software Systems Research
Knowledge Ventures Research
Florham Park NJ
September 09, 2007