1 diff -uNr --exclude-from=dontdiff linux-2.4.3/Documentation/abi/00-INDEX linux/Documentation/abi/00-INDEX
2 --- linux-2.4.3/Documentation/abi/00-INDEX Thu Jan 1 01:00:00 1970
3 +++ linux/Documentation/abi/00-INDEX Fri Mar 30 16:12:20 2001
8 + - a list of software that has run succesfull under iBCS
10 + - a list of people that have contributed to linux-abi or iBCS
12 + - changelog of linux-abi
14 + - changelog of the iBCS project (up to 1998)
16 + - mapping of error codes from Linux to various personalities
20 + - help on local X interfaces
22 + - some notes on signal handling
24 + - an introduction into Linux personality support
28 + - the syscall mapping for certain personalities
30 + - things to be done, leftovers from iBCS
33 diff -uNr --exclude-from=dontdiff linux-2.4.3/Documentation/abi/COMPAT linux/Documentation/abi/COMPAT
34 --- linux-2.4.3/Documentation/abi/COMPAT Thu Jan 1 01:00:00 1970
35 +++ linux/Documentation/abi/COMPAT Fri Mar 30 16:12:20 2001
37 +C: This file contains details of programs that have been run under
38 +C: Linux using the iBCS emulator. An entry here is no guarantee that
39 +C: the program works 100% but does indicate that the major elements
40 +C: of the program have been unable to exercise bugs in the emulator
41 +C: unless otherwise noted.
43 +C: An entry in this file does not necessarily indicate that the vendor
44 +C: or anyone else actually supports the package under Linux unless
45 +C: there is a specific entry to that effect.
47 +C: Please add to this file - new entries, other releases, amendments
48 +C: to existing entries etc.
50 +C: The layout of this file is intended to be both easy to browse and
51 +C: easy to parse, allowing it to be formatted into documents in the
52 +C: future. This hasn't happened yet though and might never happen :-).
57 +C: S = Support details
58 +C: O = Operating system compiled for
60 +C: R = Release(s) known to work
61 +C: L = Libraries required
66 +V: Applied Information Systems, Inc. (info@ais.com)
68 +P: Xess (MOTIF Spreadsheet)
71 +N: A save-disabled demo is available in ftp.uu.net:/vendor/ais/
72 +N: Get three files: README, gen.tar, and sco.tar.
73 +N: Don't add a .Z or .gz to the end of the filenames; the files
74 +N: inside are compressed. ~300K of online documentation is in
76 +N: If anyone decides to actually *buy* this product, *please*
77 +N: mention that you will be running it under Linux. I promise
78 +N: you that you will still get technical support (the majority
79 +N: of our technical support staff run Linux at home) -- but if
80 +N: enough people buy the product asking for a Linux version, my
81 +N: employer will be willing to make the investment. Pass the
82 +N: word on if you want to see a native-mode, high-quality
83 +N: spreadsheet for Linux as much as I do...
85 +T: Michael K.Johnson <johnsonm@merengue.oit.unc.edu>
89 +P: CorelDraw! 3.0 and friends.
91 +N: Requires X11, no character versions of these apps.
92 +N: Everything seems to be statically linked, no extra libs
93 +N: necessary. I had a few problems with my .xmodmap file
94 +N: since CorelDraw wants all of the lower function keys to
95 +N: be mapped to functions in the CorelDraw program. Uses a
96 +N: networked license manager, it worked fine. My programs
97 +N: did not install properly due to an install bug. The dir.
98 +N: that contains the washes.3fx file and others must be hand
99 +N: changed to mode 777 for CorelChart to work (This from
100 +N: Corel tech support).
101 +T: Doug Ledford <gdl297s@cnas.smsu.edu>
105 +P: Informix SQL Standard Engine
108 +T: Mike Jagdis <jaggy@purplet.demon.co.uk>
112 +P: Informix SQL Online Dynamic Server
114 +T: Mike Jagdis <jaggy@purplet.demon.co.uk>
118 +N: INET is reputed to work too but I can't remember who
127 +N: The version of X.desktop tested is that shipped with
128 +N: Uniplex Windows. Functionality is at least enough to
129 +N: support Uniplex Windows.
130 +T: Mike Jagdis <jaggy@purplet.demon.co.uk>
137 +T: Remete Gabor <rg@tomx.elte.hu>
141 +P: Tactician Plus (character and X)
143 +T: Brandon S. Allbery <bsa@kf8nh.wariat.org>
147 +P: SPSS 5.0 for SCO UNIX
148 +L: Motif, if you want to use the GUI
149 +D: Statistical Package for the Social Sciences
150 +N: SCO's cpio is not compatible with GNU's -- I had to dd all
151 +N: floppys onto my hd and to concatenate them into one file.
152 +N: I couldn't test the GUI since I had no Motif available.
153 +T: Joerg Rade <jr@petz.han.de>
157 +P: Uniplex / Uniplex Windows
159 +L: statically linked (Uniplex Windows requires libnsl_s)
160 +N: Uniplex Windows is implemented using a version of IXI
161 +N: X.desktop. It is this that requires libnsl_s.
162 +T: Mike Jagdis <jaggy@purplet.demon.co.uk>
166 +P: VSI*FAX (FxServer, FxScript, FxVision) (character and X)
167 +R: FxServer 2.0.19, FxScript 1.1.05, FxVision 1.0.16
168 +L: Statically linked
169 +N: Needs localhost in the X server's access control list
170 +N: even when using a local X connection.
171 +N: This has not been tested with a modem connected as I
172 +N: don't have a Multitech...
173 +T: Mike Jagdis <jaggy@purplet.demon.co.uk>
179 +T: Mark C. Henderson <mch@sqwest.wimsey.bc.ca>
181 +V: WordPerfect Corporation
183 +P: WordPerfect (character and X)
185 +L: Statically linked
186 +N: Installation under Linux may require changes to some of
187 +N: the WP install scripts. See the PROD.Patches/WP file
190 +N: WP uses a network license manager.
192 +N: For some reason WP use a partition floppy device rather
193 +N: than the full block device. Linux does not have this so
194 +N: you need to use dd to skip the first cylinder (track?)
195 +N: when loading the floppies under Linux. See the HINTS
196 +N: file for details.
198 +N: Fonts appear corrupt. See the HINTS file for a cure.
199 +T: Mike Jagdis <jaggy@purplet.demon.co.uk>
205 +L: Statically linked - Motif based.
206 +N: Installation scripts work correctly.
208 +N: ZMail can use a network license manager or a license file.
209 +N: Both are known to work.
211 +N: ZMail is a GUI-based mail program.
213 +N: You can download the binaries for ZMail via anonymous ftp
215 +N: You will have to contact Z-Code to obtain an evaluation
216 +N: license if you wish to try it out.
217 +T: Eric Youngdale <eric@aib.com>
218 diff -uNr --exclude-from=dontdiff linux-2.4.3/Documentation/abi/CREDITS linux/Documentation/abi/CREDITS
219 --- linux-2.4.3/Documentation/abi/CREDITS Thu Jan 1 01:00:00 1970
220 +++ linux/Documentation/abi/CREDITS Fri Mar 30 16:12:20 2001
222 +A (non-definitive) list of people who appear to have worked on the
223 +emulator and, in some cases, what they appear to have done.
225 +This list is in no particular order.
227 +This list should probably be better maintained :-).
229 +If anyone feels that they are not properly credited here, send diffs to
233 +========================================================================
235 +Brandon S. Allbery <bsa@kf8nh.wariat.org> or <kf8nh@kf8nh.ampr.org>
237 +Graham Adams <gadams@ddrive.demon.co.uk>
239 +Tor Arntsen <tor@tss.no> or <tor@spacetec.no>
240 + Emulator as of pl13
242 +Philip Balister <balister@vt.edu>
243 + Emulator as of pl13
246 +Alfred Longyear <longyear@netcom.com>
248 + Emulator as of pl12
249 + Original author of libc_s. COFF version.
251 +Mike Jagdis <jaggy@purplet.demon.co.uk>
252 + Changes for loadable module version of the emulator.
253 + Multi-personality detection and syscall mapping.
254 + Error code mapping.
255 + Wyse V/386 socket interface.
256 + /dev/socksys socket interface.
257 + /dev/spx to Unix domain socket for local X connections.
258 + Named pipe to Unix domain socket open kludge.
259 + XTI/TLI STREAMS based networking interface.
260 + X.out loader for 386 Xenix binaries.
262 + Trace dummy device.
263 + Segment (LDT) mapping for x.out binaries.
264 + Xenix 286 emulator overlay.
265 + Current source maintainer and primary developer.
267 +Joseph L. Portman III <baron@hebron.connected.com>
268 + Major emulator developer.
271 +Drew Sullivan <drew@lethe.north.net>
272 + Past emulator source maintainer.
274 +Eric Youngdale <eric@aib.com> (prev. <eric@cais.com> & <ericy@gnu.ai.mit.edu>)
275 + First cut of the emulator.
276 + ELF loader, plus memory manager and fs/exec.c modifications
277 + to allow multiple binary formats to be loaded.
278 + Keeper of the tsx-11 archive.
279 + libc_s (elf version), plus bugfixes, reorganization, etc.
280 + SVr4 portions of emulator.
282 +Karl Kiniger <ki@kretz.co.at>
283 + Interactive 4.0 binary recognition and special support.
285 +Remete Gabor <rg@tomx.elte.hu>
286 + Miscellaneous patches.
288 +Scott Michel <scottm@intime.com>
289 + SCO multiscreen ioctls.
291 +Stephan Riess <Stephan.Riess@Physik.TU-Muenchen.de>
294 +Peter Polte <peter@cat-productions.de>
295 + Xenix fcntl() file locking facilities.
297 +C.A. Lademann <cal@zls.com>
299 +Miguel de Icaza <miguel@roxanne.nuclecu.unam.mx>
301 diff -uNr --exclude-from=dontdiff linux-2.4.3/Documentation/abi/ChangeLog linux/Documentation/abi/ChangeLog
302 --- linux-2.4.3/Documentation/abi/ChangeLog Thu Jan 1 01:00:00 1970
303 +++ linux/Documentation/abi/ChangeLog Fri Mar 30 16:26:49 2001
305 +2001-03-30 Christoph Hellwig <hch@sb.bsdonline.org>
309 + * fix shared library support for COFF
310 + * x.out is now supported (again)
311 + * redo setting of personality based on ELF headers
312 + * get rid of CONFIG_ABI_TRACE (and a lot of nasty ifdefs)
313 + * added documentation, mostly from iBCS
314 diff -uNr --exclude-from=dontdiff linux-2.4.3/Documentation/abi/ChangeLog.ibcs linux/Documentation/abi/ChangeLog.ibcs
315 --- linux-2.4.3/Documentation/abi/ChangeLog.ibcs Thu Jan 1 01:00:00 1970
316 +++ linux/Documentation/abi/ChangeLog.ibcs Fri Mar 30 16:12:20 2001
318 +Thu Nov 5 21:45:41 GMT 1998
320 + * Fixed the bug that lets reads and writes on /dev/socksys
321 + take out the kernel.
324 + * Added a kludge around for Sybase isql which appears to
325 + have initialised a struct sockaddr using:
326 + sa.sa_family = htons(AF_INET);
327 + I guess this works on SCO?
331 +Sat Oct 31 14:15:44 GMT 1998
333 + * Documentation update.
335 + * If we are doing a T_BIND_REQ with a null address we can
336 + ignore the connection backlog. Listening makes no sense
337 + but some software seems to set it 1 for the hell of it.
341 +Tue Oct 20 20:34:20 BST 1998
343 + * Changed the debug messages printed when exec tracing
344 + sees a pointer error on an arg or env entry. It may not
345 + be a "real" error. It could be that we just cannot get
346 + a free page or perhaps the entry is too long for getname().
347 + Whatever, we do not really care at this point anyway.
351 +Sat Oct 17 20:24:59 BST 1998
353 + * Documentation update for today's release.
357 +Thu Oct 15 21:39:16 BST 1998
359 + * When checking personality only look at the base personality
360 + and ignore the flags. There is at least one case I can
361 + think of, PER_SHORT_INODE, where the personality should
362 + be considered the same even when the flags are different.
365 + * Added the location of the kernel source as an option
366 + in the CONFIG. Hopefully this will make it a little
367 + more obvious that iBCS is *dependant* on the kernel.
370 + * Set SO_BSDCOMPAT on sockets. SYSV has BSD handling of
371 + ICMP errors on UDP sockets rather than RFC conformance.
376 +Wed Oct 14 22:50:48 BST 1998
378 + * When using some user stack as temporary work space we
379 + only leave 1k between the work space and the real user
380 + stack. This is because Informix Dynamic Server uses
381 + threads with limited stack space and the idea of dropping
382 + 16k below what would normally be touched on a SCO system
387 +Sun Oct 11 11:58:58 BST 1998
389 + * Changed the Tools Makefile to install mkmnttab in
390 + /usr/bin. Informix Dynamic Server _requires_ a
395 +Sun Oct 11 11:44:58 BST 1998
397 + * When doing an I_PEEK or I_NREAD STREAMS ioctl we have
398 + to do a probe on sockets in case we need to generate
399 + a control message (e.g. T_CONN_IND) which should then
400 + be offered. This also allows T_CONN_IND messages to be
401 + returned in several MORECTL divided pieces should it
402 + ever be necessary. This is required by Informix Dynamic
403 + Server which does a poll then I_PEEK on a listening
404 + socket before actually picking up the connection. Dynamic
405 + Server is system call hell :-).
408 + * When we do a timod operation via an ioctl there seems
409 + to be no way to cope if the returned message is larger
410 + than the original request. We can't expect the app to
411 + come back for the extra and returning MORECTL to the
412 + app seems to confuse things. Therefore we just discard
413 + the excess. This case is required when an app (e.g.
414 + Informix Dynamic Server) tries to set SO_LINGER using
415 + an int instead of a struct linger via an ioctl.
418 + * Added some debug to the poll handler so we can see what
422 + * More debug message changes.
425 + * Wrap SO_LINGER handling so we can survive if an int is
426 + passed instead of s struct linger. It seems that other
427 + systems do not do such robust error checking as Linux.
428 + Note that if an int is passed we probably do not do what
429 + other systems would but at least we don't give unexpected
430 + errors to broken applications.
434 +Sat Oct 10 15:58:29 BST 1998
436 + * Added an entry to Doc/HINTS noting the the Informix
437 + Dynamic Server install requires an /etc/mnttab.
440 + * Wrong option length being passed through to setsockopt()
441 + from the TLI/XTI optmgmt routine.
444 + * When stating files only map "ext2" to "HTFS" for SCO
445 + programs - and then only if the filesystem name really
449 + * SCO has a different value for the _SC_PAGESIZE argument
450 + to sysconf() than SVR4. Informix wants it to work.
453 + * Hmmm, Informix Dynamic Server may or may not be looking
454 + at the major number on a socket. (I _think_ it does
455 + sometimes). It definitely checks that sockets have
456 + S_IFCHR set in their file modes though...
459 + * Changed some debug messages to make it easier to read
460 + logs when more than one iBCS handled process is running.
463 + * If we get a STREAMS ioctl on a file descriptor only
464 + initialize the socksys handler on it if it is not
465 + already a socket but does belong to the socksys device.
469 +Thu Oct 8 21:20:43 BST 1998
471 + * When punting a pseudo device transport provider to a
472 + socket copy the device numbers between the inodes. This
473 + is because Informix Dynamic Server stats the pseudo
474 + device node (/dev/socksys) then stats the socket it
475 + gets and compares the major numbers. Sheesh...
478 + * If socksys_close gets something that is not a socket
479 + it is probably the original pseudo device which was
480 + opened just for an ioctl or two. This is not an error.
483 + * Some programs, notably the Informix Dynamic Server
484 + install program compare the filesystem name from a
485 + stat or sysfs against their own hard coded list of
486 + known "real" filesystems. Hence we call "ext2" "HTFS"
487 + instead for SCO processes.
490 + * Informix DS also checks the release part of the utsname
491 + data to make sure it says "3.2v5.0.0". So now the
492 + utsname struct looks even more like SCO.
495 + * Only dump the ctl part of messages in timod if
496 + tracing is enabled.
499 + * SCO has statvfs in the same place as SVR4 but they have
500 + added a field slap bang in the middle of the struct to
501 + allow some inodes to be reserved for root in much the
502 + same way that some blocks may be reserved.
506 +Thu Oct 8 20:48:46 BST 1998
508 + * On timod bind and connect the size of the address is
509 + allowed to be the _used_ bytes whereas the underlying
510 + socket functions require the _total_ bytes. This is
511 + a problem for Sybase.
515 +Sun Aug 30 21:49:46 BST 1998
517 + * Changed socksys.c to handle new file_operations struct
518 + in kernel 2.1.119 and later.
522 +Sat Aug 22 19:57:01 BST 1998
524 + * Fixes and additions to user pointer checking in ipc.c
527 + * Changed some more KERN_ERRs to KERN_DEBUGs in the
528 + STREAMS ioctl support.
532 +Fri Aug 21 20:24:32 BST 1998
534 + * Somehow fchdir had been missed from the main iBCS call
535 + map even though it had been put in the BSD map. Oops.
539 +Wed Aug 19 23:12:47 BST 1998
541 + * ALPHA 2.1 release number 2...
545 +Wed Aug 19 20:43:09 BST 1998
547 + * Avoid calling rt_sigaction if the mapped signal number
548 + is -1. It is not strictly necessary but why bother?
551 + * Added David Bruce's updated x286emul.
555 +Mon Aug 17 21:29:53 BST 1998
557 + * Avoid calling fput with a NULL file pointer.
561 +Sun Aug 16 17:32:20 BST 1998
563 + * Fix to copy_{to,from}_user return checking. In many
564 + cases we do not care because they are behind verify_area
565 + checks but in some we do - and copy_{to,from}_user
566 + returns the number of bytes _uncopied_.
570 +Sat Aug 15 23:39:42 BST 1998
572 + * Change the flock handling to bounce the flock struct
573 + through kernel space rather than using an in place
574 + modification. The assumptions we were making about
575 + segment registers seem to have become invalid at some
576 + point. We could go to put_user(get_user()) but moving
577 + the whole struct is probably more robust. Which is
582 +Sat Aug 15 22:30:41 BST 1998
584 + * Changes to signal functions. Previous code confused old and
585 + new sigsets and could have lead to memory corruption and
586 + was likely the cause of signals getting blocked unexpectedly.
587 + Now we use the rt_sig* and new sigset interface to the
588 + kernel exclusively (in a few years the old stuff may be
589 + removed). This does means that a non-Linux program may
590 + now operate on signals >32 which may not have existed
591 + (and therefore would have errored) in the native environment.
592 + This may be considered a bug or a feature as appropriate...
596 +Mon Jul 20 22:23:14 BST 1998
598 + * ALPHA 2.1 release...
602 +Mon Jul 20 20:55:47 BST 1998
604 + * Added support for I_FDINSERT in the STREAMS/TLI message
605 + protocol handling. This allows TLI server code to work
606 + using a _real_ libnsl_s (tested briefly) but will break
607 + server code using my replacement libnsl_s until I update
608 + it. (It should probably use an I_FDINSERT simply so it
609 + can still run under SYSV if ever necessary.)
612 + * Use TIOCINQ instead of FIONREAD in the STREAMS ioctl handler.
613 + FIONREAD isn't actually supported on sockets. The socksys
614 + code already had this right.
617 + * Do the MOD_INC, MOD_DEC calls for sockets in the inherit
618 + and release handling only to reduce the opportunity for,
623 +Thu Jul 16 22:11:48 BST 1998
625 + * Finally got round to adding a GNU CopyLeft!
628 + * Set up an XTI/TLI private state struct on all sockets at
629 + the same time we plug our own file operations in. This
630 + costs a small amount of extra memory per socket. However
631 + this is strictly correct (although unlikely to be actually
632 + _required_ by anything). It also allows us to set up TEPs
633 + created by XTI/TLI listen/accept easily so they have a
638 + Do not auto-listen in getmsg() - listen() after connect()
639 + appears to crash some 2.1 kernels(?).
640 + Change the probe for activity in getmsg() to use the
641 + new poll handler directly.
642 + Handle listening TEPs slightly better.
645 + * Changed a stray KERN_ERR to KERN_DEBUG in ioctl.c
649 +Fri Jul 3 23:20:37 BST 1998
651 + * Fixed the initial set up of the argument and environment
652 + lists which were broken during the change to 2.1 style
653 + user memory access.
657 +Mon Jun 29 22:50:11 BST 1998
659 + * Put kernel_version definition back in emulate.c
662 + * Change loaders to set start_text, end_text, start_data,
663 + end_data, start_brk, brk fully.
667 +Thu Jun 25 21:18:11 BST 1998
669 + * Added support for the "fat" IPC structures which use
670 + 32 bit uids, gids etc.
674 +Wed Jun 24 21:30:09 BST 1998
676 + * Change suser() checks to use the new capable() calls.
679 + * Changed the CONFIG default to NOT support Xenix 286. It
680 + is an ever increasing build problem. It needs a volunteer
684 + * Add locking around system_utsname data using the uts_sem.
687 + * Changed to use dentry stuff. Use fget()/fput() to get
688 + file pointers rather than accessing task fd tables
689 + directly. Use poll interface for SYSV poll and timod
690 + blocking checks. Use lock_kernel()/unlock_kernel()
691 + around stat routines and other namei stuff. Use dput()
692 + to release dentries obtained with namei(). Other
693 + incidental fixes to what went before as I noticed them.
697 +Tue Jun 9 20:02:56 BST 1998
699 + * More changes for new module conventions.
702 + * Changed signal stuff to new conventions.
705 + * Changed getname() calling convention.
708 + * Changed fs type to mm_segment_t.
711 + * Changed user VM accesses to use new conventions.
715 +Sat Jun 6 20:30:00 BST 1998
717 + * Changed to new module conventions.
721 +Thu May 28 22:30:45 BST 1998
723 + * Removed VM_STACK_FLAGS tests.
726 + * Remove VM_GROWSDOWN tests.
729 + * Removed MAP_EXECUTABLE tests.
732 + * Removed MAP_DENYWRITE tests.
735 + * Removed STACK_TOP tests.
738 + * Removed FORKNOEXEC tests.
741 + * Removed INIT_MM tests.
745 +Mon May 18 22:49:56 BST 1998
747 + * Fixed xnx_rdchk() return value.
750 + * The serial number returned in the SCO utsname struct
751 + can now be set with sco_serial="..." as a module
752 + option. Some program apparently want to find a real,
753 + believable serial number there. This should be documented
754 + somewhere other than here I guess...
758 +Mon May 18 22:03:49 BST 1998
760 + * A class 't' ioctl with no arg type stuff in the top
761 + word is either an SVR4 tape ioctl a Coherent BSD-ish
766 +Mon Feb 2 22:57:45 GMT 1998
768 + * Other relatively minor changes to allow compilation
769 + under glibc (specifically 2.0.6 but it shouldn't
773 + * Added an explicit -I flag to search /usr/src/linux/include
774 + since glibc doesn't necessarily require the kernel
775 + includes to be symlinked under /usr/include.
778 + * The personality defaults in binfmt_coff should probably
779 + select short inodes on the assumption that newer stuff
780 + is likely to be built as ELF anyway. I hope.
784 +Wed Nov 19 19:28:07 GMT/BST 1997
786 + * Attempt to work around problems with sign extension
787 + when programs believe that the fs magic in a sysfs()
788 + call is short rather than long.
791 + * Added IPPROTO_IP/SOL_IP option name mapping for
792 + {get,set}sockopt. This is correct for SCO OS5 and
793 + hopefully for other SYSV derived Unices. Note that
794 + SCO OS5 ping still doesn't work because it uses an
795 + unsigned char for the IP_TTL value whereas Linux
796 + wants an int - and it objects to getting an error
797 + return. Apparently POSIX 1003g says IP_TTL should
798 + be an unsigned char so OS5, or at least its ping,
799 + is at fault. This probably isn't worth hacking
800 + around unless someone _really_ needs it.
804 +Wed Nov 12 22:28:19 GMT/BST 1997
806 + * Added the SCO-ish syscall shortcut to the socksys
811 +Fri Nov 7 20:13:05 GMT/BST 1997
813 + * Oops, I installed the SCO signal tables in the old
814 + personality mapping but forgot to create a specific
815 + SCO personality using them.
819 +Thu Nov 6 08:04:37 GMT/BST 1997
821 + * No, it really should be USR1 for URG under SCO, not
822 + USR2. This is according to the SCO Network Programmer's
823 + documentation. The previous problem was because
824 + confusion between the SVR4 and SCO/SVR3 requirements
825 + prevented a SCO program from registering a handler
826 + for the right signal, I think.
830 +Wed Nov 5 14:23:22 GMT/BST 1997
832 + * Created a new signal mapping for SCO and mapped
833 + Linux SIGURG to SCO SIGUSR2. Also changed the
834 + plain ibcs mapping for SIGURG back to IBCS_SIGURG.
835 + Previously I had SIGURG mapped to SIGUSR1 for
836 + what my subconscious says was a good reason but
837 + I can't figure out where I got it from. The USR2
838 + mapping is according to Peter Brueckner - and if
839 + it works for him...
843 +Wed Nov 5 09:14:27 GMT/BST 1997
845 + * Repair the STREAMS based socket code. The new socket
846 + hashing in 2.0.30 and beyond means the old code no
847 + longer works. We now delay replacing the fd with
848 + a socket until the first read, write or ioctl. Since
849 + the open has completed at this stage and the fd is
850 + fully initialized we can then use dup() to do the
851 + fd switch, which should always work. As a side effect
852 + this allows us to auto-connect an SPX pipe to X :0
853 + if the first operation is other than a single character
854 + write - which should allow us to handle v. old SVR3
855 + X programs side by side with their more modern, and
856 + common, multi-SPX pipe descendants.
857 + This does mean that some error returns from an
858 + open of a TLI special file might be delayed until
859 + the first operation, however a) these are unlikely
860 + to occur (they are things like no such protocol)
861 + and b) most opens of such files are hidden in
862 + functions like t_open() anyway so if there is a
863 + problem a simple fix to libnsl to check the first
864 + ioctl is all that is needed.
867 + * sysfs() used to enumerate available filesystems seems
868 + to be 0 based on Linux but 1 based on SYSV.
872 +Sun Oct 12 00:18:33 GMT/BST 1997
873 + * Ioctls on the NFS pseudo device need to go via the
874 + emulation code rather than the native ioctl handler.
878 +Sat Aug 16 14:56:24 GMT/BST 1997
880 + * Changed the use of errno in a prototype in ibcs.h to
881 + avoid possible conflict with an SMP errno definition
882 + which could get inherited from an include file if we
887 +Sat Jul 12 01:00:00 GMT/BST 1997
889 + * Added Xenix locking() modes 5, 6, 7 as per patch from
890 + David Bruce <admin@hulcote.com> (there were others
891 + too). I rewrote it to be a bit cleaner but I haven't
892 + tested it (it's late...). Some one will tell me I guess.
895 +Fri Jul 11 22:27:13 GMT/BST 1997
897 + * Added more console ioctl traps to discourage programs
898 + from trying to do funky stuff with the console without
899 + logging unsupported ioctl messages.
902 + * sysfs() can, apparently, map an fs magic number to
903 + an fs name. We do this outside the kernel sysfs()
904 + because there seems no clean way to do it. We simply
905 + have a list of known magic numbers hard coded :-(.
908 + * Implemented sysconfig(). This is appears to be the SVR4
909 + forerunner to the POSIX sysconf().
913 +Tue May 13 20:52:05 GMT/BST 1997
915 + * Hand off xmknod calls via ibcs_mknod so that we can
916 + create a directory if that is what the flags imply.
917 + I have not tested to see if xmknod is allowed to create
918 + directories - I just noticed it in passing.
921 + * Added SCO's F_GETHFDO (get highest fd open) fcntl. This is
922 + used by /bin/csh on SCO OS5 to save a few syscalls.
926 +Tue May 13 00:10:09 GMT/BST 1997
928 + * More changes to handle long/short inode environments
929 + plus more explanation in the code. Are we having fun yet?
933 +Sat May 10 15:19:39 GMT/BST 1997
935 + * Added socketpair() to the socksys emulation. This is
936 + as implemented by SCO OpenServer 5.
939 + * Change binfmt_coff.c to recognise programs compiled for
940 + SCO OpenServer 5, programs compiled for SCO 3.2.4 and
941 + programs compiled under SCO OpenServer 5 but with
942 + compatibility for ODT3.0. Why? Well, sometimes we
943 + should be giving long inodes in returns from getdents,
944 + sometimes short inodes. We don't just want to mask
945 + off the high part because that can lead to some
946 + things becoming invisible. We don't want that.
950 +Fri May 9 23:29:37 GMT/BST 1997
952 + * Added some more tape ioctls.
956 +Wed Apr 16 23:12:37 GMT/BST 1997
958 + * Fix memory leaks in poll.c and change ENOMEM return
963 +Tue Mar 11 21:29:15 GMT/BST 1997
965 + * Add {get,set}rlimit to the SYSV personalities.
969 +Fri Mar 7 21:04:24 GMT/BST 1997
971 + * Only build x286emul if EMU_X286 is enabled in CONFIG. There
972 + are many insallations which appear to either not have the
973 + a.out compiler support or have it installed incorrectly.
977 +Tue Feb 18 22:04:39 GMT/BST 1997
979 + * Removed unnecessary and incorrect includes.
983 +Wed Feb 12 22:03:13 GMT/BST 1997
985 + * Documentation updates for release.
989 +Mon Feb 10 22:36:27 GMT/BST 1997
991 + * Dammit! The inode folding in stat() and getdents() was
992 + out of step _again_ :-(.
996 +Sun Jan 5 17:20:20 GMT/BST 1997
998 + * sysconf(_SC_CLK_TCK) should return the value of HZ.
1001 + * Small clarification to README concerning shared libraries.
1004 + * Removed the bit about UnixWare X binaries not working from
1005 + Doc/HINTS. Now we have STREAMS/TLI emulation this is no
1006 + longer true (and hasn't been for a while).
1010 +Sat Jan 4 19:31:26 GMT/BST 1997
1012 + * If we open() something that is really a socket we close
1013 + it and reopen it using socket(), connect(). This allows
1014 + a Unix domain socket to look like a named pipe which
1015 + enables more SYSV X clients to connect to a local X
1016 + server using the local method (with suitable symlinks
1017 + to map the pathnames).
1021 +Fri Jan 3 22:39:15 GMT/BST 1997
1023 + * Added a (simplistic) implementation of the I_CANPUT SVR4
1027 + * Changed CONFIG.i386 to note that a correct setting of SMP
1032 +Wed Oct 2 16:28:39 GMT/BST 1996
1034 + * Intercept mknod() and allow it to create directories. Linux
1035 + doesn't allow this but SYSV does. (What about BSD?)
1039 +Wed Oct 2 15:56:57 GMT/BST 1996
1041 + * Separated out the spx connect code so we can support old,
1042 + single connection spx implementations once we know how to
1046 +Wed Oct 2 15:54:45 GMT/BST 1996
1048 + * At some stage I add some binfmt_elf.c changes that were
1049 + made to the kernel ELF loader in some 2.0.x patch. I forget
1050 + which now but no one should be using the iBCS ELF loader
1055 +Fri Aug 23 15:42:04 GMT/BST 1996
1057 + * Moved svr4sig to the right place.
1060 + * Moved error message strings to a separate file so they can
1061 + be shared by emulate.c and solaris.c.
1064 + * CONFIG files now define ARCH to be the CPU architecture. This
1065 + is used to ensure that architecture specific files are only
1066 + used when necessary.
1069 + * Changed the getdents routine in open.c to use the same
1070 + rules for folding 32 bit inodes to 16 as stat and read.
1074 +Mon Aug 19 13:33:42 GMT/BST 1996
1076 + * Correct IPC problem introduced with Sparc changes.
1080 +Fri Aug 9 13:27:49 GMT/BST 1996
1082 + * Fix the inode swapping for /dev/spx and XTI/TLI transports.
1085 + * If a COFF binary doesn't have a .comment section we have no
1086 + way to tell what personality we should be using. Switch to
1087 + SCO anyway - odds on it is.
1091 +Wed Aug 7 14:22:11 GMT/BST 1996
1093 + * On SCO at least lseek on a character or block device
1094 + returns 0 not -ESPIPE.
1095 + -- C.A. Lademann <cal@zls.com>
1097 + * Some problems with /dev/spx and TLI end point handling that
1098 + could leak descriptors, memory and leave the lists of file
1099 + locks in an inconsistent state. Not to mention the fact that
1100 + the socket data in an inode also contains a pointer back to
1101 + the process' file structure. I _think_ I have this sorted
1105 + * Sparc changes broke select. While I was at it I changed it
1106 + to use the newselect Linux call as well. If we build without
1107 + tracing we'll save a few more bytes of code now too.
1111 +Wed Jul 31 14:16:38 GMT/BST 1996
1113 + * Map EAGAIN to EWOULDBLOCK for recv*() and send*() syscalls.
1114 + Linux seems to return EAGAIN. X/Open allows either EAGAIN
1115 + or EWOULDBLOCK. SVR4 and Wyse V/386 specify EWOULDBLOCK in
1116 + their man pages. SCO doesn't admit to non-blocking possibilities
1117 + in their man pages but some code seems to expect only
1122 +Mon Jul 29 16:58:11 GMT/BST 1996
1124 + * Added a CONFIG option for SMP. This is enabled by default.
1125 + I don't think this is a problem for non-SMP systems?
1128 + * Minor change to the SCO error map.
1132 +Fri Jul 26 09:13:43 GMT/BST 1996
1134 + * Updated README and RELEASE
1137 + * Merged Sparc patches from:
1138 + Miguel de Icaza <miguel@roxanne.nuclecu.unam.mx>
1142 +Thu Jul 4 12:24:06 GMT/BST 1996
1144 + * The default is now *not* to build a versioned module. I got
1145 + too many questions about why it wouldn't compile.
1148 + * Fix to binfmt_xout.c when Xenix 286 is emulation is not
1153 +Fri Jun 14 13:36:18 GMT/BST 1996
1155 + * Added code to explicitly fail the SCO LD?MAP ioctls used
1156 + for channel mapping.
1160 +Thu Jun 6 17:21:00 GMT/BST 1996
1162 + * Cleaned up Stephans SCO tape ioctls and added the
1163 + corresponding SVR4 versions (untested).
1167 +Wed Jun 5 10:47:24 GMT/BST 1996
1169 + * Rewritten the Xenix locking() syscall. The previous one
1173 + * Change the read on directory emulation to fold long inodes
1174 + to shorts in the same way as stat and getdents. This may
1175 + help old programs that use stat and read to do a getcwd
1176 + rather than a stat and getdents.
1179 + * Use __get_free_page instead of get_free_page in getdents
1180 + since we don't need the buffer cleared initially (I think).
1184 +Sat Jun 1 09:50:30 MET DST 1996
1185 + * Added some tape ioctrls for SCO to iBCSemul/ioctl.c.
1189 +Fri May 31 08:44:51 GMT/BST 1996
1191 + * Move bsdioctl.c to the main group of source files from
1192 + than the BSD specifics. Just about everything else has
1193 + BSD style sgtty stuff and some seemingly modern code
1194 + actually depends on it (e.g. ISC SVR4 telnet)!
1197 + * Add CONFIG option to build a versioned module.
1200 + * Install the modules in /lib/modules/`uname -r`/misc for
1201 + compatibility with the modules tools.
1204 + * If the requested connection indications in a bind request
1205 + is greater than zero do a listen() if the bind is successful.
1206 + We still also do a listen() if the program selects() on
1207 + a bound but unconnected stream. This may help some broken
1208 + programs. It may also break some broken programs. It's
1209 + debatable whether this should now be in or out.
1212 + * The bit vector mapping used for converting vectors of
1213 + signal flags had an off by one error. The signal maps
1214 + themselves were also one entry short.
1217 + * At some stage I changed the I_SETOWN STREAMS ioctl but
1218 + never committed it?
1222 +Thu May 9 12:51:10 GMT/BST 1996
1224 + * Change to install in /lib/modules/`uname -r`/misc instead
1225 + of /usr/lib/modules for compatibility with the way the
1226 + modules tools have gone.
1230 +Thu Apr 25 12:34:06 GMT/BST 1996
1232 + * Use the CONIND_number in a T_BIND_REQ to decide whether
1233 + or not we should listen() on the socket.
1237 +Mon Apr 22 15:42:47 GMT/BST 1996
1239 + * Added a simple loader that will attempt to pass scripts
1240 + that start with ":" and things that look like simple text
1241 + to /bin/sh. Hopefully this isn't going to conflict with
1242 + magic for other needed formats...
1246 +Fri Mar 29 17:11:35 GMT/BST 1996
1248 + * Committing the all new TLI/XTI options handling. Note that
1249 + TLI and XTI option handling is mutually exclusive at the
1250 + moment. The default is to enable TLI options handling since
1251 + that is what existing SVR3/4 systems use. I haven't found
1252 + one that actually handles X/Open format (they use the
1253 + TNOTSUPPORT cop out) so I don't know how the stack is
1254 + told to use XTI format instead of TLI.
1255 + Note that only SOL_SOCKET/* and SOL_TCP/TCP_NDELAY are
1256 + known to work to any extent at the moment. Others may (or
1257 + may not need mapping) but I can't find the motivation to
1258 + wade through the headers and create yet another table of
1259 + magic numbers. Hopefully everyone just nicked the BSD
1263 + * Some more 1.3.7x changes related to process accounting
1264 + (fork but no exec etc.).
1268 +Wed Mar 20 13:36:07 GMT/BST 1996
1270 + * I seem to have forgotten to add a comment about merging
1271 + changes from mid 1.3.7x kernels.
1275 +Wed Feb 28 14:53:00 GMT/BST 1996
1277 + * Fix to shared library loader in binfmt_aout.c from kernel
1282 +Wed Jan 24 09:58:34 GMT/BST 1996
1284 + * Implemented I_PEEK.
1287 + * Changed I_NREAD to understand that control messages constitute
1292 +Fri Jan 19 11:57:20 GMT/BST 1996
1294 + * Make the socket level connect in timod.c happen synchronously
1295 + always. Allowing the async possibility is a little harder.
1299 +Thu Jan 18 16:06:13 GMT/BST 1996
1301 + * Added (some of) the intial framework for option management.
1302 + This is documented by X/Open but many XTI stacks don't
1303 + seem to implement it. Certainly the man page for t_optmgmt
1304 + in SCO OS5 says it isn't yet implemented. There do seem
1305 + to be programs out there that make options requests though.
1306 + Unfortunately I don't have one right now so this is currently
1307 + disabled and MAY CAUSE KERNEL FAULTS. I don't know...
1311 +Tue Jan 16 12:35:21 GMT/BST 1996
1313 + * Added a slight change to mmap.c. The SVR4 headers describe
1314 + a slight change in functionality which is specified with
1315 + a special flag that is supposedly set by the C library
1316 + interface. I haven't actually seen this flag set by the
1317 + SVR4 dynamic loader (which is the only mmapper I've seen)
1318 + and things seem to work with or without this change. It
1319 + may not be necessary at all?
1323 +Fri Jan 12 14:56:38 GMT/BST 1996
1325 + * Remove trace flag from context() in the callmaps. SVR4's
1326 + /bin/sh seems to use it but doesn't care if it fails.
1329 + * Added the SCO OS5 SI86GETFEATURES request to sysi86(). OS5
1330 + uses this to establish what "features" are available when
1331 + a program starts (i.e. in crt*.o). Currently we just return
1332 + the same vector as OS5 itself. I haven't found what the
1333 + flags mean - but one of them indicates xstat extensions
1334 + which I have added to iBCS.
1337 + * Change .comment parsers in binfmt_coff.c and binfmt_elf.c
1338 + so we only grab a single page (asking for two contiguous
1339 + pages is antisocial) and then roll through the comment
1340 + section in stages.
1343 + * Fixes to binfmt_elf.c and binfmt_aout.c so they compile
1344 + and load with 1.3 kernels.
1348 +Tue Jan 9 14:29:49 GMT/BST 1996
1350 + * Add a kludge to the TLI connect code. For some reason, under
1351 + ISC SVR4, telnet seems to gve the port number in network
1352 + byte order ok but the X programs give it in host byte order.
1353 + One of them is wrong but presumably both work on ISC (I don't
1354 + have the hardware to actually install it). We kludge around
1355 + it here by checking if we are SVR4, AF_INET, port 6000 (host
1356 + order) and, if so, change it to port 6000 (network order).
1357 + This will break anything that wants to make an outgoing
1358 + call to port 28695. There are probably other things that
1359 + expect incorrect port numbers to work but there seems to
1360 + be no easy solution here.
1364 +Fri Jan 5 13:34:43 GMT/BST 1996
1366 + * First draft of code to handle select/poll on transport end
1367 + points correctly. This isn't well tested but should be good
1368 + enough to support normal timod usage.
1372 +Thu Jan 4 13:52:25 GMT/BST 1996
1374 + * TLI changes to get error returns from connects correctly.
1378 +Wed Jan 3 17:06:07 GMT/BST 1996
1380 + * Added a manual page in the Doc directory. This is not
1381 + installed by default.
1384 + * Fixed a problem in the .comment parsers in binfmt_elf.c
1385 + and binfmt_coff.c where a number of pages was passed to
1386 + __get_free_pages() instead of a binary power. This has
1387 + been in release versions of binfmt_coff.c for a long
1388 + time but exactly one person has reported anything that
1389 + might be attributable to it. Strange, since the bug should
1390 + have manifested itself as insidious memory leakage and
1395 +Wed Jan 3 12:16:47 GMT/BST 1996
1397 + * Removed all kernel patches in the Patches directory. None
1398 + should be need for kernels 1.3.50 (or earlier?) and onwards.
1399 + None should be essential for 1.2.13 - although some capability
1400 + is lost notably SCO OpenServer 5 ELF binaries (if the kernel
1401 + ELF loader is present) and BSD a.out binaries.
1404 + * Another fix to termio[s] ioctls to get the control character
1405 + settings right for SVR4. Previously this was just copied
1406 + from the SCO mapping and just never got changed.
1410 +Thu Dec 14 10:41:36 GMT 1995
1412 + * Added basic getpmsg/putpmsg support. It doesn't do anything
1413 + with bands but we don't have anyway to use them.
1417 +Tue Dec 12 09:38:01 GMT 1995
1419 + * First commit of the major TLI rewrite for Eric Sixt. This
1420 + should be enough for normal TCP & UDP clients. It may be
1421 + sufficient for servers as well but this is untested so far.
1422 + The client stuff has been tested with SCO cu, ISC telnet
1423 + and custom test code down to the getmsg/putmsg level. A shared
1424 + libnsl_s is also included. This has the functions needed for
1425 + clients but lacks some needed for servers currently. It has
1426 + been tested on a real SCO system. It could be done better
1427 + (and should be) but for now we are interested in making existing
1428 + programs work rather than handling all the error conditions
1429 + by the book. The library uses SVR3 shared library tools and
1430 + needs to be built on an SVR3 system (I used SCO).
1431 + Included is a rewrite of the /dev/spx kludging (the old didn't
1432 + work if TLI was enabled). This now allows connections to other
1433 + than /tmp/.X11-unix/X0 (if configured) so you can run multiple
1434 + X servers on the VCs and display SCO X programs on all of them.
1435 + The major/minor numbers used for the emulation devices have
1436 + (necessarily) changed. The top level Makefile will (re)create
1437 + them on a "make install" or "make devices".
1438 + Oh yeah, I built stubs for other libraries as well (specifically
1439 + SCO/SecureWare protlib_s) but don't expect it to have any real
1440 + support. If programs _really_ need stuff from there they are
1441 + like to have reduced or completely broken functionality on
1443 + The script I used to generate the skeleton APIs for the
1444 + shared libraries is libs/mkltab if anyone feels the urge to
1445 + look at other libraries...
1448 + * Removed the old quota compile option. It isn't compatible with
1449 + the quota stuff in 1.3.46 and would only cause confusion. This
1450 + means you can't use iBCS if you have the old quota patches
1451 + in a pre-1.3.46 kernel. Tough :-).
1455 +Mon Dec 11 15:14:46 GMT 1995
1457 + * Map I_SETSIG/I_GETSIG to FIOSETOWN/FIOGETOWN and pray...
1460 + * Fixed possible memory leak in COFF & ELF personality recognition
1461 + when the offset/size of the .comments section is invalid. This
1462 + could leak when the .comments section exists but is zero bytes
1467 +Wed Dec 6 11:31:27 GMT 1995
1469 + * A stat of a file must give an inode that matches what we get
1470 + from a read of the directory since code that figures out cwd
1471 + needs the inodes to match. Mind you, if there are several inode
1472 + numbers greater than 65534 in the directory we are going to get
1473 + some strange paths. I don't know if this is fixable properly at
1477 + * Yes it is. We just mask off the high word to get the short
1478 + inode number for the stat structure.
1482 +Thu Nov 30 16:21:32 GMT 1995
1484 + * Fix the SVR4 additions to the V7 terminal ioctls. Add handling
1485 + of TIOC[GS]ETD. Have TIOCL[GS]ET trivially succeed (I can't
1486 + find the documentation for the arguments).
1490 +Wed Nov 29 12:57:42 GMT 1995
1492 + * Changed the guesswork svr4_waitsys to implement the correct
1496 + * Enable the i486-linuxaout option in x286emul/Makefile by
1497 + default. There seem to be significant numbers of people
1498 + using ELF compilers now. This may be a mistake...
1501 + * Fixes to sigsuspend and sigpause in signal.c. The previous
1502 + invocations of the Linux sigsuspend syscall were wrong and
1503 + liable to lead to random freeze ups of programs which used
1504 + sigsuspend() or sigpause().
1508 +Fri Nov 24 11:03:01 GMT 1995
1510 + * Interactive SVR4 seems to be overloading the BSD termio
1511 + ioctls with its own.
1514 + * The SVR4 procid subcodes don't match the SCO ones. Or, at
1515 + least, I seem to remember I got the orignal set from SCO
1516 + and UnixWare and Interactive SVR4 are different (but match
1521 +Thu Nov 23 17:21:56 GMT 1995
1523 + * Interactive SVR4's /bin/sh calls access(..., 011) but Linux
1524 + returns EINVAL if the access mode has any other bits than
1525 + 007 set. So we have to wrap it and mask it :-(.
1529 +Wed Nov 22 10:11:49 GMT 1995
1531 + * Change to binfmt_elf.c to set total_vm value introduced in
1536 +Thu Nov 16 15:02:58 GMT 1995
1538 + * Added support for SCO OpenServer 5 binaries using .comment
1539 + section parsing as with COFF.
1540 + Built a BSD capable a.out loader as part of iBCS.
1541 + The iBCS ELF loader is only used for recognised (using
1542 + .comments) binaries if the standard ELF loader is configured
1543 + in the kernel iBCS is built against. If the ELF loader is
1544 + not configured in the kernel iBCS is built against the iBCS
1545 + ELF loader is used for all ELF binaries. This prevents the
1546 + iBCS module from becoming un-unloadable on ELF based Linux
1548 + Similarly the iBCS a.out loader tries to avoid dealing
1549 + with anything other than BSD binaries for the same reasons.
1550 + This requires a kernel 1.3.42 or greater to allow iBCS
1551 + to insert its loaders into the list before the standard
1552 + kernel ones. Kernels 1.3.39(~) to 1.3.41 have some support
1553 + but there are bugs which will likely prevent you running
1554 + *anything* as soon as iBCS is loaded. Mea culpa. Tough.
1558 +Thu Nov 16 11:00:08 GMT 1995
1560 + * Minor clean up in binfmt_coff.c and fix a minor bug in
1561 + parse_comments that caused it to miss checking a string
1562 + if there was a zero length string in among.
1566 +Fri Nov 10 12:22:05 GMT 1995
1568 + * Changes for latest module bogosities (~1.3.38). We need to
1569 + define __NO_VERSION__ to avoid linux/module.h putting
1570 + a kernel_version in *every* damn file.
1574 +Tue Nov 7 10:55:05 GMT 1995
1576 + * When stealing temp space from the stack we have to actually
1577 + move esp down and then restore it as the 1.3.x kernels add
1578 + a check to trap out of bounds stack accesses. This is not
1579 + tested but I think it only affects the TLI emulation code
1580 + which is disabled by default.
1584 +Mon Oct 9 11:22:29 BST 1995
1586 + * Use kernel readv/writev if available.
1590 +Thu Sep 14 12:21:48 BST 1995
1592 + * Changed references to current->sigaction to allow for the
1593 + changes in kernel patch 1.3.26 which allow sharing of signal
1594 + state between clone processes.
1598 +Mon Sep 4 10:04:22 BST 1995
1599 + Originally: Wed Aug 2 09:57:56 GMT 1995
1601 + * Removed Xenix interrupt bug, created wait() workaround
1602 + for INFORMIX-SQL and built the locking() to fcntl()
1604 + -- Peter <polte@bbtt.com>
1607 +Wed Aug 30 09:19:54 BST 1995
1609 + * Merged kernel patch for binfmt_elf.c from 1.3.21 which sets
1610 + EDX to zero on process start up. See the comment in the code
1615 +Tue Aug 29 08:44:50 BST 1995
1617 + * Workaround. Local X won't work because a putmsg occurs
1618 + after we have already swapped the open descriptor for a
1619 + Unix domain socket. We either need to peek at socket
1620 + internals or actually implement the messages for passing
1621 + file descriptors. This quick fix enables local X connections
1622 + if we build without XTI support.
1626 +Tue Aug 8 11:36:41 BST 1995
1628 + * Fix streams kludging so local X works again (should do
1629 + anyway - it's untested as yet due to hard disk collapse.
1630 + Hopefully someone will tell me if it doesn't work.)
1634 +Mon Jul 31 13:25:58 BST 1995
1636 + * Changes to allow compilation in the presence of a kernel
1637 + built with the quota patches.
1638 + -- Dimitrios Mpougoulias <dbougo@leon.nrcps.ariadne-t.gr>
1641 +Tue Jul 18 09:01:53 BST 1995
1643 + * Fixed timod getinfo ioctl. This functionality should move
1644 + into the message handling as bind has.
1648 +Mon Jul 17 10:16:43 BST 1995
1650 + * Added handling of BSD-ish sgtty ioctls. For some reason the
1651 + SVR4 network programs such as telnet have been modified to
1652 + pushd the ttold STREAMS modules and use sgtty calls instead
1653 + of simply using termio[s]. Don't blame me! :-)
1656 + * Restructuring of timod.c complete. Timod ioctls now use
1657 + message routines to avoid duplicating code.
1661 +Wed Jul 12 14:44:30 BST 1995
1663 + * Made debug output in binfmt_coff.c less verbose. We only
1664 + really care about matched comment strings. If we dump them
1665 + all here we overrun the kernel message buffer and miss
1666 + interesting stuff when the program actually starts running.
1669 + * Changed __get_free_pages in binfmt_coff.c to give the extra
1670 + argument required in 1.3 kernels.
1674 +Tue Jul 4 11:48:27 BST 1995
1676 + * Restructure timod.c ready to rewrite timod_ioctl to use
1677 + putmsg/getmsg rather than reimplementing the same message
1682 +Mon Jul 3 13:41:49 BST 1995
1684 + * Initial TLI support for outgoing TCP and UDP. Merged BSD/Wyse
1685 + socket ioctl handling with the socksys handler. Fixed (some)
1686 + bugs in poll() emulation. Devices in /dev/inet have changed
1687 + to support TLI access. See README for details.
1691 +Tue Jun 27 09:00:02 BST 1995
1693 + * Don't export symbols from iBCS. I'm not sure when register_symtab
1694 + was introduced so we only drop our symbol table in 1.3
1698 + * Added missing brackets in binfmt_elf.c as per kernel
1703 +Thu Jun 22 13:09:49 BST 1995
1705 + * Big step forward with TLI. I now seem to understand what is
1706 + happening when and have enough to do the initial open and
1707 + get info requests. This may one day actually work...
1710 + * Trap EUC ioctls and return EINVAL. We don't do EUC :-).
1713 + * Changes for the 1.3 development kernel. This compiles but is
1714 + as yet untested. It still seems ok with 1.2.10.
1718 +Wed Jun 14 09:15:39 BST 1995
1720 + * Added Eric's protection mapping fixes to binfmt_elf.c
1725 +Fri Jun 9 12:31:53 BST 1995
1727 + * Linux can't stat unmounted filesystems but SCO can (by
1728 + specifying the pathname/fd of a block device and the
1729 + filesystem type. Linux will just stat the filesystem
1730 + that the device node is on (i.e. the root filesystem).
1731 + There isn't much we can do about it. I just lie and
1732 + claim there is 100MB free of 1GB. I hope this won't
1733 + cause too much grief...
1737 +Thu May 18 12:06:50 BST 1995
1739 + * When trying to get an IP domain name don't try the utsname
1740 + domainname if it is "(none)". If we get that far we have to
1741 + give in and return a blank domain name.
1745 +Wed May 17 10:15:42 BST 1995
1747 + * Recheck the socket functions when accept returns a new socket.
1748 + This is pedantic at this stage since we must have had a
1749 + socket initially and the current kernel code isn't likely
1750 + to handle removal and reloading of in use modules. iBCS
1751 + can handle this happening to it though :-).
1754 + * Fix timod faking to correctly return an error if given an
1755 + invalid file descriptor rather than trying to dereference
1756 + a null pointer in kernel mode.
1760 +Tue Apr 25 11:35:43 BST 1995
1762 + * If nap() is given a zero timeout return immediately rather
1763 + than blocking indefinitely. Ensure that SIGALRM is not ignored
1764 + during the pause or we never get woken up by the timeout.
1768 +Mon Apr 24 09:21:30 BST 1995
1770 + * Various documentation updates from Eric.
1774 +Fri Apr 21 14:34:25 BST 1995
1776 + * Fixes to IPC. Now it really *should* work...
1780 +Thu Apr 13 14:03:45 BST 1995
1782 + * Tidy up documentation ready for new release.
1786 +Wed Apr 12 11:07:52 BST 1995
1788 + * Moved to an ELF development system with a GCC 2.6.4 snapshot.
1789 + This pointed out a few signed/unsigned mismatches so I
1790 + fixed them. We also have to ensure that x286emul is built
1791 + as a QMAGIC a.out because it won't work any other way. It
1792 + isn't likely to work any other way unless someone pays for
1793 + for it to be done - it isn't what you might call a "sexy"
1798 +Wed Apr 12 08:53:22 BST 1995
1800 + * Added the kernel patch to handle statically linked SVR4 ELF
1801 + binaries to the Patches directory since it doesn't seem to
1802 + have made any of the 1.2.x patches yet.
1806 +Tue Mar 28 09:55:38 BST 1995
1808 + * Made the ISC specific stuff optional via CONFIG.
1811 + * 1. INTERACTIVE UNIX signal numbers are different from IBCS2.
1812 + I added new signalmaps and exec_domains.
1813 + 2. setpgrp does not deattach the controlling terminal.
1814 + Try the setpgrp test program included here after the patch
1815 + on real SCO or xxxx and Linux/IBCS2.
1816 + 3. sigset behavior is incorrect. Test program also included.
1817 + Short description: signal handlers registered whith sigset
1818 + should run with the signal blocked, and after return
1819 + the handler must be restored, so sa_flags = 0
1820 + is the correct setting.
1821 + Calling sigset should remove the signal from the
1823 + -- Remete Gabor <rg@tomx.elte.hu>
1826 +Fri Mar 24 10:20:57 GMT 1995
1828 + * Set the fragment size to zero for [f]statfs() just to be
1829 + pedantic (SCO does this).
1833 +Tue Mar 21 10:24:14 GMT 1995
1835 + * Fixes to 286 overlay and x.out loader by Don Camp
1836 + <don@funsoft.com>.
1839 + * New code for SVR4 {get,set}groups since SVR4 uses longs
1840 + for gids whereas Linux uses shorts.
1844 +Mon Mar 20 17:06:23 GMT 1995
1846 + * Added code for waitsys(). This is guesswork at this stage
1847 + but appears sufficient for ISC 4.0 ksh to do something
1848 + reasonable in the simplest case.
1852 +Tue Mar 14 09:44:13 GMT 1995
1854 + * Initial implementation of ptrace. This allows programs
1855 + (SCO and Wyse V/386 programs) to access a process'
1856 + registers but actual tracing semantics will be difficult
1857 + to make functional.
1860 + * Alter emulate return to allow return of numbers > 2^^31
1861 + which don't fall in the error code space.
1864 + * Added signal mapping to wait() syscalls.
1867 + * Updated the main README with the vger mailing list details
1868 + and a few other tidy ups.
1872 +Thu Mar 9 10:10:53 GMT 1995
1874 + * Added a load more system calls to the SVR4 tables (these
1875 + match UnixWare at least I think). Some of these may work,
1876 + some are just marked to shut up run time warnings.
1879 + * Increased the size of the buffer used for parsing comment
1880 + sections in binfmt_coff.c to 8k (from 1k). There are
1881 + programs out there that need it.
1885 +Tue Mar 7 16:12:36 GMT 1995
1887 + * More XLI/TLI changes - mostly fixes.
1890 + * Added basic handling of the termiox extension used by SVR4
1891 + to give access to hardware flow control. Only RTS & CTS
1892 + or nothing is allowed because that's all Linux does. The
1893 + same comments as below apply to the status of this.
1896 + * Rework ioctl handling for termios. SCO uses short in a termios
1897 + structure, SVR4 uses longs. The bit shuffling used for SVR4 is
1898 + the same as for SCO - there are known to be some slight
1899 + differences but these are not believed to be critical for
1900 + most things. A large amount of guesswork went in to this.
1901 + One day I may be able to test it...
1905 +Mon Mar 6 12:31:05 GMT 1995
1907 + * Added a -DMODULE to iBCSemul/Makefile to make new style kernel
1912 +Fri Mar 3 15:04:14 GMT 1995
1914 + * Patches from Eric. (Use Eric's [f]statvfs instead of mine).
1918 +Thu Mar 2 11:46:03 GMT 1995
1920 + * Fixed a silly in the handling of SO_IMASOCKET and SO_PROTOTYPE
1921 + plus added a check on the given buffer length.
1924 + * Fixed a silly in the sockopt.inc options mapping.
1928 +Wed Mar 1 14:20:06 GMT 1995
1930 + * Added SVR4 console keyboard mapping and termcap/terminfo
1931 + options to the PROD.Patches directory.
1935 +Mon Feb 27 13:30:17 GMT 1995
1937 + * Added simpleminded implementation of [f]statvfs().
1940 + * [f]statfs() now respects the length argument to allow for
1941 + older/smartass code which uses a smaller buffer size.
1945 +Fri Feb 17 10:33:23 GMT 1995
1947 + * More tidy up, a little more work on TLI/XTI (still nowhere
1948 + near usable), fixed the signal debugging messages so it
1953 +Thu Feb 2 12:45:25 GMT 1995
1955 + * Changed the BSD termio ioctl handler to recognise the fact
1956 + that some provide V7 compatibility and may be invoked from
1957 + non-BSD binaries - possibly without BSD size encoding.
1960 + * Changes for 1.1.88. More definitions moved around in the
1961 + Linux header files :-).
1965 +Fri Jan 27 10:12:51 GMT 1995
1967 + * Also mapped new Linux SIGIO to iBCS SIGIO and changed Linux
1968 + SIGURG to map to SIGUSR1 as documented in SCO's TCP/IP
1969 + programmer's guide. Is SVR4 the same? How badly do we care?
1972 + * Had to add a new personality for Xenix binaries since they
1973 + have a different number for SIGPOLL - sigh...
1977 +Mon Jan 23 15:34:01 GMT 1995
1979 + * Changes to includes for 1.1.84.
1982 + * Change to binfmt_elf.c from kernel patch 1.1.84.
1986 +Tue Jan 17 17:10:25 GMT 1995
1988 + * Added tracing of argument and environment vectors passed
1993 +Mon Jan 16 11:34:58 GMT 1995
1995 + * Change socksys.c for 1.1.81. There doesn't seem to be a
1996 + convenient define to test but I intended to roll out
1997 + most of the "magic" define testing for 1.2 to clean
2001 + * Ensure the segment registers are correctly set up when we
2002 + exec a new program - the LDT we may have been using before
2007 +Fri Jan 6 11:32:52 GMT 1995
2009 + * Fixed a problem where the Xenix 286 emultor wasn't getting
2010 + the correct return and error codes from lcall7s.
2013 + * Added support for exec() in the Xenix 286 emulator.
2016 + * Made the spin-before-launch trap in binfmt_xout.c settable
2017 + via a trace option, "xout-block". This is used to attach
2018 + gdb to a 286 process to debug the emulator.
2021 + * Fixed a problem with binfmt_xout.c setting the wrong intial
2022 + brk value for impure segmented binaries. The checks for brk
2023 + collisions with mapped space were failing brk changes. Before
2024 + the brk checks were introduced I image we simply trashed
2029 +Thu Jan 5 11:21:51 GMT 1995
2031 + * Added some debug to the STREAMS I_PUSH and I_POP. Also made
2032 + them succeed without actually doing anything. We may be able
2033 + to work round some instances of STREAMS usage one day...
2037 +Wed Jan 4 11:17:14 GMT 1995
2039 + * Change yesterday's mkdir to use getname()/putname() to
2040 + fetch the pathname from user space. I hadn't realised
2041 + these were already in ksyms.c (although how long have they
2042 + been there? This breaks compatibility with older versions
2043 + of the kernel I guess).
2046 + * Implement the NIOC ioctls for getting file handles since
2047 + Oracle's TCP server seems to be wanting to do this for some
2048 + reason (why???). This is a simple implementation that simply
2049 + fills in the device number of the filesystem and the inode
2050 + number of the file. This seems to agree with what SCO is
2051 + doing. I don't know what the "exported" fields are or should be.
2055 +Tue Jan 3 14:31:13 GMT 1995
2057 + * POSIX says that a pathname ending with a '/' means the current
2058 + directory whereas SYSV drops the trailing slash. This is only
2059 + a problem with mkdir() I think.
2063 +Fri Dec 16 16:25:44 GMT 1994
2065 + * Added basic support for Wyse V/386 MPX syslocal().
2069 +Fri Dec 9 09:14:04 GMT 1994
2071 + * Changed eaccess() again. We should always set the uid/gid
2072 + rather than fsuid/fsgid since the Linux access() call is
2073 + getting fsuid/fsgid from the current uid/gid.
2076 + * Don't bother trying to read x.out segments which have no
2077 + data in the executable.
2081 +Thu Dec 8 11:51:06 GMT 1994
2083 + * Only include <linux/segment.h> if <asm/segment.h> hasn't
2084 + defined KERNEL_DS. The header in the linux subdirectory
2085 + was obsoleted in 1.1.69.
2089 +Fri Dec 2 13:50:03 GMT 1994
2091 + * Force QMAGIC format when building x286emul.
2094 + * Patches for 1.1.69.
2098 +Thu Dec 1 13:50:37 GMT 1994
2100 + * Binfmt_xout.c now checks the trace flag to see if debug messages
2101 + should be produced. Trace now has an "xout" option. Trace is
2102 + now a Linux binary which uses a personality() syscall to enable
2103 + emulation so the iBCS trace syscall becomes accessible.
2106 + * Changed binfmt_xout.c to use 0x1020 as the entry point for
2107 + the x286emul kludge overlay. This is the expected value
2108 + for a QMAGIC binary which is the default with the newest
2109 + compiler. Really I think uselib() should return something
2110 + useful but I haven't decided what.
2113 + * Made the schedule() trap (so gdb can be attached before the
2114 + process starts running) in binfmt_xout.c a CONFIG option
2115 + controlled by the XOUT_TRACE setting.
2118 + * Moved the configuration for the optional items out of Makefile
2123 +Wed Nov 30 17:08:05 GMT 1994
2125 + * Fixed a nasty bug in binfmt_coff.c where an extra page was
2126 + being allocated in the bss causing brk() checks in 1.1.64
2127 + and later to fail _in_certain_circumstances_.
2131 +Wed Nov 30 13:58:46 GMT 1994
2133 + * Added support for unpacking ioctls passed via the STREAMS
2134 + interface and forwarding them to the file descriptor. With
2135 + a slight change to socksys so that devices with minor 2 get
2136 + an anonymous dgram socket immediately they are opened this
2137 + allows many more network programs to work. Thanks to an old
2138 + piece of code from Chip Rosenthal for revealing how it all
2139 + worked - it isn't in the documentation :-).
2143 +Wed Nov 30 11:27:56 GMT 1994
2145 + * Fixed handling of brk and BSD sbrk so error returns are
2146 + handled correctly.
2149 +Mon Nov 28 10:48:25 GMT 1994
2151 + * When doing an IPC_STAT on a semaphore force the semaphore
2152 + number to be zero as the kernel code erroneously checks
2157 +Fri Nov 25 14:26:41 GMT 1994
2159 + * Massive rework of ipc.c. The previous one was buggy as hell.
2160 + This one works with all the demo programs from the Wyse V/386
2161 + IPC documentation. Hopefully someone is going to test it with
2162 + some *real* applications!
2166 +Tue Nov 22 09:11:46 GMT 1994
2168 + * Change the TTYDEVTYPE ioctl to say we on a pseudo terminal
2169 + rather than a console. Anything calling this is likely to
2170 + want to try fancy stuff like mapping the console memory
2171 + and playing with I/O ports if it thinks we are on a console.
2175 +Tue Nov 22 09:07:04 GMT 1994
2177 + * Allow direct usage of 57600 and 115200 serial speeds from
2178 + the BSD domain with kernels 1.1.65 and later.
2179 + The mask-and-merge for iBCS<->Linux termios should be checked
2180 + as we tend to try and preserve unmappable bits where there
2181 + is no other conflict. In 99% of cases we won't see a problem
2186 +Mon Nov 21 10:05:19 GMT 1994
2188 + * Slight change to previous patch. Confusion over which struct
2189 + size we should be using for the verify_area plus we need to
2190 + do a VERIFY_WRITE as we will rewrite the data before returning.
2193 + * Changes to ipc.c for reading structures from user space.
2194 + -- Roberto Bagnara <bagnara@di.unipi.it>
2197 +Thu Nov 17 15:24:23 GMT 1994
2199 + * Some of the unused KD ioctls were removed from Linux 1.1.64
2200 + (or was it 63?). Changed vtkd.c accordingly.
2204 +Fri Nov 11 14:15:09 GMT 1994
2206 + * Moved the x286emul overlay to /usr/lib instead of /lib. There
2207 + is no real need for this to be on the root filesystem.
2211 +Mon Nov 7 13:51:55 GMT 1994
2213 + * Added a version of the BSD exec.c patch for Linux 1.1.62.
2216 + * Extended SCO keyboard mapping for new kbd.
2220 +Tue Nov 1 10:57:18 GMT 1994
2222 + * Changed the personality test in the BSD kernel patch. Apparently
2223 + FreeBSD uses a machtype of 134 so it's safer to test for Linux
2228 +Fri Oct 28 11:25:43 GMT 1994
2230 + * General clean up of the configuration options in the Makefile
2231 + and elsewhere. It is now possible to choose which loaders are
2232 + included and whether or not BSD or Xenix 286 emulation is
2236 + * Added the x286emul overlay library. This is still very alpha
2237 + but SCO's /bin/masm seems to do the things expected of it :-).
2241 +Wed Oct 5 17:00:13 BST 1994
2243 + * Fleshed out the F_CHSIZE and F_RDCHK fcntls. I still don't
2244 + know if these are ever used from the user layer.
2248 +Tue Oct 4 13:17:32 BST 1994
2250 + * Fixed the BSD termios mappings. This _looks_ ok from the
2251 + point of view of the NetBSD stty.
2255 +Fri Sep 23 11:08:31 BST 1994
2257 + * Add SCO ODT version of CorelDraw to COMPAT file.
2261 +Thu Sep 22 09:25:04 BST 1994
2263 + * Added the phone numbers of McGraw Hill's order desk to the
2267 + * chsize() was causing a segment error. The callmap entry punted
2268 + to a Linux system call but the argument count was not negative
2269 + resulting in a call to a bad function pointer.
2272 + * Linux doesn't have the l_sysid field in struct flock so we need
2273 + to slide the l_pid field down a word after doing a locking
2278 +Tue Sep 20 10:31:01 BST 1994
2280 + * Added a simplistic implementation of writev since BSD seems
2281 + so keen to use it as much as possible.
2284 + * Fixed the x.out loader (mostly). This requires a minor patch
2285 + to the kernel. Expect this to be put in to the kernel itself
2286 + sometime after 1.1.51. Segment support is still buggy and
2287 + therefore disabled. If programs assume they know what segments
2288 + exist it they are broken anyway!
2292 +Wed Sep 14 11:24:18 BST 1994
2294 + * Added extra fcntl code 14 (used by SVR4 for GETLCK).
2298 +Tue Sep 6 10:58:49 BST 1994
2300 + * Added setting of fsuid/fsgid to the loaders and changed the
2301 + eaccess() function in xnx.c to flip fsuid/fsgid rather than
2302 + uid/gid. If you were having problems with setuid/setgid iBCS
2303 + binaries this is likely to help.
2307 +Mon Sep 5 15:07:06 BST 1994
2309 + * Fixed the bad initialisation of howcnv in signal.c.
2313 +Fri Sep 2 11:01:26 BST 1994
2315 + * Added a little program to the Tools subdirectory which will
2316 + restamp old binaries with the Linux machine type rather than
2317 + zero which is used by BSD. Once this is done you can reliably
2318 + distinguish between BSD and Linux binaries (the current Linux
2319 + linker will set the correct machine type on all new binaries).
2322 + * Updated the BSD patch.
2325 + * Changed binfmt_coff to avoid passing meaningless MAP_DENYWRITE
2326 + and MAP_EXECUTABLE flags to mmap when we are not actually
2327 + mapping from a file. It would probably never be a problem...
2331 +Tue Aug 23 17:21:45 BST 1994
2333 + * Added my device trace stub in case anyone needs to investigate
2334 + and emulate some special device.
2338 +Wed Aug 17 14:06:34 BST 1994
2340 + * Added an extern definition of the formats list needed by
2341 + the 1.0.x hooks. Presumably this went AWOL at some stage?
2345 +Fri Aug 12 09:52:38 BST 1994
2347 + * Slight change to the socksys major allocation. Removed
2348 + redundant error message.
2352 +Wed Aug 10 08:57:32 BST 1994
2354 + * Added the spelling corrections from the 1.1.42 kernel patch.
2358 +Fri Aug 5 10:05:14 BST 1994
2360 + * Added Scott Michel's SCO multiscreen patches.
2363 + * More changes to loaders for latest kernel changes.
2367 +Wed Jul 27 10:59:14 BST 1994
2369 + * Changes for 1.1.36 vm/mprotect.
2373 +Tue Jul 26 14:20:27 BST 1994
2375 + * Tidied up the system call maps a little. ISC is now handled
2376 + by the same maps as SCO.
2380 +Wed Jul 20 12:39:55 BST 1994
2382 + * Removed the lock.patch. This is in the latest kernels.
2385 + * Changed the socksys/SCO utsname stuff to do the right thing
2386 + if we have the hostname set to the fqdn and the domainname
2387 + set to the NIS domain. If hostname is not an fqdn we assume
2388 + we are using the domainname == IP domain convention.
2392 +Wed Jun 29 13:34:34 BST 1994
2394 + * Revised the lock.patch to fix the unlock problem and allow
2395 + locks on devices. This should go to Linus (and probably has).
2398 + * Removed the kernel 1.1.20 patch. This isn't needed as of
2403 +Mon Jun 27 09:26:24 BST 1994
2405 + * Can't use select() for nap() since the Linux select system
2406 + call expects to pull its arguments from the user stack.
2407 + Rewritten nap() using itimers.
2410 + * More fixes from Eric for 1.0 compatibility.
2414 +Fri Jun 24 09:37:50 BST 1994
2416 + * Added a bit about time zones to the HINTS file.
2419 + * First draft of BSD termios mapping. Still buggy. Needs
2420 + work to be useful.
2423 + * Fixed BSD getdirentries() to align dirents on long word
2424 + boundaries. 'ls' now works and 'tcsh' finds and executes
2425 + commands successfully.
2428 + * ibcs_exit should be listed in callmap.inc with arg count 1
2432 +Thu Jun 23 09:48:43 BST 1994
2434 + * Lots more BSD-ish stuff. Commit now for release since there is
2435 + confusion over versions at the moment.
2438 + * List Xess MOTIF spreadsheet in COMPAT file.
2439 + -- Michael K.Johnson <johnsonm@merengue.oit.unc.edu>
2441 + * When slurping in mis-aligned COFF binaries we shouldn't be
2442 + aligning the file offset and virtual address to a page
2446 + * Merged Eric's latest patches for 1.0 compatibility and Linux
2447 + ELF capability. This was done by hand. I think it's perfect...
2451 +Wed Jun 22 14:28:38 BST 1994
2453 + * Many sigsuspend entries in the callmap had argumetn counts
2454 + of 1 instead of Spl. This caused kernel faults.
2457 + * Implemented the ioctls for the pseudo nfs device which under
2458 + SCO is used to get/set the NIS domain. You need to link
2459 + /dev/nfsd to /dev/socksys.
2462 + * The socksys getdomainname() was doing the same write null to
2463 + kernel space instead of user space as the wysev386 version.
2467 +Tue Jun 21 08:54:34 BST 1994
2469 + * Use the map_bitvec() function (added as part of the BSD changes)
2470 + in signal.c. Note that there were quite a few mapping bugs in
2471 + the old code. I think I got them all but few would have been
2472 + triggered by my SCO and Wyse stuff.
2475 + * Snapshot BSD stuff again ready for release.
2478 + * binfmt_coff.c and binfmt_xout.c should be using mmap(NULL,...)
2479 + instead of zeromap_page_range as this will create the vm area
2480 + descriptor as well as mapping the pages. This is needed for
2481 + the verify_area() in 1.1.20 which has tighter checks than
2482 + previous versions.
2485 + * Map stack region as a GROWSDOWN vm area in binfmt_elf.c
2489 +Fri Jun 17 16:42:59 BST 1994
2491 + * Major and on going work to add BSD support (optional - see the
2492 + Makefile). I'm committing this now so I have a current tree
2493 + ready for release when Linus goes to 1.1.20.
2496 + * Wyse get{host,domain}name were using direct assignment to add
2497 + a trailing null instead of put_fs_byte(). Oops...
2500 + * Changes for execution domain support which will be in the main
2501 + kernel as of 1.1.20. This allows easy registration of lcall7
2502 + handlers, binary loaders etc. for different personalities.
2506 +Fri Jun 10 10:12:55 BST 1994
2508 + * Added patch file for kernel locking from Niklas Hallqvist
2509 + <niklas@appli.se>. This (or something very similar) should
2510 + end up in the kernel at some stage.
2513 + * Merged Eric's changes for 1.0 compatibilty - or rather didn't.
2514 + After playing with diff for quite a while I finally realised
2515 + we'd both done exactly the same changes :-). However Eric
2516 + has tested them...
2519 + * Added Brandon's iBCS trace binary from Eric's 1.0 compatibility
2524 +Thu Jun 9 10:22:56 BST 1994
2526 + * Mapped msgsys to ibcs_msgsys in callmap.inc. It existed, we
2527 + just didn't admit it before :-).
2531 +Tue Jun 7 08:50:34 BST 1994
2533 + * Sorted out some more ioctl stuff and added a handler for the
2534 + STREAMS ioctl set. This is needed for I_NREAD (number of
2535 + characters readable). Some SYSV X libraries contain implicit
2536 + assumptions that the X connection is via a STREAM and use
2537 + I_NREAD in preference to BSD/socket FIONREAD.
2540 + * Oh, Jeez... The changes made for the official kernel patches
2541 + completely shafted the 1.0 compatibility. I've remerged the
2542 + previous code with the new code - there may still be some
2543 + things that need pulling back though. At this point I don't
2544 + have a 1.0 kernel tree around to test against.
2547 + * If a COFF program is not correctly aligned disable demand
2548 + paging and resort to slurping the whole lot in at start up.
2551 + * Added missing -I../include to the Tools Makefile.
2555 +Fri Jun 3 11:53:21 BST 1994
2557 + * Added my virtual system tools. A virtualised SCO 3.2.4
2558 + system is usable for real work for me...
2561 + * Added the synchronous ioctl set. This conflicts with the
2562 + SCO 3.2.x (x < 4) ioctl for getting the video map so it should
2563 + be dependent on the file descriptor it is applied to but since
2564 + we don't currently support either...
2568 +Thu Jun 2 17:02:26 BST 1994
2570 + * Added support for FIORDCHK ioctl. SCO says it's there for
2571 + "backward compatibility" but the system programs still
2572 + seem to use it (notably ksh).
2576 +Tue May 31 13:39:34 BST 1994
2578 + * Patches to sysfs.c for 1.0.x compatibility from Tor with
2579 + some extra clean up.
2583 +Fri May 27 09:15:21 BST 1994
2585 + * Ensure we set up signal() handlers as SA_ONESHOT and sigaction()
2586 + handlers as sticky - similar to patch from Remete Gabor.
2589 + * Added the SCO cxenix sigaction extensions. Barely tested...
2592 + * Added the cxenix {get,set}itimer calls discovered on SCO by
2593 + Brandon. Currently these are directly mapped to the Linux
2594 + syscalls. They are undocumented by SCO (as far as we know)
2595 + and untested by us (for now).
2599 +Thu May 26 11:58:18 BST 1994
2601 + * Don't include the 0.0.0.0 to localhost address mapping if we
2602 + are building for 1.1.15+. This is mapped in the kernel as of
2603 + 1.1.6 and since we don't support 1.1 kernels before 15...
2606 + * Type of signal map vectors should be unsigned long not int.
2609 + * Allow tracing to be compiled in to the COFF loader and turned
2610 + on and off with the Tools/trace program.
2613 + * Signal maps moved out to maps/signal.inc. The only special
2614 + mapping that happens is for ISC which has a problem with
2615 + Oracle sending SIGSTOP to its backend when SIGSTOP doesn't
2616 + appear to be defined for ISC. We just map SIGSTOP to 0 so
2617 + it appears to work but does nothing.
2620 + * Changes for 1.1.15. This will not work with kernels between
2621 + 1.1.10 and 1.1.14 inclusive - guaranteed. It should still
2622 + work with the 1.0.x series but has not been tested recently.
2623 + It probably works against 1.1.0 to 1.1.13 inclusive but that
2624 + is purely coincidence - you shouldn't be using old 1.1.x
2625 + kernels as it's a development series.
2629 +Tue May 24 17:27:54 1994 Eric Youngdale (eric@tantalus)
2631 + * binfmt_xout.c: Use linux_binfmt struct, register_binfmt,
2632 + unregister_binfmt as in pl14.
2634 + * binfmt_elf.c, binfmt_xout.c: Likewise.
2636 + * signals.c: Make signals[] and lsignals[] global variables.
2638 + * ibcs/include/ibcs.h: Add prototypes for signals[] and lsignals[].
2641 +Tue May 24 10:37:01 BST 1994
2643 + * Added map entries for the ISC personality to all the maps
2644 + files. Must be more careful adding personalities.
2647 + * Added Oracle to the COMPAT file.
2650 + * Remember the problem with interrupting an Informix 4GL program
2651 + causing it to go psycho because of I/O errors from the tty?
2652 + Well, this doesn't happen with the new tty drivers in 1.1.13.
2653 + I never found why it happened...
2656 + * Noted that the 1.1.11 kernel patches are still ok with 1.1.13.
2660 +Mon May 23 08:50:21 BST 1994
2662 + * Mapped ISC sysconf() to the existing Xenix sysconf(). This
2663 + looks right but isn't checked at all.
2666 + * Added ISC TCSETPGRP and TCGETPGRP ioctl traps.
2670 +Thu May 19 09:26:34 BST 1994
2672 + * Added a bug hunting section to the README.
2675 + * Always access the socket layer by picking up the file operations
2676 + from an open socket descriptor. This removes the need for
2677 + kernel socket functions to be global and should be friendlier
2678 + towards a loadable socket layer one day.
2682 +Mon May 16 10:20:38 BST 1994
2684 + * Always access system calls via the system call table regardless
2685 + of whether we are using a loadable module or linking directly
2686 + to the kernel. This allows other things to be loadable too.
2690 +Wed May 11 13:52:12 BST 1994
2692 + * Added a tip on how to fix X font problems to the HINTS file.
2693 + Other "soft" changes welcome. Does anyone read the ChangeLog?
2696 + * Introduced the PROD.Patches directory and put the WP install
2697 + fixes in there. Documented in COMPAT and README.
2700 + * Added some hints on incompatible shell behaviour.
2704 +Mon May 9 11:07:52 BST 1994
2706 + * Updated the 1.1 patch file for 1.1.11.
2709 + * Additions for Interactive 4.0
2710 + -- Karl Kiniger (ki@kretz.co.at)
2713 +Fri May 6 12:03:00 BST 1994
2715 + * Merged old sysfs.c with the new sysfs.c. The code will now
2716 + work against any kernel - 1.0, 1.1, 1.1.9, 1.1.10...
2720 +Thu May 5 10:39:52 BST 1994
2722 + * Reworked for compatibility with 1.1.10. Kernel patches
2723 + are *not* updated yet. We expect the kernel changes to go
2724 + in to the official distribution any time now...
2728 +Tue May 3 12:03:31 BST 1994
2730 + * Joe/Brad's IPC additions.
2733 +Fri Apr 29 10:06:10 BST 1994
2735 + * Updated the README to explain the difference between sysfs.c
2740 +Wed Apr 27 11:38:52 BST 1994
2742 + * Added mapping of chsize() to ftruncate(). Implemented nap()
2746 + * Further fix to termios mapping for iexten and tostop.
2749 + * Updated the 1.1.? patch. New ksyms.c with fewer symbols plus
2750 + removed all the socket patches. Sockfunc.h is no longer
2751 + required. The 1.0 patch isn't updated but the extra cruft
2752 + that's in there now shouldn't be any problem.
2756 +Tue Apr 26 11:49:07 BST 1994
2758 + * Removed references to linux/sockfunc.h. We seem to have run
2759 + out of internal socket functions to put in it finally.
2762 + * Removed use of socki_lookup(). This just wraps some checks
2763 + around inode->i_socket. We assume the socket layer is stable
2767 + * Access [gs]etsockopt via the socketcall interface.
2770 + * If we have to use our own CFLAGS look in the include directory
2771 + above in case we have been dropped in to the kernel.
2774 + * Grab socket file operations when we create a socket rather
2775 + than linking against them directly. Similar to Eric's
2776 + changes but different...
2780 +Fri Apr 22 11:10:18 BST 1994
2782 + * The 'x' class of ioctls are back to being termios rather
2783 + than termio. The problem was that the field size in iBCS
2784 + termios and Linux termios is different.
2787 + * Added iBCS <-> Linux termios mapping. This is untested and
2788 + probably imperfect at this stage but nothing crashes with
2792 + * The iBCS time() syscall doesn't take an argument, the save,
2793 + if any, is handled in the interface library.
2796 + * Updated the 1.1 kernel patch to be against 1.1.8. It won't
2797 + work with anything less than 1.1.8 but then if you are
2798 + playing with 1.1 you should be playing with the latest...
2799 + This involves a change in the way sysfs() works. If you
2800 + are using 1.0 and have applications that call sysfs()
2801 + (practically none do) then you need to build with sysfs.c.old.
2804 + * The Linux kernel 1.1.8 replaces the static file_systems
2805 + table with a linked list ready for loadable file systems.
2806 + Naturally, I was ready for this... :-(
2810 +Thu Apr 21 10:34:34 BST 1994
2812 + * sysfs.c should be including linux/string.h to get the
2813 + inline string functions rather than needing library
2817 + * Added code to map between Linux termio structs and SCO/iBCS
2818 + termio structs. There are slight differences. Mapping needs
2819 + to be done for termios structs too. Anything that uses termios
2820 + at this stage is likely to ge a nasty shock!
2824 +Tue Apr 19 22:56:55 1994 Eric Youngdale (eric@esp22)
2826 + * ibcs.h: Put declaration of sys_call_table outside of ifdef.
2827 + (So can be compiled into kernel instead as a module).
2830 +Tue Apr 19 10:21:17 BST 1994
2832 + * It looks as though the 'x' class of ioctls should be termio
2833 + ioctls rather than termios. At least this is the case as far
2834 + as SCO 3.2.4 stty appears to be concerned.
2837 + * Avoid copying the entire lock structure backwards and forwards
2838 + just to increment one field in open.c. There could be a problem
2839 + here - SCO has a sysid field *before* the pid field but only
2840 + if _XOPEN_SOURCE or _POSIX_SOURCE is defined at compile time.
2841 + There appears to be no obvious way to know what is being used???
2845 +Mon Apr 18 08:49:37 BST 1994
2847 + * There appear to odd little niceties involved with SYSV which
2848 + depend on system configuration and the way users do things.
2849 + Added a HINTS file with known problems/workarounds.
2852 + * Changed some annoying KERN_ERRs to KERN_DEBUGs in signal.c
2855 + * Watch out for (mis)use of INADDR_ANY instead of localhost
2856 + (primarily by syslog() code?) and replace it with the
2857 + localhost address. We should perhaps do this for sendto()
2858 + as well? (Eric spotted this one on CorelDraw but it's a
2859 + problem with the standard libsocket.c)
2862 + * Processes should be allowed to reduce their file size
2863 + limit but only increase it if they have root privileges.
2866 + * Fixed the bug in [f]statfs where the first two arguments
2867 + to memcpt_tofs() were exchanged (spotted by Eric).
2870 + * SCO seems to like utsys (v7_utsname) to return the same
2871 + thing for sysname and nodename fields just like the SCO
2872 + extended utsname structure has. The SVR4 (abi_utsname)
2873 + return is unknown at this time.
2876 + * Removed comments on IPC from README. It *is* fixed?
2879 + * Fix IPC which was broken by syscall changes. Also fix
2880 + structure mappings.
2881 + -- Joseph L. Portman III <baron@hebron.connected.com>
2884 +Thu Apr 14 11:27:24 BST 1994
2886 + * At some stage SCO managed to build some of their binaries
2887 + with the copyright comment string in quotes so we have a
2888 + new recognition string in the COFF loader. (Seen in uname
2889 + on a 3.2.2 system).
2892 + * If we have tracing compiled in then only give unsupported
2893 + syscall messages if we are tracing the API or the syscall
2894 + in question. This allows us to quieten unsupported but
2895 + unimportant syscalls.
2898 + * Comment on the IPC limitations in the README file.
2901 + * Added implementation of xnx_pathconf(). Actually it doesn't
2902 + look as if we really need it. The Microsoft C compiler seems
2903 + to be misusing it anyway and doesn't even care that it gets
2908 +Wed Apr 13 09:14:50 BST 1994
2910 + * Added handling of TIOC[GS]PGRP.
2913 + * Added implementation of xnx_eaccess(). This is currently
2914 + simpleminded because Linux access() is. My eaccess() may
2918 + * When tracing signal delivery we shouldn't be clearing the
2919 + signal flag after reporting it or the signal is never actually
2920 + delivered. I copied the assembler from the kernel and forgot
2921 + to deleted an opcode...
2924 + * Signal 0 should have been identity mapped so kill 0 works.
2925 + -- Brandon S. Allbery (kf8nh@kf8nh.ampr.org) (bsa@kf8nh.wariat.org)
2927 +Tue Apr 12 14:30:25 BST 1994
2929 + * Corrected file size passed to/from setrlimit/getrlimit
2930 + -- Graham Adams (gadams@ddrive.demon.co.uk)
2933 +Tue Apr 12 11:16:45 BST 1994
2935 + * Added support for an obscure SCO extension that is used
2936 + to get SCO's extended utsname information.
2939 + * Changed ipc.c to always go via the ipc syscall rather than
2940 + direct to internal functions. This should survive if ipc
2941 + isn't in the kernel. It should even do sensible things if
2942 + the ipc module is loaded/unloaded on us.
2945 + * Initial changes to access system calls via sys_call_table
2951 + * Eric's pre-release fixes.
2954 +Wed Mar 30 22:35:28 1994 Eric Youngdale (eric@esp22)
2956 + * ioctl.c: Change 'F' to 'f' for SVr4 FIONREAD ioctl.
2958 + * Makefile: Add svr4.c.
2960 + * svr4.c: New file (sort of - it got lost in shuffle before).
2962 + * include/ibcs/ibcs.h: Include prototypes for abi_uname.
2964 + * maps/callmap.inc: Insert abi_uname in syscall number 135.
2965 + Add sys_rename in slot 134 (emacs v18 requires this).
2968 +Tue Mar 29 23:32:35 1994 Eric Youngdale (eric@esp22)
2970 + * Makefile: Fix so that we do not need uname. Use symbol from
2973 + * README: Update a bit.
2978 + * Preparation for release:
2979 + Tidy up documentation and create CREDITS file from the old
2986 + * Preparation for release:
2987 + Move headers into a subdirectory.
2988 + Move maps into a subdirectory.
2994 + * Changed the COFF loader so that if the filesystem doesn't
2995 + support mmap we read in the whole lot initially and let
2996 + it page to swap if necessary. This is already in the x.out
2997 + loader, it should go in the ELF loader too at some point.
3003 + * Added a loader for x.out i386 small model binaries - i.e 386
3004 + Xenix programs. <=286, non-small model binaries are not
3005 + supported and not likely to be in the near future.
3009 +Wed Mar 23 23:12:54 1994 Eric Youngdale (eric@esp22)
3011 + * Add ioctl for 0x4004667f (FIONREAD) (used by SVr4).
3013 + * map.h (map_segment.map): Make unsigned.
3015 + * hrtsys.c: New file implementing parts of the hrtsys syscall.
3020 + * Add socket value mappings. This meant a general move round
3021 + to tidy things up and group map functions/tables.
3022 + There is a new kernel patch in the Patches directory called
3023 + net.patch which gives us access to the sock_*sockopts
3024 + functions directly.
3030 + * Implementation of poll().
3036 + * Pedantic change to call maps so that IBCS_function contains
3037 + a void * instead of a function pointer - we cast it as
3038 + necessary later in emulate.c. The warnings were annoying me.
3040 + * Moved struct abi_sigaction from signal.c to abi4.h so it is
3041 + available for prototype declarations. Changed prototype for
3042 + abi_sigsuspend to correspond to implementation in signal.c.
3045 + * Reversed out Eric's earlier signal patches and added new ones.
3048 + * Updated trace code and trace control program to be useful.
3049 + Control of tracing individual functions is still not there
3050 + yet - perhaps another day.
3051 + Default trace mode is now none (i.e. only functions with
3052 + the trace flag set are traced). Use the trace program to
3053 + change the trace level.
3056 + * File modes (open/fcntl flags) are different between Linux and
3057 + iBCS so we need to map between them. Open also requires this
3058 + so fcntl.c is now merged with open.c. Failure to set and reset
3059 + non-blocking mode was what was breaking Unipox.
3062 + * Signal handling function changes to map to and from the Linux
3063 + signal set and sigaction flags correctly.
3069 + * Added code to the emulate() function to let us know when we
3070 + are about to process a signal on exit from the syscall.
3073 + * Implemented proctl() as a no-op. It's not really relevent
3077 + * Added argument count and type for eaccess()
3080 + * Have emulate.c return -ENOSYS for unimplemented system calls
3084 + * Added Eric's patches to waitpid.
3086 + * Created the ChangeLog!
3087 diff -uNr --exclude-from=dontdiff linux-2.4.3/Documentation/abi/Error.map linux/Documentation/abi/Error.map
3088 --- linux-2.4.3/Documentation/abi/Error.map Thu Jan 1 01:00:00 1970
3089 +++ linux/Documentation/abi/Error.map Fri Mar 30 16:12:20 2001
3091 +Mapping of error codes from Linux to various personalities. Codes which Linux
3092 +may generate but which can't be mapped directly in a given personality must
3093 +be mapped to the nearest equivalent which may invoke the correct behaviour
3094 +in the application. This is especially true for things like the ERESTART*
3095 +set of error returns!
3099 +The Xenix set was built with reference to an old SCO Xenix manual rather
3100 +than by reference to a real system. It may be incomplete or wrong. If anyone
3101 +has access to the Xenix TCP/IP kit we need to add mappings for the TCP/IP
3104 +Other personalities may need adding. COFF binaries default
3106 +Linux Name Linux ABI SCO Wyse Xenix 386bsd
3108 +EPERM 1 /* Operation not permitted */
3109 +ENOENT 2 /* No such file or directory */
3110 +ESRCH 3 /* No such process */
3111 +EINTR 4 /* Interrupted system call */
3112 +EIO 5 /* I/O error */
3113 +ENXIO 6 /* No such device or address */
3114 +E2BIG 7 /* Arg list too long */
3115 +ENOEXEC 8 /* Exec format error */
3116 +EBADF 9 /* Bad file number */
3117 +ECHILD 10 /* No child processes */
3118 +EAGAIN 11 35 /* Try again */
3119 +ENOMEM 12 /* Out of memory */
3120 +EACCES 13 /* Permission denied */
3121 +EFAULT 14 /* Bad address */
3122 +ENOTBLK 15 /* Block device required */
3123 +EBUSY 16 /* Device or resource busy */
3124 +EEXIST 17 /* File exists */
3125 +EXDEV 18 /* Cross-device link */
3126 +ENODEV 19 /* No such device */
3127 +ENOTDIR 20 /* Not a directory */
3128 +EISDIR 21 /* Is a directory */
3129 +EINVAL 22 /* Invalid argument */
3130 +ENFILE 23 /* File table overflow */
3131 +EMFILE 24 /* Too many open files */
3132 +ENOTTY 25 /* Not a typewriter */
3133 +ETXTBSY 26 /* Text file busy */
3134 +EFBIG 27 /* File too large */
3135 +ENOSPC 28 /* No space left on device */
3136 +ESPIPE 29 /* Illegal seek */
3137 +EROFS 30 /* Read-only file system */
3138 +EMLINK 31 /* Too many links */
3139 +EPIPE 32 /* Broken pipe */
3140 +EDOM 33 /* Math argument out of domain of func */
3141 +ERANGE 34 /* Math result not representable */
3142 +EDEADLK 35 45 45 45 36 11 /* Resource deadlock would occur */
3143 +ENAMETOOLONG 36 78 78 228 EINVAL 63 /* File name too long */
3144 +ENOLCK 37 46 46 46 45 77 /* No record locks available */
3145 +ENOSYS 38 89 89 EINVAL EINVAL 78 /* Function not implemented */
3146 +ENOTEMPTY 39 93 145 231 EINVAL 66 /* Directory not empty */
3147 +ELOOP 40 90 150 227 EINVAL 62 /* Too many symbolic links encountered */
3148 +EWOULDBLOCK EAGAIN 90 90 200 EINVAL 35 /* Operation would block */
3149 +ENOMSG 42 35 35 35 43 ? /* No message of desired type */
3150 +EIDRM 43 36 36 36 44 ? /* Identifier removed */
3151 +ECHRNG 44 37 37 37 EINVAL ? /* Channel number out of range */
3152 +EL2NSYNC 45 38 38 38 EINVAL ? /* Level 2 not synchronized */
3153 +EL3HLT 46 39 39 39 EINVAL ? /* Level 3 halted */
3154 +EL3RST 47 40 40 40 EINVAL ? /* Level 3 reset */
3155 +ELNRNG 48 41 41 41 EINVAL ? /* Link number out of range */
3156 +EUNATCH 49 42 42 42 EINVAL ? /* Protocol driver not attached */
3157 +ENOCSI 50 43 43 43 EINVAL ? /* No CSI structure available */
3158 +EL2HLT 51 44 44 44 EINVAL ? /* Level 2 halted */
3159 +EBADE 52 ? 50 50 EINVAL ? /* Invalid exchange */
3160 +EBADR 53 ? 51 51 EINVAL ? /* Invalid request descriptor */
3161 +EXFULL 54 ? 52 52 EINVAL ? /* Exchange full */
3162 +ENOANO 55 ? 53 53 EINVAL ? /* No anode */
3163 +EBADRQC 56 ? 54 54 EINVAL ? /* Invalid request code */
3164 +EBADSLT 57 ? 55 55 EINVAL ? /* Invalid slot */
3165 +EDEADLOCK 58 ? 56 56 36 11 /* File locking deadlock error */
3166 +EBFONT 59 ? 57 57 EINVAL ? /* Bad font file format */
3167 +ENOSTR 60 EINVAL ? /* Device not a stream */
3168 +ENODATA 61 EINVAL ? /* No data available */
3169 +ETIME 62 EINVAL ? /* Timer expired */
3170 +ENOSR 63 EINVAL ? /* Out of streams resources */
3171 +ENONET 64 EINVAL ? /* Machine is not on the network */
3172 +ENOPKG 65 EINVAL ? /* Package not installed */
3173 +EREMOTE 66 EINVAL 71 /* Object is remote */
3174 +ENOLINK 67 EINVAL ? /* Link has been severed */
3175 +EADV 68 EINVAL ? /* Advertise error */
3176 +ESRMNT 69 EINVAL ? /* Srmount error */
3177 +ECOMM 70 EINVAL ? /* Communication error on send */
3178 +EPROTO 71 ? ? /* Protocol error */
3179 +EMULTIHOP 72 74 74 74 ? ? /* Multihop attempted */
3180 +EDOTDOT 73 76 76 76 ? ? /* RFS specific error */
3181 +EBADMSG 74 77 77 77 ? ? /* Not a data message */
3182 +EOVERFLOW 75 79 EINVAL EINVAL ? ? /* Value too large for defined data type */
3183 +ENOTUNIQ 76 80 80 80 ? ? /* Name not unique on network */
3184 +EBADFD 77 81 81 81 ? ? /* File descriptor in bad state */
3185 +EREMCHG 78 82 82 82 ? ? /* Remote address changed */
3186 +ELIBACC 79 83 83 83 ? ? /* Can not access a needed shared library */
3187 +ELIBBAD 80 84 84 84 ? ? /* Accessing a corrupted shared library */
3188 +ELIBSCN 81 85 85 85 ? ? /* .lib section in a.out corrupted */
3189 +ELIBMAX 82 86 86 86 ? ? /* Attempting to link in too many shared libraries */
3190 +ELIBEXEC 83 87 87 87 ? ? /* Cannot exec a shared library directly */
3191 +EILSEQ 84 88 EINVAL EINVAL ? ? /* Illegal byte sequence */
3192 +ERESTART 85 91 EINTR EINTR ? ? /* Interrupted system call should be restarted */
3193 +ESTRPIPE 86 92 EINVAL EINVAL ? ? /* Streams pipe error */
3194 +EUSERS 87 94 EINVAL 233 ? 68 /* Too many users */
3195 +ENOTSOCK 88 95 93 203 ? 38 /* Socket operation on non-socket */
3196 +EDESTADDRREQ 89 96 94 204 ? 39 /* Destination address required */
3197 +EMSGSIZE 90 97 95 205 ? 40 /* Message too long */
3198 +EPROTOTYPE 91 98 96 206 ? 41 /* Protocol wrong type for socket */
3199 +ENOPROTOOPT 92 99 EINVAL 207 ? 42 /* Protocol not available */
3200 +EPROTONOSUPPORT 93 120 97 208 ? 43 /* Protocol not supported */
3201 +ESOCKTNOSUPPORT 94 121 98 209 ? 44 /* Socket type not supported */
3202 +EOPNOTSUPP 95 122 99 210 ? 45 /* Operation not supported on transport endpoint */
3203 +EPFNOSUPPORT 96 123 100 211 ? 46 /* Protocol family not supported */
3204 +EAFNOSUPPORT 97 124 101 212 ? 47 /* Address family not supported by protocol */
3205 +EADDRINUSE 98 125 102 213 ? 48 /* Address already in use */
3206 +EADDRNOTAVAIL 99 126 103 214 ? 49 /* Cannot assign requested address */
3207 +ENETDOWN 100 127 104 215 ? 50 /* Network is down */
3208 +ENETUNREACH 101 128 105 216 ? 51 /* Network is unreachable */
3209 +ENETRESET 102 129 106 217 ? 52 /* Network dropped connection because of reset */
3210 +ECONNABORTED 103 130 107 218 ? 53 /* Software caused connection abort */
3211 +ECONNRESET 104 131 108 219 ? 54 /* Connection reset by peer */
3212 +ENOBUFS 105 132 63 220 ? 55 /* No buffer space available */
3213 +EISCONN 106 133 110 221 ? 56 /* Transport endpoint is already connected */
3214 +ENOTCONN 107 134 111 222 ? 57 /* Transport endpoint is not connected */
3215 +ESHUTDOWN 108 143 112 223 ? 58 /* Cannot send after transport endpoint shutdown */
3216 +ETOOMANYREFS 109 144 113 224 ? 59 /* Too many references: cannot splice */
3217 +ETIMEDOUT 110 145 114 225 ? 60 /* Connection timed out */
3218 +ECONNREFUSED 111 146 115 226 ? 61 /* Connection refused */
3219 +EHOSTDOWN 112 147 116 229 ? 64 /* Host is down */
3220 +EHOSTUNREACH 113 148 117 230 ? 65 /* No route to host */
3221 +EALREADY 114 149 92 202 ? 37 /* Operation already in progress */
3222 +EINPROGRESS 115 150 91 201 ? 36 /* Operation now in progress */
3223 +ESTALE 116 EINVAL EINVAL 237 ? 70 /* Stale NFS file handle */
3224 +EUCLEAN 117 ? 135 135 35 ? /* Structure needs cleaning */
3225 +ENOTNAM 118 ? 137 137 37 ? /* Not a XENIX named type file */
3226 +ENAVAIL 119 ? 138 138 38 ? /* No XENIX semaphores available */
3227 +EISNAM 120 ? 139 139 39 ? /* Is a named type file */
3228 +EREMOTEIO 121 ? 140 140 EINVAL ? /* Remote I/O error */
3229 +EDQUOT 122 ? ENOSPC 234 ENOSPC 69 /* Quota exceeded */
3231 +ERESTARTSYS 512 EINTR EINTR EINTR EINTR EINTR
3232 +ERESTARTNOINTR 513 EINTR EINTR EINTR EINTR EINTR
3233 +ERESTARTNOHAND 514 EINTR EINTR EINTR EINTR EINTR /* restart if no handler.. */
3234 diff -uNr --exclude-from=dontdiff linux-2.4.3/Documentation/abi/HINTS linux/Documentation/abi/HINTS
3235 --- linux-2.4.3/Documentation/abi/HINTS Thu Jan 1 01:00:00 1970
3236 +++ linux/Documentation/abi/HINTS Fri Mar 30 16:12:20 2001
3239 + Cannot determine user name by reference to /etc/passwd. Failure
3240 + to determine the user name causes some programs (notably programs
3241 + built with Informix 4GL) to exit.
3244 + The functions that parse /etc/passwd are sensitive under SCO
3245 + at least. A corrupt line is taken to be the end of the file
3246 + and further entries are ignored. Any line which has a null
3247 + home directory counts as a corrupt line for SCO.
3250 + Ensure that all lines in /etc/passwd have home directories
3251 + specified. Simply edit /etc/passwd with an editor.
3254 +# -----------------------------------------------------------------------
3257 + Cannot connect to X server using local connection.
3260 + Some versions of X libraries seem to require 'localhost' to be
3261 + allowed to connect to the X server even if we aren't using a
3262 + TCP/IP connection. The X libraries used for VSI*FAX require
3263 + this, the X libraries used for WordPerfect don't.
3266 + Explicitly allow 'localhost' to connect to the X server using
3267 + 'xhost localhost'.
3270 +# -----------------------------------------------------------------------
3273 + Installation disks claim to be Unix tar format but they appear
3274 + to be blank MS-DOS format disks!
3277 + Unix provides two floppy devices, the normal floppy devices
3278 + that we all know and love (and which are listed as the Xenix
3279 + compatible devices in the man page) and a second set which
3280 + skips the first track of the disk. For some reason a few vendors
3281 + seem to use this second set when preparing distribution disks.
3282 + WordPerfect seem to do this. Linux currently only supports
3283 + the normal floppy devices.
3286 + You have to skip the first track by hand and read each disk
3287 + individually. Try 'dd if=/dev/fd0 bs=18k skip=1 | tar xfv -'
3288 + for a 3.5" high density disk. Change the 18k to 15k for a
3289 + 5.25" high density disk.
3291 +# -----------------------------------------------------------------------
3294 + A script bombs out with an unexpected EOF looking for "'". This
3295 + only happens on Linux.
3298 + There is a bug in the script which is only a problem on Linux.
3299 + Take the following example:
3301 + count=`ls | wc | awk '{ printf "%05d", $1 }`
3303 + Note the missing "'" at the end of the awk statment. The /bin/sh
3304 + supplied with SCO will assume (in this case correctly) that the
3305 + "'" should have occurred immediately before the closing "`" and
3306 + the expression will succeed. The /bin/sh used with Linux (normally
3307 + bash) does not make this assumption and gives an error message.
3310 + Either fix the script or arrange to have it run by a SYSV shell
3313 +# -----------------------------------------------------------------------
3316 + Test complains that a numeric argument is required before -eq, -le
3320 + The GNU shellutils test and the test built in to bash which are
3321 + the versions of test used under Linux do not accept a null
3322 + argument as equivalent to 0 so 'test "" -le 5' will give an error.
3323 + Under SCO a null argument is taken as equivalent to 0 so the
3324 + statement would be evaluated as 'test 0 -le 5'.
3327 + Fix the script to check arguments for validity before using them
3328 + or provide a fixed version of test and ensure that it is used in
3329 + preference to any shell built in.
3331 +# -----------------------------------------------------------------------
3334 + Some X fonts supplied with packages appear corrupt.
3337 + These are probably snf fonts. The XFree86 X server used with
3338 + Linux appears to fail to load some snf fonts silently and displays
3339 + garbage. Pcf fonts work ok and should be used where possible.
3342 + If you only have the snf fonts all you can do is to try asking the
3343 + vendor for pcf versions or the bdf definitions.
3345 + If you have the bdf definitions (WordPerfect ship them) then you
3346 + can build a pcf set using:
3348 + # for bdffn in *.bdf
3350 + > fn=`basename $bdffn .bdf`
3351 + > [ -r $fn.snf ] && mv $fn.snf $fn.snf.old
3352 + > bdftopcf -o $fn.pcf $bdffn
3357 +# -----------------------------------------------------------------------
3360 + Function keys don't work.
3363 + The default sequences for function keys under Linux are "sort of"
3364 + VT10x like whereas you have probably told your application that
3365 + you are running on an ansi or SCO console.
3368 + It is probably best to run as an ansi screen - especially if
3369 + colour is used - so use the "loadkeys" program to load the
3370 + SCO.map keyboard description from the PROD.Patches directory.
3371 + This directory also contains flexible termcap and terminfo
3372 + descriptions which will allow you run permanently with a SCO
3373 + or SVR4-like console.
3375 +# -----------------------------------------------------------------------
3378 + Line drawing characters come out as weird symbols.
3381 + The application believes you are using a console screen with a
3382 + PC character set and is using 8-bit codes rather than escape
3383 + sequences. Linux defaults to an ISO8859-1 character set though.
3386 + Linux can be switched to PC character set mode with the escape
3387 + sequence ESC-(-U. Arrange to have this sequence sent either
3388 + before the application is started or as part of the initialisation
3389 + that the application does. You can restore the ISO character
3390 + set afterwards with ESC-(-K.
3392 +# -----------------------------------------------------------------------
3395 + SYSV binaries see the wrong time zone.
3398 + SYSV binaries establish the time zone from the TZ environment
3399 + variable whereas Linux uses BSD style zoneinfo files generally.
3402 + Set the TZ environment variable to reflect your time zone. Note
3403 + that the zoneinfo mechanism can also use TZ in preference to
3404 + the /usr/lib/zoneinfo/localtime file if you wish. For this to
3405 + work you must have /usr/lib/zoneinfo/posixrules linked to one
3406 + of the US timezone files. The posixrules file defines how the
3407 + zoneinfo functions interpret TZ and this information is only
3408 + found in the US data files. See the documentation for the
3409 + timezone/zoneinfo package for details.
3411 +# -----------------------------------------------------------------------
3414 + BSD binaries don't see the right time zone.
3417 + Although BSD binaries use the same timezone handling method as
3418 + Linux they expect the zoneinfo information in different places.
3423 + # ln -s /usr/lib/zoneinfo /etc/localtime
3424 + # ln -s /usr/lib/zoneinfo /usr/share/zoneinfo
3426 +# -----------------------------------------------------------------------
3429 + BSD binaries complain that they can't find /etc/termcap.
3432 + They may be lying. BSD sometimes uses /usr/share/misc/termcap
3433 + or ~/.termcap (if it exists).
3436 + Either move termcap to /usr/share/misc and make /etc/termcap
3437 + a link to it or make /usr/share/misc/termcap a link to /etc/termcap.
3438 + The use of /usr/share/misc/termcap may be useful in a networked
3440 +# -----------------------------------------------------------------------
3443 + SVr4 binaries cannot locate shared libraries, or fail to start.
3446 + The shared libraries are not in the correct location, or the dynamic
3447 + loader cannot be located by the kernel.
3450 + Put all SVr4 shared libraries in the directory /usr/i486-sysv4/lib.
3451 + Then create two symbolic links:
3453 + ln -s /usr/i486-sysv4/lib/libc.so.1 /usr/lib/libc.so.1
3454 + ln -s /usr/i486-sysv4/lib/ld.so.1 /usr/lib/ld.so.1
3455 +# -----------------------------------------------------------------------
3458 + SVr4 binaries want to access terminfo instead of termcap
3461 + SVr4 traditionally uses something called terminfo instead of
3462 + termcap to specify terminal characteristics.
3465 + The ncurses distribution (available on many fine ftp sites)
3466 + contains a terminfo database. Just install this, and you
3467 + should be all set.
3468 +# -----------------------------------------------------------------------
3471 + The Informix Dynamic Server installation for SCO says
3472 + invalid INFORMIXDIR or insufficient space.
3475 + It wants to scan /etc/mnttab to find all possible
3476 + filesystems. Since Linux uses /etc/mtab instead the
3477 + installation program is under the impression you have
3478 + no filesystems and no space(!).
3481 + Run the perl script Tools/mkmnttab which will build an
3482 + /etc/mnttab from /etc/mtab.
3483 diff -uNr --exclude-from=dontdiff linux-2.4.3/Documentation/abi/Local-X linux/Documentation/abi/Local-X
3484 --- linux-2.4.3/Documentation/abi/Local-X Thu Jan 1 01:00:00 1970
3485 +++ linux/Documentation/abi/Local-X Fri Mar 30 16:12:20 2001
3487 +** Local X interface
3489 +The local X interface is simplistic. It assumes only one local X server
3490 +exists and assumes that the pathname of the Unix domain socket for
3491 +local connections is always /tmp/.X11-unix/X0.
3493 + The SCO code opens both /dev/X0R and /dev/spx, writes a single byte
3494 +to /dev/X0R, reads a message from /dev/X0R with getmsg then writes this
3495 +message to /dev/spx with putmsg and closes /dev/X0R. This establishes
3496 +the /dev/spx file descriptor as a connection to the X server listening
3499 + We ignore all activity on the /dev/X0R device (hence it is a link to
3500 +/dev/null), getmsg and putmsg are stubbed so don't do anything and opens
3501 +on the /dev/spx simply replace the open inode with a socket connected
3502 +to the X server's Unix domain socket.
3504 + At some point in the future we will implement a simple minded /dev/X*
3505 +driver that returns some form of id via the getmsg which can then be
3506 +passed to /dev/spx with putmsg and which will allow /dev/spx to connect
3507 +to the relevant X server. This will only happen if someone actually
3508 +*needs* multiple local X servers...
3509 diff -uNr --exclude-from=dontdiff linux-2.4.3/Documentation/abi/Notes.Signal linux/Documentation/abi/Notes.Signal
3510 --- linux-2.4.3/Documentation/abi/Notes.Signal Thu Jan 1 01:00:00 1970
3511 +++ linux/Documentation/abi/Notes.Signal Fri Mar 30 16:12:20 2001
3513 +Drew, Joe, and Brandon.
3515 +This file contains my code for the signal functions. I realized that the
3516 +existing signal functions will not suffice. This module should do the
3517 +proper processing for iBCS signals.
3519 +There are patches to the emulate module offered by Drew in his pl14n code
3520 +release. The Makefile was changed to include the module.
3522 +In addition, I have include a signal.doc file which contains the text from
3523 +my UNIX S5 manual describing the functions used by iBCS. I based the
3524 +emulator code on this document. Please look it over and see if I have
3525 +messed up. I believe it to be correct. However, it never hurts to have
3526 +someone check the work before we can trust it.
3528 +It follows what I believe to be the proper calling sequence for signals. I
3529 +sent a message to the IBSC2 group with the text from the McGraw Hill book
3530 +concerning signals. If you would like a copy of the message, then let me
3533 +Of couse, this could be totally wrong. That is the whole point about
3534 +sending this out to a limited distribution.
3536 +In addition to the processing for the various function requests, you may
3537 +have noticed that the signal _numbers_ must be changed between the values
3538 +used by iBCS and Linux.
3540 +I have had to modify the emulate.c module to export an additional
3541 +procedure (and for emulate.c to use the procedure itself.) In addition, I
3542 +change the branch table to re-direct the signal processing to the signal.c
3545 +I hope that this will help the project when it has been proven workable.
3546 +Please let me know how this turns out -- one way or the other.
3548 +If it does work, then I'll give the final code to Drew to merge into the
3549 +master code. That is unless, Drew, you already have it. :-)
3554 +Al Longyear longyear@netcom.com longyear@sii.com
3555 diff -uNr --exclude-from=dontdiff linux-2.4.3/Documentation/abi/Personality linux/Documentation/abi/Personality
3556 --- linux-2.4.3/Documentation/abi/Personality Thu Jan 1 01:00:00 1970
3557 +++ linux/Documentation/abi/Personality Fri Mar 30 16:12:20 2001
3559 +*** Why are multiple personalities necessary?
3561 +Personalities are used to provide the expected set of syscalls and error
3562 +code mapping for non-Linux processes. In theory the set of syscalls and
3563 +error codes should be standardised across all SYSV systems. In practice
3564 +this is the case for SVR4, however SVR3 is a much older code base and
3565 +many vendors have extended it leading to incompatibilities between the
3566 +expected interfaces. Personalities allow us to vary the interface presented
3567 +on a per-process basis thus allowing Linux to run binaries created for
3568 +different vendor's extended SVR3s simultaneously.
3571 +*** How are personalities implemented?
3573 +The per-process task structure contains a field "personality". This defaults
3574 +to 0 for Linux binaries, 1 (SVR4) for ELF binaries and 2 (SVR3) for COFF
3575 +binaries. However when the COFF loader is called on to load a new binary
3576 +it looks at the first 1k of data in each .comment section and compares
3577 +the strings it finds with a built in table. If it finds a match it will
3578 +set the personality appropriately.
3580 + When the application makes a system call the iBCS emulation layer uses
3581 +the personality code in the per-process task structure to determine which
3582 +system call mappings to use to locate the correct function.
3584 + If the function returns an (Linux) error code the iBCS emulation layer
3585 +uses the personality code to determine which error code mappings to use
3586 +to translate the error code in to a value the application will understand.
3589 +*** What personalities are implemented?
3591 +Currently the implemented personalities are SVR4, SVR3 (as a direct
3592 +subset of SVR4), SCO 3.[24] and Wyse V/386 3.2.1. Of these the Wyse
3593 +emulation is the most complete at this time. Rather than using the
3594 +more common streams based TCP/IP stack on their SVR3, Wyse used a BSD
3595 +implementation with a system call interface. Currently the Wyse emulation
3596 +is the only one capable of running non-Linux TCP/IP binaries.
3599 +*** When do I need to add a personality rather than use the default?
3601 +When your applications start failing for inexplicable reasons! Seriously,
3602 +if you have an SVR3 based Unix which does not currently have its own
3603 +personality defined then you should check some things very carefully.
3605 + Firstly compare your system's /usr/include/sys/errno.h with the data
3606 +in the Error.map file. If the values defined in your errno.h do not
3607 +match those in the ABI column then you will need to create a new
3608 +personality in order to map error codes to the correct values.
3610 + Next compare your system's /usr/include/sys.s with the data in the
3611 +Syscall.map file. If there are system calls in your sys.s that don't
3612 +do the same thing as those in the ABI column (other than ones that
3613 +simply aren't implemented on your system) then you will need to create
3614 +a new personality in order to mapp system calls to the correct functions.
3617 +*** How do I add a new personality?
3619 +The first step is to find a way for the COFF loader to recognise your
3620 +binaries as being different. To do this you need to examine the comments
3621 +embedded in a range of binaries, system executables, bought programs of
3622 +various ages and locally compiled programs, using "mcs -p" to list the
3623 +.comments sections. If you don't have "mcs" use "strings" and look for
3624 +version or copyright messages. You are looking for one or more strings
3625 +near the top which uniquely identify the system.
3627 + Once you have your identifying strings you must add a value for the
3628 +new personality to linux/include/linux/personality.h (just use the
3629 +next highest number) and add the strings to the table in the COFF loader
3630 +linux/fs/binfmt_coff.c.
3632 + The next step is to modify the error map. Edit the file errmap.inc and
3633 +look at the end of the file where there is an array of pointers to error
3634 +maps call err_map. There is one entry for each personality. Add a new
3635 +entry to the end for your personality. If your personality is compatible
3636 +with an exising personality you can simply reuse the same error map (see
3637 +the duplicate entries for the SVR4 map which is use for both SVR4 and
3638 +SVR3 personalities), otherwise you must figure out how to create a new
3639 +error mapping. One day it may be documented here :-).
3641 + Next you must modify the syscall mapping. Edit the file callmap.inc
3642 +and look at the end of the file where there is an array containg one
3643 +pointer for each personality. Add a new entry to the end. If your syscalls
3644 +match one of the existing personalities you may reuse the existing map.
3645 +Otherwise you have to build a new one. Again, one day it may be documented
3647 diff -uNr --exclude-from=dontdiff linux-2.4.3/Documentation/abi/README.first linux/Documentation/abi/README.first
3648 --- linux-2.4.3/Documentation/abi/README.first Thu Jan 1 01:00:00 1970
3649 +++ linux/Documentation/abi/README.first Fri Mar 30 16:12:20 2001
3651 +First notes on Linux-ABI documentation
3653 +Christoph Hellwig, <hch@caldera.de>
3656 +Please note that most files in this directory are leftovers from iBCS, which is
3657 +dead since 1998. Do not expect this files to uptodate or complete.
3659 +I will update the files and add new onces from time to time.
3664 diff -uNr --exclude-from=dontdiff linux-2.4.3/Documentation/abi/Syscall.map linux/Documentation/abi/Syscall.map
3665 --- linux-2.4.3/Documentation/abi/Syscall.map Thu Jan 1 01:00:00 1970
3666 +++ linux/Documentation/abi/Syscall.map Fri Mar 30 16:12:20 2001
3668 +Call ABI SCO 3.2 SCO 3.4 Wyse V/386 3.2.1 386bsd
3700 + 31 stty getpeername
3701 + 32 gtty getsockname
3704 + 35 statfs fchflags
3708 + 39 setpgrp getppid
3714 + 45 lock/plock ktrace
3715 + 46 setgid sigaction
3717 + 48 signal sigprocmask
3718 + 49 msgsys getlogin
3719 + 50 sysi86/sys3b setlogin
3721 + 52 shmsys sigpending
3722 + 53 semsys sigaltstack
3732 + 63 ulimit getkerninfo
3733 + 64 ??? getpagesize
3743 + 74 rfstart mprotect
3748 + 79 rmdir getgroups
3749 + 80 mkdir setgroups
3750 + 81 getdents getpgrp
3751 + 82 libattach setpgid
3752 + 83 libdetach setitimer
3755 + 86 putmsg getitimer
3756 + 87 poll gethostname
3757 + 88 lstat --- --- --- sethostname
3758 + 89 symlink --- --- --- getdtablesize
3759 + 90 readlink --- symlink --- dup2
3760 + 91 setgroups --- lstat --- ---
3761 + 92 getgroups --- readlink --- fcntl
3762 + 93 fchmod --- --- --- select
3763 + 94 fchown --- --- --- ---
3764 + 95 sigprocmask --- --- --- fsync
3765 + 96 sigsuspend --- --- --- setpriority
3766 + 97 sigaltstack --- --- --- socket
3767 + 98 sigaction --- --- --- connect
3768 + 99 sigpending --- --- --- accept
3769 +100 context --- --- --- getpriority
3770 +101 evsys --- --- --- send
3771 +102 evtrapret --- --- --- recv
3772 +103 statvfs --- --- --- sigreturn
3773 +104 fstatvfs --- --- --- bind
3775 +106 nfssys --- --- --- listen
3776 +107 waitsys --- --- --- vtimes
3777 +108 sigsendsys --- --- --- sigvec
3778 +109 hrtsys --- --- --- sigblock
3779 +110 acancel --- --- --- sigsetmask
3780 +111 async --- --- --- sigsuspend
3781 +112 priocntlsys --- --- --- sigstack
3782 +113 pathconf --- --- --- recvmsg
3783 +114 mincore --- --- --- sendmsg
3784 +115 mmap --- --- --- vtrace
3785 +116 mprotect --- --- --- gettimeofday
3786 +117 munmap --- --- --- getrusage
3787 +118 fpathconf --- --- --- getsockopt
3788 +119 vfork --- --- --- resuba
3789 +120 fchdir --- --- --- readv
3790 +121 readv --- --- --- writev
3791 +122 writev --- --- --- settimeofday
3792 +123 xstat --- --- --- fchown
3793 +124 lxstat --- --- --- fchmod
3794 +125 fxstat --- --- --- recvfrom
3795 +126 xmknod --- --- --- setreuid
3796 +127 clocal setregid
3797 +128 setrlimit --- --- lstat rename
3798 +129 getrlimit --- --- readlink truncate
3799 +130 lchown --- --- symlink ftruncate
3800 +131 memcntl --- --- --- flock
3801 +132 getpmsg --- --- --- mkfifo
3802 +133 putpmsg --- --- gethostname sendto
3803 +134 rename --- --- sethostname shutdown
3804 +135 uname --- --- getdomainname socketpair
3805 +136 setegid --- --- setdomainname mkdir
3806 +137 sysconfig --- --- --- rmdir
3807 +138 adjtime --- --- setreuid utimes
3808 +139 systeminfo --- --- setregid sigreturn
3810 +141 seteuid --- --- --- getpeername
3811 +142 --- --- --- --- gethostid
3812 +143 --- --- --- --- sethostid
3813 +144 --- --- --- --- getrlimit
3814 +145 --- --- --- --- setrlimit
3815 +146 --- --- --- --- killpg
3816 +147 --- --- --- --- setsid
3817 +148 --- --- --- --- quotactl
3818 +149 --- --- --- --- quota
3819 +150 --- --- --- --- getsockname
3820 +151 --- --- --- ---
3821 +152 --- --- --- ---
3822 +153 --- --- --- ---
3823 +154 --- --- --- ---
3824 +155 --- --- --- --- nfssvc
3825 +156 --- --- --- --- getdirentries
3826 +157 --- --- --- --- statfs
3827 +158 --- --- --- --- fstatfs
3828 +159 --- --- --- ---
3829 +160 --- --- --- --- async_daemon
3830 +161 --- --- --- --- getfh
3831 +162 --- --- --- --- getdomainname
3832 +163 --- --- --- --- setdomainname
3833 +164 --- --- --- --- uname
3834 +165 --- --- --- --- sysarch
3835 +166 --- --- --- ---
3836 +167 --- --- --- ---
3837 +168 --- --- --- ---
3838 +169 --- --- --- --- semsys
3839 +170 --- --- --- --- msgsys
3840 +171 --- --- --- --- shmsys
3841 +172 --- --- --- ---
3842 +173 --- --- --- ---
3843 +174 --- --- --- ---
3844 +175 --- --- --- --- ntp_gettime
3845 +176 --- --- --- --- ntp_adjtime
3846 +177 --- --- --- --- vm_allocate
3847 +178 --- --- --- --- vm_deallocate
3848 +179 --- --- --- --- vm_inherit
3849 +180 --- --- --- --- vm_protect
3850 +181 --- --- --- --- setgid
3851 +182 --- --- --- --- setegid
3852 +183 --- --- --- --- seteuid
3853 diff -uNr --exclude-from=dontdiff linux-2.4.3/Documentation/abi/TODO.ibcs linux/Documentation/abi/TODO.ibcs
3854 --- linux-2.4.3/Documentation/abi/TODO.ibcs Thu Jan 1 01:00:00 1970
3855 +++ linux/Documentation/abi/TODO.ibcs Fri Mar 30 16:12:20 2001
3858 + These are leftovers from iBCS, I just removed what is already
3859 + done in linux-abi or isn't relevant for us. --hch
3862 +^Z disconnects but the next read seems to return an error instead
3863 +of blocking? (Fixed?)
3865 +SIOGIFFLAGS seems to get passed an empty string as the interface name
3866 +(ISC ping). What is supposed to be happening?
3868 +If a timod putmsg fails we should set an error status on the socket and
3869 +return it on future calls for strict compatibility. Currently we recover
3870 +from things such as protocol errors rather more than we should.
3872 +Getmsg() - when select returns we may not be the first process to wake
3873 +up and handle the event. So the recvfrom ought to be non-blocking (not
3874 +possible?). If it would block we should go back to the select (unless
3875 +the descriptor is in non-blocking mode). (DONE?)
3877 +How should we go about returning TLOOK? Currently we are only working
3878 +synchronously so it isn't essential yet. It looks like it's all handled
3881 +The T_MORE flag on t_snd() and t_rcv() marks message boundaries. Strictly
3882 +these should be preserved end-to-end. Possible across sockets?
3883 +(X/Open specify that message boundaries shouldn't be relied on with TCP)
3885 +Need I_SETSIG ioctl to enable SIGPOLL on available input etc. Note that
3886 +a control message counts as input. This should interface with poll() too.
3888 +getmsg() returns EINTR if a signal interrupts it but the t_*() functions
3889 +don't seem to propogate this back to the application. Presumably they
3892 +The SCO timod doesn't seem to pay much attention to the TI_* command
3893 +in an ioctl but uses the T_* primitive in the message block. i.e. if
3894 +you have T_BIND_REQ in the message but TI_GETINFO as the ioctl command
3895 +timod will do a bind. Currently we use the TI_* by preference. This
3896 +needs to change to avoid breaking programs that worked on SCO even
3897 +though broken. It shouldn't be _essential_ though as all this is
3898 +normally hidden in libnsl_s so should be consistent.
3900 +Connects are currently forced synchronous. It wouldn't be too much
3901 +to allow them to happen asynchronously but the async confirmation
3902 +is supposed to contain the address we connected to and that is only
3903 +available from the connection request message. Unless we save it
3904 +somewhere or look it up from the socket. Hang on, we have getpeername()
3907 +There are slight semantic differences between O_NDELAY and O_NONBLOCK
3908 +which cause different behaviour on SCO at least. For instance O_NDELAY
3909 +does cause t_connect to work asynchronously but O_NONBLOCK doesn't.
3910 +Under Linux O_NDELAY and O_NONBLOCK are the same. This could cause
3911 +problems at some point I guess...
3913 +Under SCO at least poll and select are different. Poll works on things
3914 +that select can be used on but select cannot necessarily work on things
3915 +that can be polled. Specifically you can poll a transport end point
3916 +but not select on it. Badly written programs could block when they
3918 diff -uNr --exclude-from=dontdiff linux-2.4.3/Makefile linux/Makefile
3919 --- linux-2.4.3/Makefile Fri Mar 30 14:48:20 2001
3920 +++ linux/Makefile Fri Mar 30 17:25:23 2001
3921 @@ -118,10 +118,11 @@
3923 CORE_FILES =kernel/kernel.o mm/mm.o fs/fs.o ipc/ipc.o
3924 NETWORKS =net/network.o
3926 CRYPTO =crypto/crypto.o
3928 LIBS =$(TOPDIR)/lib/lib.a
3929 -SUBDIRS =kernel drivers mm fs net ipc lib crypto
3930 +SUBDIRS =kernel drivers mm fs net ipc lib crypto abi
3942 diff -uNr --exclude-from=dontdiff linux-2.4.3/abi/Config.in linux/abi/Config.in
3943 --- linux-2.4.3/abi/Config.in Thu Jan 1 01:00:00 1970
3944 +++ linux/abi/Config.in Fri Mar 30 16:13:20 2001
3947 +mainmenu_option next_comment
3948 +comment 'Binary emulation of other systems'
3950 +tristate 'Support for binary emulation of other systems' CONFIG_ABI
3952 +# BSD is completly out of date ...
3953 +#dep_tristate ' BSD binary emulation support' CONFIG_ABI_BSD $CONFIG_ABI $CONFIG_ABI
3954 +dep_tristate ' SVR3/SVR4 (and derivates) binary emulation support' CONFIG_ABI_SVR4 $CONFIG_ABI
3955 +if [ "$CONFIG_ABI_SVR4" = "y" -o "$CONFIG_ABI_SVR4" = "m" ]; then
3956 + dep_mbool ' Include SCO OpenServer specifics' CONFIG_ABI_IBCS_SCO $CONFIG_ABI_SVR4
3957 + dep_mbool ' Include ISC specifics' CONFIG_ABI_IBCS_ISC $CONFIG_ABI_SVR4
3958 + dep_mbool ' Include Wyse V/386 specifics' CONFIG_ABI_IBCS_WYSE $CONFIG_ABI_SVR4
3959 + dep_mbool ' Include Xenix specifics' CONFIG_ABI_XENIX $CONFIG_ABI_SVR4
3961 + dep_tristate ' UnixWare 7.x binary emulation support' CONFIG_ABI_UW7 $CONFIG_ABI_SVR4
3962 + dep_tristate ' Solaris 2.x binary emulation support' CONFIG_ABI_SOLARIS $CONFIG_ABI_SVR4
3965 +comment 'Support for foreign binary formats'
3966 +# coff is used by SVR3, x.out by Xenix, both are SVR4-subsets
3967 +dep_tristate ' Kernel support for x.out binaries' CONFIG_BINFMT_XOUT $CONFIG_ABI_SVR4
3968 +dep_tristate ' Kernel support for COFF binaries' CONFIG_BINFMT_COFF $CONFIG_ABI_SVR4
3970 +comment 'Linux-ABI debugging settings'
3971 +dep_mbool ' Enable verbose errors' CONFIG_ABI_VERBOSE_ERRORS $CONFIG_ABI
3974 +if [ "$CONFIG_ABI" != "n" ]; then
3975 + define_bool CONFIG_ABI_SPX y
3976 + define_bool CONFIG_ABI_XTI y
3978 + define_bool CONFIG_ABI_TLI_OPTMGMT y
3979 + define_bool CONFIG_ABI_XTI_OPTMGMT n
3983 diff -uNr --exclude-from=dontdiff linux-2.4.3/abi/Makefile linux/abi/Makefile
3984 --- linux-2.4.3/abi/Makefile Thu Jan 1 01:00:00 1970
3985 +++ linux/abi/Makefile Tue Mar 13 18:49:41 2001
3989 +# Makefile for the kernel ABI code
3995 +res-$(CONFIG_ABI) += common/abi-common.o
3996 +res-$(CONFIG_ABI_SVR4) += svr4/abi-svr4.o
3997 +res-$(CONFIG_ABI_UW7) += uw7/abi-uw7.o
3998 +res-$(CONFIG_ABI_SOLARIS) += solaris/abi-solaris.o
4000 +subdir-$(CONFIG_ABI) += common
4001 +subdir-$(CONFIG_ABI_SVR4) += svr4
4002 +subdir-$(CONFIG_ABI_UW7) += uw7
4003 +subdir-$(CONFIG_ABI_SOLARIS) += solaris
4007 +include $(TOPDIR)/Rules.make
4008 diff -uNr --exclude-from=dontdiff linux-2.4.3/abi/common/Makefile linux/abi/common/Makefile
4009 --- linux-2.4.3/abi/common/Makefile Thu Jan 1 01:00:00 1970
4010 +++ linux/abi/common/Makefile Mon Mar 12 16:34:48 2001
4013 +# Makefile for the kernel ABI code shared by different emulations
4016 +O_TARGET := dummy.o
4018 +list-multi := abi-common.o
4019 +abi-common-objs := core.o ioctl.o map.o signal.o socket.o socksys.o stat.o \
4020 + wysev386.o $(ARCH)_dispatch.o $(ARCH)_maps.o
4022 +export-objs := $(abi-common-objs)
4024 +obj-$(CONFIG_ABI) += abi-common.o
4027 +include $(TOPDIR)/Rules.make
4029 +abi-common.o: $(abi-common-objs)
4030 + $(LD) -r -o $@ $(abi-common-objs)
4031 diff -uNr --exclude-from=dontdiff linux-2.4.3/abi/common/core.c linux/abi/common/core.c
4032 --- linux-2.4.3/abi/common/core.c Thu Jan 1 01:00:00 1970
4033 +++ linux/abi/common/core.c Fri Mar 30 15:23:38 2001
4036 + * core.c - generic emulation syscalls
4038 + * Copyright (C) 1993 Linus Torvalds
4040 + * Modified by Eric Youngdale to include all ibcs syscalls.
4041 + * Re-written by Drew Sullivan to handle lots more of the syscalls correctly.
4044 +#include <linux/config.h>
4045 +#include <linux/module.h>
4047 +#include <linux/types.h>
4048 +#include <linux/errno.h>
4049 +#include <linux/sched.h>
4050 +#include <linux/kernel.h>
4051 +#include <linux/mm.h>
4052 +#include <linux/stat.h>
4053 +#include <linux/stddef.h>
4054 +#include <linux/unistd.h>
4055 +#include <linux/ptrace.h>
4056 +#include <linux/fcntl.h>
4057 +#include <linux/time.h>
4059 +#include <linux/fs.h>
4060 +#include <linux/sys.h>
4061 +#include <linux/slab.h>
4062 +#include <linux/file.h>
4063 +#include <linux/dirent.h>
4065 +#include <asm/uaccess.h>
4066 +#include <asm/system.h>
4068 +#include <abi/abi.h>
4069 +#include <abi/signal.h>
4070 +#include <abi/trace.h>
4072 +int abi_brk(unsigned long newbrk)
4075 + return current->mm->brk;
4076 + if (newbrk != current->mm->brk && (unsigned long)SYS(brk)(newbrk) != newbrk)
4081 +EXPORT_SYMBOL(abi_brk);
4084 +int abi_fork(struct pt_regs * regs) {
4086 + printk ("ibcs2/sparc: No fork yet\n");
4087 + send_sig(SIGSEGV, current, 1);
4091 +EXPORT_SYMBOL(abi_fork);
4093 +int abi_wait(struct pt_regs * regs) {
4095 + printk ("ibcs2/sparc: No wait yet\n");
4096 + send_sig(SIGSEGV, current, 1);
4100 +EXPORT_SYMBOL(abi_wait);
4102 +int abi_exec(struct pt_regs * regs)
4106 + printk ("ibcs2/sparc: No fork yet\n");
4107 + send_sig(SIGSEGV, current, 1);
4111 +EXPORT_SYMBOL(abi_exec);
4113 +int abi_pipe(struct pt_regs * regs)
4116 + mm_segment_t old_fs = get_fs();
4120 + rvalue = SYS(pipe)(&filedes);
4122 + if (rvalue == 0) {
4123 + rvalue = filedes[0];
4124 + regs->u_regs [UREG_I0] = filedes[1];
4129 +EXPORT_SYMBOL(abi_pipe);
4131 +int abi_getpid(struct pt_regs * regs)
4133 + return current->pid;
4136 +EXPORT_SYMBOL(abi_getpid);
4138 +int abi_getuid(struct pt_regs * regs)
4140 + return current->uid;
4143 +EXPORT_SYMBOL(abi_getuid);
4145 +int abi_getgid(struct pt_regs * regs)
4147 + return current->gid;
4150 +EXPORT_SYMBOL(abi_getgid);
4152 +#else /* __sparc__ */
4154 +int abi_lseek(int fd, unsigned long offset, int whence)
4157 + struct file *file;
4158 + struct inode *inode;
4160 + error = SYS(lseek)(fd, offset, whence);
4161 + if (error != -ESPIPE || !personality(PER_SCOSVR3))
4167 + inode = file->f_dentry->d_inode;
4168 + if (inode && (S_ISCHR(inode->i_mode) || S_ISBLK(inode->i_mode)))
4175 +EXPORT_SYMBOL(abi_lseek);
4177 +int abi_fork(struct pt_regs * regs)
4181 + regs->eflags &= ~1; /* Clear carry flag */
4182 + rvalue = SYS(fork)(regs->ebx, regs->ecx, 1,
4183 + regs->esi, regs->edi, regs->ebp, regs->eax, regs->xds,
4184 + regs->xes, regs->orig_eax,
4185 + regs->eip, regs->xcs, regs->eflags, regs->esp, regs->xss);
4190 +EXPORT_SYMBOL(abi_fork);
4192 +int abi_pipe(struct pt_regs * regs)
4195 + mm_segment_t old_fs = get_fs();
4199 + rvalue = SYS(pipe)(&filedes);
4201 + if (rvalue == 0) {
4202 + rvalue = filedes[0];
4203 + regs->edx = filedes[1];
4208 +EXPORT_SYMBOL(abi_pipe);
4210 +/* note the double value return in eax and edx */
4211 +int abi_getpid(struct pt_regs * regs)
4213 + regs->edx = current->p_pptr->pid;
4215 + return current->pid;
4218 +EXPORT_SYMBOL(abi_getpid);
4220 +/* note the double value return in eax and edx */
4221 +int abi_getuid(struct pt_regs * regs)
4223 + regs->edx = current->euid;
4225 + return current->uid;
4228 +EXPORT_SYMBOL(abi_getuid);
4230 +/* note the double value return in eax and edx */
4231 +int abi_getgid(struct pt_regs * regs)
4233 + regs->edx = current->egid;
4235 + return current->gid;
4238 +EXPORT_SYMBOL(abi_getgid);
4240 +#define FLAG_ZF 0x0040
4241 +#define FLAG_PF 0x0004
4242 +#define FLAG_SF 0x0080
4243 +#define FLAG_OF 0x0800
4245 +#define MAGIC_WAITPID_FLAG (FLAG_ZF | FLAG_PF | FLAG_SF | FLAG_OF)
4247 +int abi_wait(struct pt_regs * regs)
4249 + long result, kopt;
4250 + int pid, loc, opt;
4251 + mm_segment_t old_fs;
4253 + /* xenix wait() puts status to edx and returns pid */
4254 + if (personality(PER_XENIX)) {
4255 + old_fs = get_fs();
4256 + set_fs (get_ds());
4257 + result = SYS(wait4)(-1, &loc, 0, NULL);
4263 + /* if ZF,PF,SF,and OF are set then it is waitpid */
4264 + if ((regs->eflags & MAGIC_WAITPID_FLAG) == MAGIC_WAITPID_FLAG) {
4265 + get_user(pid, ((unsigned long *) regs->esp) + 1);
4266 + get_user(loc, ((unsigned long *) regs->esp) + 2);
4267 + get_user(opt, ((unsigned long *) regs->esp) + 3);
4269 + /* Now translate the options from the SVr4 numbers */
4271 + if (opt & 0100) kopt |= WNOHANG;
4272 + if (opt & 4) kopt |= WUNTRACED;
4274 + result = SYS(wait4)(pid, loc, kopt, NULL);
4276 + get_user(loc, ((unsigned long *) regs->esp) + 1);
4277 + result = SYS(wait4)(-1, loc, WUNTRACED, NULL);
4279 + if (result >= 0 && loc) {
4280 + get_user(regs->edx, (unsigned long *) loc);
4281 + if ((regs->edx & 0xff) == 0x7f) {
4282 + int sig = (regs->edx >> 8) & 0xff;
4283 + if (sig < NSIGNALS)
4284 + sig = current->exec_domain->signal_map[sig];
4285 + regs->edx = (regs->edx & (~0xff00)) | (sig << 8);
4286 + put_user(regs->edx, (unsigned long *)loc);
4287 + } else if (regs->edx && regs->edx == (regs->edx & 0xff)) {
4288 + if ((regs->edx & 0x7f) < NSIGNALS)
4289 + regs->edx = current->exec_domain->signal_map[regs->edx & 0x7f];
4290 + put_user(regs->edx, (unsigned long *)loc);
4296 +EXPORT_SYMBOL(abi_wait);
4299 + * abi_exec() executes a new program.
4301 +int abi_exec(struct pt_regs *regs)
4304 + char *pgm, **argv, **envp;
4307 + get_user((unsigned long) pgm, ((unsigned long *) regs->esp) + 1);
4308 + get_user((unsigned long) argv, ((unsigned long *) regs->esp) + 2);
4309 + get_user((unsigned long) envp, ((unsigned long *) regs->esp) + 3);
4311 + if (abi_traced(ABI_TRACE_API)) {
4317 + __abi_trace(" pgm: 0x%lx pointer error %ld\n",
4318 + (unsigned long)pgm, PTR_ERR(q));
4320 + __abi_trace(" pgm: 0x%lx \"%s\"\n",
4321 + (unsigned long)pgm, q);
4325 + for (i = 0, v = argv; v && i < 20; v++,i++) {
4326 + if (get_user(p, v) || !p)
4330 + __abi_trace(" arg: 0x%lx pointer error %ld\n",
4331 + (unsigned long)p, PTR_ERR(q));
4333 + __abi_trace(" arg: 0x%lx \"%s\"\n",
4334 + (unsigned long)p, q);
4339 + __abi_trace(" arg: ...\n");
4341 + for (i=0,v=envp; v && i < 20; v++,i++) {
4342 + if (get_user(p, v) || !p)
4346 + __abi_trace(" env: 0x%lx pointer error %ld\n",
4347 + (unsigned long)p, PTR_ERR(q));
4349 + __abi_trace(" env: 0x%lx \"%s\"\n",
4350 + (unsigned long)p, q);
4355 + __abi_trace(" env: ...\n");
4358 + filename = getname(pgm);
4359 + error = PTR_ERR(filename);
4360 + if (!IS_ERR(filename)) {
4361 + /* if you get an error on this undefined, then remove the */
4362 + /* 'static' declaration in /linux/fs/exec.c */
4363 + error = do_execve(filename, argv, envp, regs);
4364 + putname (filename);
4369 +EXPORT_SYMBOL(abi_exec);
4371 +int abi_procids(struct pt_regs * regs)
4373 + int op, arg_offset;
4375 + get_user(op, ((unsigned long *)regs->esp)+1);
4377 + /* Remap op codes for current personality if necessary. */
4378 + switch (current->personality & PER_MASK) {
4379 + case (PER_SVR3 & PER_MASK):
4380 + case (PER_SCOSVR3 & PER_MASK):
4381 + case (PER_WYSEV386 & PER_MASK):
4382 + case (PER_XENIX & PER_MASK): {
4383 + if (op < 0 || op > 5)
4385 + op = "\000\001\005\003\377\377"[op];
4387 + /* SCO at least uses an interesting library to
4388 + * syscall mapping that leaves an extra return
4389 + * address between the op code and the arguments.
4400 + case 0: /* getpgrp */
4401 + return current->pgrp;
4403 + case 1: /* setpgrp */
4404 + SYS(setpgid)(0, 0);
4405 + current->tty=NULL;
4406 + return current->pgrp;
4408 + case 2: { /* getsid */
4409 + unsigned long pid;
4410 + get_user(pid, ((unsigned long *)regs->esp)
4411 + + 2 + arg_offset);
4412 + return SYS(getsid)(pid);
4415 + case 3: /* setsid */
4416 + return SYS(setsid)();
4418 + case 4: { /* getpgid */
4419 + unsigned long pid;
4420 + get_user(pid, ((unsigned long *)regs->esp)
4421 + + 2 + arg_offset);
4422 + return SYS(getpgid)(pid);
4425 + case 5: { /* setpgid */
4428 + get_user(pid, ((unsigned long *)regs->esp)
4429 + + 2 + arg_offset);
4430 + get_user(pgid, ((unsigned long *)regs->esp)
4431 + + 3 + arg_offset);
4432 + return SYS(setpgid)(pid, pgid);
4438 +EXPORT_SYMBOL(abi_procids);
4440 +#endif /* __sparc__ */
4442 +int abi_read(int fd, char *buf, int nbytes)
4444 + int error, here, posn, reclen;
4445 + struct file *file;
4447 + mm_segment_t old_fs;
4449 + error = SYS(read)(fd, buf, nbytes);
4450 + if (error != -EISDIR)
4454 + * Stupid bloody thing is trying to read a directory. Some old
4455 + * programs expect this to work. It works on SCO. To emulate it
4456 + * we have to map a dirent to a direct. This involves shrinking
4457 + * a long inode to a short. Fortunately nothing this archaic is
4458 + * likely to care about anything but the filenames of entries
4459 + * with non-zero inodes.
4466 + d = (struct dirent *)get_free_page(GFP_KERNEL);
4472 + error = posn = reclen = 0;
4474 + while (posn + reclen < nbytes) {
4475 + /* Save the current position and get another dirent */
4476 + here = file->f_pos;
4477 + old_fs = get_fs();
4478 + set_fs (get_ds());
4479 + error = SYS(readdir)(fd, d, 1);
4484 + /* If it'll fit in the buffer save it otherwise back up
4485 + * so it is read next time around.
4486 + * Oh, if we're at the beginning of the buffer there's
4487 + * no chance that this entry will ever fit so don't
4488 + * copy it and don't back off - we'll just pretend it
4491 + reclen = 16 * ((d->d_reclen + 13) / 14);
4492 + if (posn + reclen <= nbytes) {
4493 + /* SCO (at least) handles long filenames by breaking
4494 + * them up in to 14 character chunks of which all
4495 + * but the last have the inode set to 0xffff.
4497 + char *p = d->d_name;
4499 + /* Put all but the last chunk. */
4500 + while (d->d_reclen > 14) {
4501 + put_user(0xffff, (unsigned short *)(buf+posn));
4503 + copy_to_user(buf+posn, p, 14);
4506 + d->d_reclen -= 14;
4508 + /* Put the last chunk. Note the we have to fold a
4509 + * long inode number down to a short avoiding
4510 + * giving a zero inode number since that indicates
4511 + * an unused directory slot. Note also that the
4512 + * folding used here must match that used in stat()
4513 + * or path finding programs that do read() on
4514 + * directories will fail.
4517 + /* This appears to match what SCO does for
4518 + * reads on a directory with long inodes.
4520 + if ((unsigned long)d->d_ino > 0xfffe)
4521 + put_user(0xfffe, (unsigned short *)(buf+posn));
4523 + put_user((short)d->d_ino, (unsigned short *)(buf+posn));
4525 + /* This attempts to match the way stat and
4526 + * getdents fold long inodes to shorts.
4528 + if ((unsigned long)d->d_ino & 0xffff)
4529 + put_user((unsigned long)d->d_ino & 0xffff,
4530 + (unsigned short *)(buf+posn));
4532 + put_user(0xfffe, (unsigned short *)(buf+posn));
4535 + copy_to_user(buf+posn, p, d->d_reclen);
4537 + /* Ensure that filenames that don't fill the array
4538 + * completely are null filled.
4540 + for (; d->d_reclen < 14; d->d_reclen++)
4541 + put_user('\0', buf+posn+d->d_reclen);
4544 + } else if (posn) {
4545 + SYS(lseek)(fd, here, 0);
4546 + } /* else posn == 0 */
4549 + free_page((unsigned long)d);
4552 + /* If we've put something in the buffer return the byte count
4553 + * otherwise return the error status.
4555 + return (posn ? posn : error);
4558 +EXPORT_SYMBOL(abi_read);
4560 +#ifdef __TRACE_SELECT__
4561 +int abi_select(int n, void *rfds, void *wfds, void *efds, struct timeval *t)
4563 + struct timeval tv;
4566 + if (!abi_traced(ABI_TRACE_API) || !t)
4569 + error = get_user(tv.tv_sec, &(t->tv_sec));
4571 + error = get_user(tv.tv_usec, &(t->tv_usec));
4575 + __abi_trace("select timeout in %lus, %luus", tv.tv_sec, tv.tv_usec);
4578 + return SYS(_newselect)(n, rfds, wfds, efds, t);
4580 +EXPORT_SYMBOL(abi_select);
4587 + return SYS(time)(0);
4590 +EXPORT_SYMBOL(abi_time);
4593 +int abi_mknod(const char *fname, int mode, int dev)
4595 + /* Linux doesn't allow us to create a directory with mknod(). */
4596 + if ((mode & 0017000) == 0040000)
4597 + return abi_mkdir(fname, mode);
4598 + return SYS(mknod)(fname, mode, dev);
4601 +EXPORT_SYMBOL(abi_mknod);
4603 +int abi_mkdir(const char *fname, int mode)
4606 + mm_segment_t old_fs;
4609 + tmp = getname(fname);
4611 + return PTR_ERR(tmp);
4613 + /* Drop any trailing slash */
4614 + for (p=tmp; *p; p++);
4619 + old_fs = get_fs();
4621 + error = SYS(mkdir)(tmp, mode);
4628 +EXPORT_SYMBOL(abi_mkdir);
4631 + * Translate the signal number to the corresponding item for Linux.
4633 +static inline int abi_mapsig(int sig)
4635 + if ((unsigned int) sig >= NSIGNALS)
4637 + return current->exec_domain->signal_map[sig];
4640 +int abi_kill(int pid, int sig)
4642 + int outsig = abi_mapsig(sig & 0xFF);
4644 + abi_trace(ABI_TRACE_SIGNAL, "kill: insig (%d) outsig(%d)",
4645 + sig & 0xFF, outsig);
4649 + return SYS(kill)(pid, outsig);
4652 +EXPORT_SYMBOL(abi_kill);
4653 diff -uNr --exclude-from=dontdiff linux-2.4.3/abi/common/i386_dispatch.c linux/abi/common/i386_dispatch.c
4654 --- linux-2.4.3/abi/common/i386_dispatch.c Thu Jan 1 01:00:00 1970
4655 +++ linux/abi/common/i386_dispatch.c Fri Mar 30 15:23:38 2001
4658 + * arch/i386/abi/dispatch_i386.c
4660 + * Copyright (C) 1993 Linus Torvalds
4661 + * Modified by Eric Youngdale to include all ibcs syscalls.
4662 + * Re-written by Drew Sullivan to handle lots more of the syscalls correctly.
4664 + * Jan 30 1994, Merged Joe Portman's code -- Drew
4665 + * Jan 31 1994, Merged Eric Yongdale's code for elf support -- Drew
4668 + * Rebuilt with handling for multiple binary personalities
4669 + * -- Mike Jagdis (jaggy@purplet.demon.co.uk)
4672 + * Dual mode. Compiled in if you say yes to the configure iBCS
4673 + * question during 'make config'. Loadable module with kernel
4674 + * hooks otherwise.
4675 + * -- Mike Jagdis (jaggy@purplet.demon.co.uk)
4678 + * Added the /dev/socksys emulator. This allows applications which
4679 + * use the socket interface to Lachman streams based TCP/IP to use
4680 + * the Linux TCP/IP stack.
4681 + * -- Mike Jagdis (jaggy@purplet.demon.co.uk)
4687 +#include <linux/module.h>
4688 +#include <linux/errno.h>
4689 +#include <linux/sched.h>
4690 +#include <linux/kernel.h>
4691 +#include <linux/mm.h>
4692 +#include <linux/stddef.h>
4693 +#include <linux/unistd.h>
4694 +#include <linux/ptrace.h>
4695 +#include <linux/fcntl.h>
4696 +#include <linux/init.h>
4697 +#include <linux/slab.h>
4698 +#include <linux/fs.h>
4699 +#include <linux/sys.h>
4700 +#include <linux/personality.h>
4701 +#include <asm/uaccess.h>
4703 +#include <abi/abi.h>
4704 +#include <abi/trace.h>
4707 +#include "verb_errmap.inc"
4709 +#define last(x) ((sizeof(x)/sizeof(*x))-1)
4712 +MODULE_AUTHOR("Mike Jagdis <jaggy@purplet.demon.co.uk>");
4713 +MODULE_DESCRIPTION("Support for non-Linux programs");
4716 +u_int abi_traceflg = 0xffffffff;
4718 +MODULE_PARM(abi_traceflg, "i");
4719 +MODULE_PARM_DESC(abi_traceflg, "iBCS debug trace");
4722 +static void fail(long eax, ABI_func * p);
4723 +static void plist(char * name, char * args, int * list);
4725 +ABI_func * abi_current;
4727 +static const char * const sig_names[] = {
4728 + "SIGHUP", "SIGINT", "SIGQUIT", "SIGILL",
4729 + "SIGTRAP", "SIGABRT/SIGIOT","SIGUNUSED", "SIGFPE",
4730 + "SIGKILL", "SIGUSR1", "SIGSEGV", "SIGUSR2",
4731 + "SIGPIPE", "SIGALRM", "SIGTERM", "SIGSTKFLT",
4732 + "SIGCHLD", "SIGCONT", "SIGSTOP", "SIGTSTP",
4733 + "SIGTTIN", "SIGTTOU", "SIGIO/SIGPOLL/SIGURG",
4734 + "SIGXCPU", "SIGXFSZ", "SIGVTALRM", "SIGPROF",
4735 + "SIGWINCH", "SIGLOST", "SIGPWR", "SIG 31",
4741 +abi_dispatch(struct pt_regs * regs, ABI_func * p, int of)
4754 + /* If the number of arguments is negative this is an unfudged
4755 + * system call function and we need to look up the real function
4756 + * address in the kernel's sys_call_table.
4757 + * Note that we never modify the callmap itself but do the lookup
4758 + * for each call. This allows modules that provide syscalls to
4759 + * be loaded and unloaded without any messy locking.
4762 + kfunc = sys_call_table[(int)kfunc];
4764 + /* Watch for a magic zero. This exists because we
4765 + * can't use -0 to represent a system call that
4766 + * takes no arguments.
4768 + if (nargs == -ZERO)
4774 + if (nargs <= (short)(sizeof(args)/sizeof(args[0])))
4775 + for(i=0; i < nargs; i++)
4776 + get_user(args[i], ((unsigned long *)regs->esp)+(i+of));
4778 + if (abi_traced(ABI_TRACE_API)) {
4779 + if (nargs == Spl) {
4780 + for(i = 0; i < (int)strlen(p->args); i++)
4781 + get_user(args[i], ((u_long *)regs->esp) + (i + of));
4783 + plist(p->name, p->args, args);
4790 + ((sysfun_p)kfunc)(regs);
4791 + if (abi_traced(ABI_TRACE_API|ABI_TRACE_SIGNAL) &&
4792 + signal_pending(current)) {
4795 + signr = current->pending.signal.sig[0] &
4796 + ~current->blocked.sig[0];
4798 + __asm__("bsf %1,%0\n\t"
4802 + __abi_trace("SIGNAL %lu <%s>\n",
4803 + signr + 1, sig_names[signr]);
4807 + rvalue = ((sysfun_p)kfunc)(regs);
4810 + rvalue = ((sysfun_p)kfunc)();
4813 + rvalue = ((sysfun_p)kfunc)(args[0]);
4816 + rvalue = ((sysfun_p)kfunc)(args[0], args[1]);
4819 + rvalue = ((sysfun_p)kfunc)(args[0], args[1], args[2]);
4822 + rvalue = ((sysfun_p)kfunc)(args[0], args[1], args[2], args[3]);
4825 + rvalue = ((sysfun_p)kfunc)(args[0], args[1], args[2],
4826 + args[3], args[4]);
4829 + rvalue = ((sysfun_p)kfunc)(args[0], args[1], args[2],
4830 + args[3], args[4], args[5]);
4833 + rvalue = ((sysfun_p)kfunc)(args[0], args[1], args[2],
4834 + args[3], args[4], args[5],
4838 + fail(regs->eax, p);
4841 + fail(regs->eax, p);
4843 + if (rvalue >= 0 || rvalue < -ENOIOCTLCMD) {
4844 + regs->eflags &= ~1; /* Clear carry flag */
4845 + regs->eax = rvalue;
4847 + abi_trace(ABI_TRACE_API, "%s returns %ld {%ld}\n",
4848 + p->name, regs->eax, regs->edx);
4850 + regs->eflags |= 1; /* Set carry flag */
4851 + regs->eax = iABI_errors(-rvalue);
4853 + if (abi_traced(ABI_TRACE_API)) {
4854 +#ifdef CONFIG_ABI_VERBOSE_ERRORS
4855 + __abi_trace("%s error return linux=%d -> ibcs=%ld <%s>\n",
4856 + p->name, rvalue, regs->eax,
4857 + -rvalue < (int)(sizeof(errmsg)/sizeof(errmsg[0]))
4861 + __abi_trace("%s error return linux=%d -> ibcs=%ld\n",
4862 + p->name, rvalue, regs->eax);
4867 + if (abi_traced(ABI_TRACE_API|ABI_TRACE_SIGNAL) &&
4868 + signal_pending(current)) {
4871 + signr = current->pending.signal.sig[0] &
4872 + ~current->blocked.sig[0];
4874 + __asm__("bsf %1,%0\n\t"
4878 + __abi_trace("SIGNAL %lu <%s>, queued 0x%08lx\n",
4879 + signr + 1, sig_names[signr],
4880 + current->pending.signal.sig[0]);
4883 +EXPORT_SYMBOL(abi_dispatch);
4886 +abi_syscall(struct pt_regs *regs)
4888 + get_user(regs->eax, ((unsigned long *) regs->esp) + 1);
4891 + current->exec_domain->handler(-1,regs);
4896 +EXPORT_SYMBOL(abi_syscall);
4899 + * plist is used by the trace code to show the arg list
4902 +plist(char * name, char * args, int * list)
4905 + char *tmp, *p, arg_buf[512];
4907 + arg_buf[0] = '\0';
4912 + sprintf(p, "%d", *list++);
4915 + sprintf(p, "0%o", *list++);
4918 + sprintf(p, "0x%p", (void *)(*list++));
4922 + sprintf(p, "0x%x", *list++);
4925 + tmp = getname((char *)(*list++));
4926 + error = PTR_ERR(tmp);
4927 + if (!IS_ERR(tmp)) {
4928 + /* we are debugging, we don't need to see it all */
4930 + sprintf(p, "\"%s\"", tmp);
4935 + sprintf(p, "?%c%c?", '%', args[-1]);
4946 + __abi_trace("%s(%s)\n", name, arg_buf);
4950 +fail(long eax, ABI_func * p)
4952 + if (!abi_traced(ABI_TRACE_API))
4955 + printk(KERN_ERR "[%s:%d] Unsupported ABI function 0x%lx (%s)\n",
4956 + current->comm, current->pid, eax, p->name);
4959 +EXPORT_SYMBOL(abi_traceflg);
4960 +EXPORT_SYMBOL(abi_current);
4961 diff -uNr --exclude-from=dontdiff linux-2.4.3/abi/common/i386_maps.c linux/abi/common/i386_maps.c
4962 --- linux-2.4.3/abi/common/i386_maps.c Thu Jan 1 01:00:00 1970
4963 +++ linux/abi/common/i386_maps.c Mon Mar 12 16:34:48 2001
4965 +#include <linux/kernel.h>
4966 +#include <linux/net.h>
4967 +#include <linux/socket.h>
4968 +#include <abi/socket.h>
4969 +#include <linux/signal.h>
4970 +#include <abi/map.h>
4971 +#define __NO_VERSION__
4972 + #include <linux/module.h>
4974 +struct map_segment abi_sockopt_map[] = {
4975 + { 0x0001, 0x0001, (char *)SO_DEBUG },
4976 + { 0x0002, 0x0002, (char *)__SO_ACCEPTCON },
4977 + { 0x0004, 0x0004, (char *)SO_REUSEADDR },
4978 + { 0x0008, 0x0008, (char *)SO_KEEPALIVE },
4979 + { 0x0010, 0x0010, (char *)SO_DONTROUTE },
4980 + { 0x0020, 0x0020, (char *)SO_BROADCAST },
4981 + { 0x0040, 0x0040, (char *)SO_USELOOPBACK },
4982 + { 0x0080, 0x0080, (char *)SO_LINGER },
4983 + { 0x0100, 0x0100, (char *)SO_OOBINLINE },
4984 + { 0x0200, 0x0200, (char *)SO_ORDREL },
4985 + { 0x0400, 0x0400, (char *)SO_IMASOCKET },
4986 + { 0x1001, 0x1001, (char *)SO_SNDBUF },
4987 + { 0x1002, 0x1002, (char *)SO_RCVBUF },
4988 + { 0x1003, 0x1003, (char *)SO_SNDLOWAT },
4989 + { 0x1004, 0x1004, (char *)SO_RCVLOWAT },
4990 + { 0x1005, 0x1005, (char *)SO_SNDTIMEO },
4991 + { 0x1006, 0x1006, (char *)SO_RCVTIMEO },
4992 + { 0x1007, 0x1007, (char *)SO_ERROR },
4993 + { 0x1008, 0x1008, (char *)SO_TYPE },
4994 + { 0x1009, 0x1009, (char *)SO_PROTOTYPE },
4999 +struct map_segment abi_af_map[] = {
5000 + /* The first three entries (AF_UNSPEC, AF_UNIX and AF_INET)
5001 + * are identity mapped. All others aren't available under
5002 + * Linux, nor are Linux's AF_AX25 and AF_IPX available from
5003 + * SCO as far as I know.
5009 +EXPORT_SYMBOL(abi_af_map);
5010 +EXPORT_SYMBOL(abi_sockopt_map);
5011 diff -uNr --exclude-from=dontdiff linux-2.4.3/abi/common/ioctl.c linux/abi/common/ioctl.c
5012 --- linux-2.4.3/abi/common/ioctl.c Thu Jan 1 01:00:00 1970
5013 +++ linux/abi/common/ioctl.c Mon Mar 12 16:34:48 2001
5017 + * ioctl.c - generic emultions ioctls
5019 + * Copyright (C) 1991, 1992 Linus Torvalds
5021 + * Written by Drew Sullivan.
5022 + * Rewritten by Mike Jagdis.
5026 +#include <linux/module.h>
5028 +#include <linux/errno.h>
5029 +#include <linux/stat.h>
5030 +#include <linux/fs.h>
5031 +#include <linux/sched.h>
5032 +#include <linux/kernel.h>
5033 +#include <linux/termios.h>
5034 +#include <linux/mtio.h>
5035 +#include <linux/time.h>
5036 +#include <linux/sockios.h>
5037 +#include <linux/mm.h>
5038 +#include <linux/file.h>
5040 +#include <asm/uaccess.h>
5042 +#include <abi/abi.h>
5043 +#include <abi/bsd.h>
5044 +#include <abi/stream.h>
5045 +#include <abi/tli.h>
5046 +#include <abi/abi4.h>
5047 +#include <abi/trace.h>
5050 +int abi_ioctl_socksys(int fd, unsigned int func, void *arg);
5053 +static inline char *fix(int n)
5055 + static char char_class[4];
5057 + char_class[0] = n & 0xFF0000 ? (char)((n >> 16) & 0xFF) : '.';
5058 + char_class[1] = n & 0x00FF00 ? (char)((n >> 8) & 0xFF) : '.';
5059 + char_class[2] = n & 0x0000FF ? (char)((n ) & 0xFF) : '.';
5060 + char_class[3] = 0;
5062 + return char_class;
5065 +#define BSD_NCCS 20
5066 +struct bsd_termios {
5067 + unsigned long c_iflag;
5068 + unsigned long c_oflag;
5069 + unsigned long c_cflag;
5070 + unsigned long c_lflag;
5071 + unsigned char c_cc[BSD_NCCS];
5075 +static unsigned long speed_map[] = {
5076 + 0, 50, 75, 110, 134, 150, 200, 300, 600, 1200, 1800, 2400,
5077 + 4800, 9600, 19200, 38400
5080 +static unsigned long
5081 +bsd_to_linux_speed(unsigned long s)
5094 + for (i=0; i<sizeof(speed_map)/sizeof(speed_map[0]); i++)
5095 + if (s <= speed_map[i])
5100 +static unsigned long
5101 +linux_to_bsd_speed(unsigned long s)
5111 + return speed_map[s];
5118 +bsd_to_linux_termios(int fd, int op, struct bsd_termios *it)
5121 + mm_segment_t old_fs;
5122 + unsigned long temp;
5123 + char bsd_cc[BSD_NCCS];
5126 + error = verify_area(VERIFY_READ, it, sizeof(struct bsd_termios));
5130 + old_fs = get_fs();
5132 + error = SYS(ioctl)(fd, TCGETS, &t);
5137 + __get_user(t.c_iflag, &it->c_iflag);
5138 + t.c_iflag = (t.c_iflag & ~0xc00)
5139 + | ((t.c_iflag & 0x400) << 1)
5140 + | ((t.c_iflag & 0x800) >> 1);
5142 + get_user(temp, &it->c_oflag);
5143 + t.c_oflag = (t.c_oflag & ~0x1805)
5145 + | ((temp & 2) << 1)
5146 + | ((temp & 4) << 10)
5147 + | ((temp & 4) << 9);
5149 + get_user(temp, &it->c_cflag);
5150 + t.c_cflag = (t.c_cflag & ~0xfff)
5151 + | ((temp & 0xff00) >> 4);
5152 + if (t.c_cflag & 0x30000)
5153 + t.c_cflag |= 020000000000;
5154 + t.c_cflag |= bsd_to_linux_speed(({long s; get_user(s, &it->c_ospeed); s;}))
5155 + | (bsd_to_linux_speed(({long s; get_user(s, &it->c_ispeed); s;})) << 16);
5157 + get_user(temp, &it->c_lflag);
5158 + t.c_lflag = (t.c_lflag & ~0157663)
5159 + | ((temp & 1) << 12)
5160 + | ((temp & 0x46) << 3)
5161 + | ((temp & 0x420) << 5)
5162 + | ((temp & 0x180) >> 7)
5163 + | ((temp & 0x400000) >> 14)
5164 + | ((temp & 0x2800000) >> 11)
5165 + | ((temp & 0x80000000) >> 24);
5167 + copy_from_user(bsd_cc, &it->c_cc, BSD_NCCS);
5168 + t.c_cc[VEOF] = bsd_cc[0];
5169 + t.c_cc[VEOL] = bsd_cc[1];
5170 + t.c_cc[VEOL2] = bsd_cc[2];
5171 + t.c_cc[VERASE] = bsd_cc[3];
5172 + t.c_cc[VWERASE] = bsd_cc[4];
5173 + t.c_cc[VKILL] = bsd_cc[5];
5174 + t.c_cc[VREPRINT] = bsd_cc[6];
5175 + t.c_cc[VSWTC] = bsd_cc[7];
5176 + t.c_cc[VINTR] = bsd_cc[8];
5177 + t.c_cc[VQUIT] = bsd_cc[9];
5178 + t.c_cc[VSUSP] = bsd_cc[10];
5179 +/* t.c_cc[VDSUSP] = bsd_cc[11];*/
5180 + t.c_cc[VSTART] = bsd_cc[12];
5181 + t.c_cc[VSTOP] = bsd_cc[13];
5182 + t.c_cc[VLNEXT] = bsd_cc[14];
5183 + t.c_cc[VDISCARD] = bsd_cc[15];
5184 + t.c_cc[VMIN] = bsd_cc[16];
5185 + t.c_cc[VTIME] = bsd_cc[17];
5186 +/* t.c_cc[VSTATUS] = bsd_cc[18];*/
5189 + error = SYS(ioctl)(fd, op, &t);
5197 +linux_to_bsd_termios(int fd, int op, struct bsd_termios *it)
5200 + char bsd_cc[BSD_NCCS];
5201 + mm_segment_t old_fs;
5204 + error = verify_area(VERIFY_WRITE, it, sizeof(struct bsd_termios));
5208 + old_fs = get_fs();
5210 + error = SYS(ioctl)(fd, op, &t);
5215 + put_user((t.c_iflag & 0777)
5216 + | ((t.c_iflag & 02000) >> 1)
5217 + | ((t.c_iflag & 010000) >> 2)
5218 + | ((t.c_iflag & 020000) >> 4),
5221 + put_user((t.c_oflag & 1)
5222 + | ((t.c_oflag & 04) >> 1)
5223 + | ((t.c_oflag & 014000) == 014000 ? 4 : 0),
5226 + put_user((t.c_cflag & ~020000007777)
5227 + | ((t.c_cflag & 0xff0) << 4)
5228 + | ((t.c_cflag & 020000000000) ? 0x30000 : 0),
5231 + put_user(linux_to_bsd_speed(t.c_cflag & CBAUD), &it->c_ospeed);
5232 + if ((t.c_cflag & CIBAUD) != 0)
5233 + put_user(linux_to_bsd_speed((t.c_cflag & CIBAUD) >> 16),
5236 + put_user(linux_to_bsd_speed(t.c_cflag & CBAUD),
5239 + put_user((t.c_lflag & 07777626010)
5240 + | ((t.c_lflag & 03) << 7)
5241 + | ((t.c_lflag & 01160) >> 3)
5242 + | ((t.c_lflag & 0400) << 14)
5243 + | ((t.c_lflag & 02000) >> 4)
5244 + | ((t.c_lflag & 04000) >> 11)
5245 + | ((t.c_lflag & 010000) << 11)
5246 + | ((t.c_lflag & 040000) << 15)
5247 + | ((t.c_lflag & 0100000) >> 5),
5250 + bsd_cc[0] = t.c_cc[VEOF];
5251 + bsd_cc[1] = t.c_cc[VEOL];
5252 + bsd_cc[2] = t.c_cc[VEOL2];
5253 + bsd_cc[3] = t.c_cc[VERASE];
5254 + bsd_cc[4] = t.c_cc[VWERASE];
5255 + bsd_cc[5] = t.c_cc[VKILL];
5256 + bsd_cc[6] = t.c_cc[VREPRINT];
5257 + bsd_cc[7] = t.c_cc[VSWTC];
5258 + bsd_cc[8] = t.c_cc[VINTR];
5259 + bsd_cc[9] = t.c_cc[VQUIT];
5260 + bsd_cc[10] = t.c_cc[VSUSP];
5261 + bsd_cc[11] = t.c_cc[VSUSP];
5262 + bsd_cc[12] = t.c_cc[VSTART];
5263 + bsd_cc[13] = t.c_cc[VSTOP];
5264 + bsd_cc[14] = t.c_cc[VLNEXT];
5265 + bsd_cc[15] = t.c_cc[VDISCARD];
5266 + bsd_cc[16] = t.c_cc[VMIN];
5267 + bsd_cc[17] = t.c_cc[VTIME];
5268 + bsd_cc[18] = 0; /* t.c_cc[VSTATUS]; */
5271 + copy_to_user(&it->c_cc, bsd_cc, BSD_NCCS);
5280 + unsigned char sg_ispeed;
5281 + unsigned char sg_ospeed;
5282 + unsigned char sg_erase;
5283 + unsigned char sg_kill;
5296 +struct v7_ltchars {
5306 +int bsd_ioctl_termios(int fd, unsigned int func, void *arg)
5308 + switch (func & 0xff) {
5309 + case 0: { /* TIOCGETD */
5310 + unsigned long ldisc;
5311 + mm_segment_t old_fs;
5314 + error = verify_area(VERIFY_WRITE, arg,
5315 + sizeof(unsigned short));
5319 + old_fs = get_fs();
5321 + error = SYS(ioctl)(fd, TIOCGETD, &ldisc);
5324 + put_user(ldisc, (unsigned short *)arg);
5327 + case 1: { /* TIOCSETD */
5328 + unsigned long ldisc;
5329 + mm_segment_t old_fs;
5332 + error = verify_area(VERIFY_READ, arg,
5333 + sizeof(unsigned short));
5337 + get_user(ldisc, (unsigned short *)arg);
5338 + old_fs = get_fs();
5340 + error = SYS(ioctl)(fd, TIOCSETD, &ldisc);
5345 + case 2: { /* TIOCHPCL */
5347 + mm_segment_t old_fs;
5350 + old_fs = get_fs();
5352 + error = SYS(ioctl)(fd, TCGETS, &t);
5358 + t.c_cflag |= HUPCL;
5360 + t.c_cflag &= ~HUPCL;
5362 + old_fs = get_fs();
5364 + error = SYS(ioctl)(fd, TCSETS, &t);
5369 + case 8: { /* TIOCGETP */
5371 + mm_segment_t old_fs;
5373 + struct v7_sgttyb sg;
5375 + error = verify_area(VERIFY_WRITE, arg, sizeof(sg));
5379 + old_fs = get_fs();
5381 + error = SYS(ioctl)(fd, TCGETS, &t);
5386 + sg.sg_ispeed = sg.sg_ospeed = 0;
5387 + sg.sg_erase = t.c_cc[VERASE];
5388 + sg.sg_kill = t.c_cc[VKILL];
5390 + /* Old - became TANDEM instead.
5391 + * ((t.c_cflag & HUPCL) >> 10)
5394 +/* O_ODDP */ ((t.c_cflag & PARODD) >> 3)
5395 +/* O_EVENP */ | ((t.c_cflag & PARENB) >> 1)
5396 +/* LITOUT */ | ((t.c_cflag & OPOST) ? 0 : 0x200000)
5397 +/* O_CRMOD */ | ((t.c_oflag & ONLCR) << 2)
5398 +/* O_NL1|O_VTDELAY */ | (t.c_oflag & (NL1|VTDLY))
5399 +/* O_TBDELAY */ | ((t.c_oflag & TABDLY) ? 02000 : 0)
5400 +/* O_CRDELAY */ | ((t.c_oflag & CRDLY) << 3)
5401 +/* O_BSDELAY */ | ((t.c_oflag & BSDLY) << 2)
5402 +/* O_ECHO|O_LCASE */ | (t.c_lflag & (XCASE|ECHO))
5403 + | ((t.c_lflag & ICANON)
5404 +/* O_CBREAK or O_RAW */ ? 0 : ((t.c_lflag & ISIG) ? 0x02 : 0x20))
5405 + /* Incomplete... */
5408 + copy_to_user(arg, &sg, sizeof(sg));
5412 + case 9: /* TIOCSETP */
5413 + case 10: { /* TIOCSETN */
5415 + mm_segment_t old_fs;
5417 + struct v7_sgttyb sg;
5419 + error = verify_area(VERIFY_READ, arg, sizeof(sg));
5422 + copy_from_user(&sg, arg, sizeof(sg));
5424 + old_fs = get_fs();
5426 + error = SYS(ioctl)(fd, TCGETS, &t);
5431 + t.c_cc[VERASE] = sg.sg_erase;
5432 + t.c_cc[VKILL] = sg.sg_kill;
5433 + t.c_iflag = ICRNL | IXON;
5435 + t.c_lflag = ISIG | ICANON;
5436 + if (sg.sg_flags & 0x02) /* O_CBREAK */
5437 + t.c_lflag &= (~ICANON);
5438 + if (sg.sg_flags & 0x08) /* O_ECHO */
5439 + t.c_lflag |= ECHO|ECHOE|ECHOK|ECHOCTL|ECHOKE|IEXTEN;
5440 + if (sg.sg_flags & 0x10) /* O_CRMOD */
5441 + t.c_oflag |= OPOST|ONLCR;
5442 + if (sg.sg_flags & 0x20) { /* O_RAW */
5444 + t.c_lflag &= ~(ISIG|ICANON);
5446 + if (sg.sg_flags & 0x200000) /* LITOUT */
5447 + t.c_oflag &= (~OPOST);
5448 + if (!(t.c_lflag & ICANON)) {
5450 + t.c_cc[VTIME] = 0;
5453 + old_fs = get_fs();
5455 + error = SYS(ioctl)(fd, TCSETS, &t);
5460 + case 17: { /* TIOCSETC */
5462 + mm_segment_t old_fs;
5464 + struct v7_tchars tc;
5466 + error = verify_area(VERIFY_READ, arg, sizeof(tc));
5469 + copy_from_user(&tc, arg, sizeof(tc));
5471 + old_fs = get_fs();
5473 + error = SYS(ioctl)(fd, TCGETS, &t);
5478 + t.c_cc[VINTR] = tc.t_intrc;
5479 + t.c_cc[VQUIT] = tc.t_quitc;
5480 + t.c_cc[VSTART] = tc.t_startc;
5481 + t.c_cc[VSTOP] = tc.t_stopc;
5482 + t.c_cc[VEOF] = tc.t_eofc;
5483 + t.c_cc[VEOL2] = tc.t_brkc;
5485 + old_fs = get_fs();
5487 + error = SYS(ioctl)(fd, TCSETS, &t);
5492 + case 18: { /* TIOCGETC */
5494 + mm_segment_t old_fs;
5496 + struct v7_tchars tc;
5498 + error = verify_area(VERIFY_WRITE, arg, sizeof(tc));
5502 + old_fs = get_fs();
5504 + error = SYS(ioctl)(fd, TCGETS, &t);
5509 + tc.t_intrc = t.c_cc[VINTR];
5510 + tc.t_quitc = t.c_cc[VQUIT];
5511 + tc.t_startc = t.c_cc[VSTART];
5512 + tc.t_stopc = t.c_cc[VSTOP];
5513 + tc.t_eofc = t.c_cc[VEOF];
5514 + tc.t_brkc = t.c_cc[VEOL2];
5516 + copy_to_user(arg, &tc, sizeof(tc));
5520 + case 116: { /* TIOCGLTC */
5522 + mm_segment_t old_fs;
5524 + struct v7_ltchars tc;
5526 + error = verify_area(VERIFY_WRITE, arg, sizeof(tc));
5530 + old_fs = get_fs();
5532 + error = SYS(ioctl)(fd, TCGETS, &t);
5537 + tc.t_suspc = t.c_cc[VSUSP];
5538 + tc.t_dsuspc = t.c_cc[VSUSP];
5539 + tc.t_rprntc = t.c_cc[VREPRINT];
5540 + tc.t_flushc = t.c_cc[VEOL2];
5541 + tc.t_werasc = t.c_cc[VWERASE];
5542 + tc.t_lnextc = t.c_cc[VLNEXT];
5544 + copy_to_user(arg, &tc, sizeof(tc));
5548 + case 117: { /* TIOCSLTC */
5550 + mm_segment_t old_fs;
5552 + struct v7_ltchars tc;
5554 + error = verify_area(VERIFY_READ, arg, sizeof(tc));
5557 + copy_from_user(&tc, arg, sizeof(tc));
5559 + old_fs = get_fs();
5561 + error = SYS(ioctl)(fd, TCGETS, &t);
5566 + t.c_cc[VSUSP] = tc.t_suspc;
5567 + t.c_cc[VEOL2] = tc.t_dsuspc;
5568 + t.c_cc[VREPRINT] = tc.t_rprntc;
5569 + t.c_cc[VEOL2] = tc.t_flushc;
5570 + t.c_cc[VWERASE] = tc.t_werasc;
5571 + t.c_cc[VLNEXT] = tc.t_lnextc;
5573 + old_fs = get_fs();
5575 + error = SYS(ioctl)(fd, TCSETS, &t);
5580 + case 13: /* TIOEXCL */
5581 + return SYS(ioctl)(fd, TIOCEXCL, arg);
5583 + case 14: /* TIOCNXCL */
5584 + return SYS(ioctl)(fd, TIOCNXCL, arg);
5586 + case 16: /* TIOCFLUSH */
5587 + return SYS(ioctl)(fd, TCFLSH, arg);
5589 + /* ISC (maybe SVR4 in general?) has some extensions over
5590 + * the sgtty stuff. So do later BSDs. Needless to say they
5591 + * both have different extensions.
5593 + case 20: /* TCSETPGRP (TIOC|20) set pgrp of tty */
5594 + return bsd_to_linux_termios(fd, TCSETS, arg);
5596 + case 21: /* TCGETPGRP (TIOC|21) get pgrp of tty */
5597 + return bsd_to_linux_termios(fd, TCSETSW, arg);
5599 + case 19: /* TIOCGETA */
5600 + return linux_to_bsd_termios(fd, TCGETS, arg);
5602 + case 22: /* TIOCSETAF */
5603 + return bsd_to_linux_termios(fd, TCSETSF, arg);
5605 + case 26: /* TIOCGETD */
5606 + return SYS(ioctl)(fd, TIOCGETD, arg);
5608 + case 27: /* TIOCSETD */
5609 + return SYS(ioctl)(fd, TIOCSETD, arg);
5611 + case 97: /* TIOCSCTTY */
5612 + return SYS(ioctl)(fd, TIOCSCTTY, arg);
5614 + case 103: /* TIOCSWINSZ */
5615 + return SYS(ioctl)(fd, TIOCSWINSZ, arg);
5617 + case 104: /* TIOCGWINSZ */
5618 + return SYS(ioctl)(fd, TIOCGWINSZ, arg);
5620 + case 113: /* TIOCNOTTY */
5621 + return SYS(ioctl)(fd, TIOCNOTTY, arg);
5623 + case 118: /* TIOCSPGRP */
5624 + return SYS(ioctl)(fd, TIOCSPGRP, arg);
5626 + case 119: /* TIOCGPGRP */
5627 + return SYS(ioctl)(fd, TIOCGPGRP, arg);
5629 + case 123: /* TIOCSBRK */
5630 + return SYS(ioctl)(fd, TCSBRK, arg);
5632 + case 124: /* TIOCLGET */
5633 + case 125: /* TIOCLSET */
5637 + case 3: /* TIOCMODG */
5638 + case 4: /* TIOCMODS */
5639 + case 94: /* TIOCDRAIN */
5640 + case 95: /* TIOCSIG */
5641 + case 96: /* TIOCEXT */
5642 + case 98: /* TIOCCONS */
5643 + case 102: /* TIOCUCNTL */
5644 + case 105: /* TIOCREMOTE */
5645 + case 106: /* TIOCMGET */
5646 + case 107: /* TIOCMBIC */
5647 + case 108: /* TIOCMBIS */
5648 + case 109: /* TIOCMSET */
5649 + case 110: /* TIOCSTART */
5650 + case 111: /* TIOCSTOP */
5651 + case 112: /* TIOCPKT */
5652 + case 114: /* TIOCSTI */
5653 + case 115: /* TIOCOUTQ */
5654 + case 120: /* TIOCCDTR */
5655 + case 121: /* TIOCSDTR */
5656 + case 122: /* TIOCCBRK */
5660 + printk(KERN_ERR "BSD/V7: terminal ioctl 0x%08lx unsupported\n",
5661 + (unsigned long)func);
5666 +EXPORT_SYMBOL(bsd_ioctl_termios);
5669 +int abi_ioctl_console(int fd, unsigned int func, void *arg) {
5671 + case 0x6301: /* CONS_CURRENT: Get display adapter type */
5672 + case 0x6302: /* CONS_GET: Get display mode setting */
5673 + /* Always error so the application never tries
5674 + * anything overly fancy on the console.
5677 + case 0x4304: /* _TTYDEVTYPE */
5678 + /* If on console then 1, if pseudo tty then 2 */
5681 + printk(KERN_ERR "iBCS: console ioctl %d unsupported\n", func);
5685 +EXPORT_SYMBOL(abi_ioctl_console);
5687 +int abi_ioctl_video(int fd, unsigned int func, void *arg) {
5689 + case 1: /* MAP_CLASS */
5690 + /* Get video memory map & IO privilege */
5691 + /* This doesn't agree with my SCO 3.2.4 ???? */
5692 + case 4: /* C_IOC */
5693 + /* see /etc/conf/pack.d/cn/class.h on any SCO unix box :-) */
5695 + printk(KERN_ERR "iBCS: video ioctl %d unsupported\n", func);
5699 +EXPORT_SYMBOL(abi_ioctl_video);
5700 diff -uNr --exclude-from=dontdiff linux-2.4.3/abi/common/map.c linux/abi/common/map.c
5701 --- linux-2.4.3/abi/common/map.c Thu Jan 1 01:00:00 1970
5702 +++ linux/abi/common/map.c Mon Mar 12 16:34:48 2001
5706 + * map.c - generic mapping routines for binary emulation
5708 + * Copyright (C) 1994 Mike Jagdis (jaggy@purplet.demon.co.uk)
5712 +#include <linux/module.h>
5714 +#include <linux/sched.h>
5715 +#include <linux/net.h>
5716 +#include <linux/socket.h>
5717 +#include <linux/signal.h>
5718 +#include <linux/errno.h>
5719 +#include <linux/personality.h>
5721 +#include <abi/socket.h>
5722 +#include <abi/map.h>
5725 +map_bitvec(unsigned long vec, long map[])
5727 + unsigned long newvec, m;
5731 + for (m=1,i=1; i<=32; m<<=1,i++)
5732 + if ((vec & m) && map[i] != -1)
5733 + newvec |= (1 << map[i]);
5738 +EXPORT_SYMBOL(map_bitvec);
5741 +map_sigvec_from_kernel(sigset_t vec, unsigned long map[])
5743 + unsigned long newvec;
5747 + for (i=1; i<=32; i++) {
5748 + if (sigismember(&vec, i) && map[i] != -1)
5749 + newvec |= (1 << map[i]);
5754 +EXPORT_SYMBOL(map_sigvec_from_kernel);
5757 +map_sigvec_to_kernel(unsigned long vec, unsigned long map[])
5763 + sigemptyset(&newvec);
5764 + for (m=1,i=1; i<=32; m<<=1,i++) {
5765 + if ((vec & m) && map[i] != -1)
5766 + sigaddset(&newvec, map[i]);
5771 +EXPORT_SYMBOL(map_sigvec_to_kernel);
5774 +map_value(struct map_segment *m, int val, int def) {
5775 + struct map_segment *seg;
5777 + /* If no mapping exists in this personality just return the
5778 + * number we were given.
5783 + /* Search the map looking for a mapping for the given number. */
5784 + for (seg=m; seg->start != -1; seg++) {
5785 + if (seg->start <= val && val <= seg->end) {
5786 + /* If the start and end are the same then this
5787 + * segment has one entry and the map is the value
5788 + * it maps to. Otherwise if we have a vector we
5789 + * pick out the relevant value, if we don't have
5790 + * a vector we give identity mapping.
5792 + if (seg->start == seg->end)
5793 + return (int)seg->map;
5795 + return (seg->map ? seg->map[val-seg->start] : val);
5799 + /* Number isn't mapped. Returned the requested default. */
5803 +EXPORT_SYMBOL(map_value);
5804 diff -uNr --exclude-from=dontdiff linux-2.4.3/abi/common/signal.c linux/abi/common/signal.c
5805 --- linux-2.4.3/abi/common/signal.c Thu Jan 1 01:00:00 1970
5806 +++ linux/abi/common/signal.c Mon Mar 12 16:34:48 2001
5810 + * signal.c - generic signal emulation code
5812 + * This module does not go through the normal processing routines for
5813 + * ibcs. The reason for this is that for most events, the return is a
5814 + * procedure address for the previous setting. This procedure address
5815 + * may be negative which is not an error. Therefore, the return processing
5816 + * for standard functions is skipped by declaring this routine as a "special"
5817 + * module for the decoder and dealing with the register settings directly.
5819 + * Please consider this closely if you plan on changing this mode.
5823 +#include <linux/config.h>
5824 +#include <linux/module.h>
5826 +#include <linux/errno.h>
5827 +#include <linux/sched.h>
5828 +#include <linux/kernel.h>
5829 +#include <linux/mm.h>
5830 +#include <linux/stddef.h>
5831 +#include <linux/unistd.h>
5832 +#include <linux/ptrace.h>
5833 +#include <linux/fcntl.h>
5834 +#include <linux/personality.h>
5835 +#include <linux/fs.h>
5836 +#include <linux/sys.h>
5837 +#include <linux/signal.h>
5839 +#include <asm/system.h>
5840 +#include <asm/uaccess.h>
5842 +#include <abi/abi.h>
5843 +#include <abi/xnx.h>
5844 +#include <abi/abi4.h>
5845 +#include <abi/map.h>
5847 +#define SIG_HOLD ((__sighandler_t)2) /* hold signal */
5849 +#include <abi/trace.h>
5850 +#include <abi/signal.h>
5853 +typedef void (*pfn) (void); /* Completion function */
5856 + * Parameters to the signal functions have a common stack frame. This
5857 + * defines the stack frame.
5860 +#define SIGNAL_NUMBER get_syscall_parameter (regs, 0)
5861 +#define HIDDEN_PARAM (SIGNAL_NUMBER & ~0xFF)
5862 +#define SECOND_PARAM get_syscall_parameter (regs, 1)
5864 +#define THIRD_PARAM get_syscall_parameter (regs, 2)
5865 +#else /* __sparc__ */
5866 +#define THIRD_PARAM ((unsigned long) regs->edx)
5867 +#endif /* __sparc__ */
5869 +/* Return a mask that includes SIG only. */
5870 +#define __sigmask(sig) (1 << ((sig) - 1))
5873 +#define TO_KERNEL(save) \
5874 + save = get_fs (); \
5875 + set_fs (get_ds ())
5877 +#define FROM_KERNEL(save) \
5880 +#define _S(nr) (1<<((nr)-1))
5882 +#define _BLOCKABLE (~(_S(IBCS_SIGKILL) | _S(IBCS_SIGSTOP)))
5885 +deactivate_signal(struct task_struct *task, int signum)
5887 + spin_lock_irq(&task->sigmask_lock);
5888 + sigdelset(&task->pending.signal, signum);
5889 + spin_unlock_irq(&task->sigmask_lock);
5893 +EXPORT_SYMBOL(deactivate_signal);
5896 + * Translate the signal number to the corresponding item for Linux.
5898 +static inline int abi_mapsig(int sig)
5900 + if ((unsigned int) sig >= NSIGNALS)
5902 + return current->exec_domain->signal_map[sig];
5906 +inline int abi_signo (struct pt_regs *regs, int *sig)
5908 + int value = abi_mapsig(SIGNAL_NUMBER & 0xFF);
5910 + if (value == -1) {
5911 + set_error (regs, iABI_errors (EINVAL));
5919 +EXPORT_SYMBOL(abi_signo);
5922 + * Process the signal() function from iBCS
5924 + * This version appeared in "Advanced Programming in the Unix Environment"
5925 + * by W. Richard Stevens, page 298.
5928 +void abi_sig_handler (struct pt_regs * regs, int sig,
5929 + __sighandler_t handler, int oneshot)
5931 + struct sigaction act, oact;
5933 + mm_segment_t old_fs;
5935 + sigemptyset (&act.sa_mask);
5936 + act.sa_restorer = NULL;
5937 + act.sa_handler = handler;
5941 + act.sa_flags = SA_ONESHOT | SA_NOMASK;
5945 + TO_KERNEL (old_fs);
5946 + answer = SYS(rt_sigaction) (sig, &act, &oact, sizeof(sigset_t));
5947 + FROM_KERNEL (old_fs);
5950 + set_error (regs, iABI_errors (-answer));
5952 + set_result (regs, (int) oact.sa_handler);
5955 +EXPORT_SYMBOL(abi_sig_handler);
5958 + * Process the signal() function from iBCS
5960 +int abi_signal (struct pt_regs * regs)
5962 + __sighandler_t vec;
5965 + if (abi_signo (regs, &sig)) {
5966 + vec = (__sighandler_t) SECOND_PARAM;
5967 + abi_sig_handler (regs, sig, vec, 1);
5972 +EXPORT_SYMBOL(abi_signal);
5975 + * Process the iBCS sigset function.
5977 + * This is basically the same as the signal() routine with the exception
5978 + * that it will accept a SIG_HOLD parameter.
5980 + * A SIG_HOLD will defer the processing of the signal until a sigrelse()
5981 + * function is called.
5983 +int abi_sigset (struct pt_regs * regs)
5985 + sigset_t newmask, oldmask;
5986 + __sighandler_t vec;
5988 + mm_segment_t old_fs;
5990 + if (abi_signo (regs, &sig)) {
5991 + vec = (__sighandler_t) SECOND_PARAM;
5992 + if (vec != SIG_HOLD) {
5993 + deactivate_signal(current, sig);
5994 + abi_sig_handler (regs, sig, vec, 0);
5997 + * Process the hold function
5999 + sigemptyset (&newmask);
6000 + sigaddset (&newmask, sig);
6002 + TO_KERNEL (old_fs);
6003 + answer = SYS(rt_sigprocmask) (SIG_BLOCK,
6004 + &newmask, &oldmask,
6005 + sizeof(sigset_t));
6006 + FROM_KERNEL (old_fs);
6009 + set_error (regs, iABI_errors (-answer));
6016 +EXPORT_SYMBOL(abi_sigset);
6019 + * Process the iBCS sighold function.
6021 + * Suspend the signal from future recognition.
6023 +void abi_sighold (struct pt_regs * regs)
6025 + sigset_t newmask, oldmask;
6027 + mm_segment_t old_fs;
6029 + if (!abi_signo (regs, &sig))
6032 + sigemptyset (&newmask);
6033 + sigaddset (&newmask, sig);
6035 + TO_KERNEL (old_fs);
6036 + answer = SYS(rt_sigprocmask) (SIG_BLOCK, &newmask, &oldmask,
6037 + sizeof(sigset_t));
6038 + FROM_KERNEL (old_fs);
6041 + set_error (regs, iABI_errors (-answer));
6045 +EXPORT_SYMBOL(abi_sighold);
6048 + * Process the iBCS sigrelse.
6050 + * Re-enable the signal processing from a previously suspended
6051 + * signal. This may have been done by calling the sighold() function
6052 + * or a longjmp() during the signal processing routine. If you do a
6053 + * longjmp() function then it is expected that you will call sigrelse
6054 + * before going on with the program.
6056 +void abi_sigrelse (struct pt_regs * regs)
6058 + sigset_t newmask, oldmask;
6060 + mm_segment_t old_fs;
6062 + if (!abi_signo (regs, &sig))
6065 + sigemptyset (&newmask);
6066 + sigaddset (&newmask, sig);
6068 + TO_KERNEL (old_fs);
6069 + answer = SYS(rt_sigprocmask) (SIG_UNBLOCK, &newmask, &oldmask,
6070 + sizeof(sigset_t));
6071 + FROM_KERNEL (old_fs);
6074 + set_error (regs, iABI_errors (-answer));
6078 +EXPORT_SYMBOL(abi_sigrelse);
6081 + * Process the iBCS sigignore
6083 + * This is basically a signal (...,SIG_IGN) call.
6086 +void abi_sigignore (struct pt_regs * regs)
6088 + struct sigaction act, oact;
6090 + mm_segment_t old_fs;
6092 + if (!abi_signo (regs, &sig))
6095 + sigemptyset (&act.sa_mask);
6097 + act.sa_restorer = NULL;
6098 + act.sa_handler = SIG_IGN;
6101 + TO_KERNEL (old_fs);
6102 + answer = SYS(rt_sigaction) (sig, &act, &oact, sizeof(sigset_t));
6103 + FROM_KERNEL (old_fs);
6106 + set_error (regs, iABI_errors (-answer));
6110 +EXPORT_SYMBOL(abi_sigignore);
6113 + * Process the iBCS sigpause
6115 + * Wait for the signal indicated to arrive before resuming the
6116 + * processing. I do not know if the signal is processed first using
6117 + * the normal event processing before the return. If someone can
6118 + * shed some light on this then please correct this code. I block
6119 + * the signal and look for it to show up in the pending list.
6122 +void abi_sigpause (struct pt_regs * regs)
6124 + old_sigset_t newset;
6128 + printk(KERN_ERR "Sparc/iBCS: sigpause not yet implemented\n");
6130 + if (!abi_signo(regs, &sig))
6134 + newset &= (1UL << (sig-1));
6135 + answer = SYS(sigsuspend)(0, current->blocked,
6136 + newset, regs->esi, regs->edi,
6137 + regs->ebp, regs->eax,
6138 + regs->xds, regs->xes,
6140 + regs->eip, regs->xcs, regs->eflags,
6141 + regs->esp, regs->xss);
6144 + set_error(regs, iABI_errors(-answer));
6149 +EXPORT_SYMBOL(abi_sigpause);
6152 + * This is the service routine for the syscall #48 (signal funcs).
6154 + * Examine the request code and branch on the request to the appropriate
6158 +int abi_sigfunc (struct pt_regs * regs)
6160 + int sig_type = (int) HIDDEN_PARAM;
6162 + abi_trace(ABI_TRACE_SIGNAL|ABI_TRACE_SIGNAL_F, "sig%s(%ld, 0x%08lx, 0x%08lx)",
6163 + sig_type == 0 ? "nal"
6164 + : (sig_type == 0x100 ? "set"
6165 + : (sig_type == 0x200 ? "hold"
6166 + : (sig_type == 0x400 ? "relse"
6167 + : (sig_type == 0x800 ? "ignore"
6168 + : (sig_type == 0x1000 ? "pause"
6170 + SIGNAL_NUMBER & 0xff, SECOND_PARAM, THIRD_PARAM);
6173 + set_result (regs, 0);
6174 +#else /* __sparc__ */
6175 + regs->eflags &= ~1;
6177 +#endif /* __sparc__ */
6178 + switch (sig_type) {
6180 + abi_signal (regs);
6184 + abi_sigset (regs);
6188 + abi_sighold (regs);
6192 + abi_sigrelse (regs);
6196 + abi_sigignore (regs);
6200 + abi_sigpause (regs);
6204 + set_error (regs, EINVAL);
6206 + abi_trace(ABI_TRACE_SIGNAL|ABI_TRACE_SIGNAL_F,
6207 + "sigfunc(%x, %ld, %lx, %lx) unsupported",
6209 + SIGNAL_NUMBER, SECOND_PARAM, THIRD_PARAM);
6214 + abi_trace(ABI_TRACE_SIGNAL|ABI_TRACE_SIGNAL_F,
6215 + "returns %ld", get_result (regs));
6219 +EXPORT_SYMBOL(abi_sigfunc);
6222 +/* This function is used to handle the sigaction call from SVr4 binaries.
6223 + If anyone else uses this, this function needs to be modified since the
6224 + order and size of the ibcs_sigaction structure is different in ibcs
6225 + and the SVr4 ABI */
6228 +asmlinkage int abi_sigaction(int abi_signum, const struct abi_sigaction * action,
6229 + struct abi_sigaction * oldaction)
6231 + struct abi_sigaction new_sa, old_sa;
6233 + mm_segment_t old_fs;
6234 + struct sigaction nsa, osa;
6236 + signo = abi_mapsig(abi_signum);
6241 + error = verify_area(VERIFY_WRITE, oldaction,
6242 + sizeof(struct abi_sigaction));
6248 + error = copy_from_user(&new_sa, action,
6249 + sizeof(struct abi_sigaction));
6252 + nsa.sa_restorer = NULL;
6253 + nsa.sa_handler = new_sa.sa_handler;
6254 + nsa.sa_mask = map_sigvec_to_kernel(new_sa.sa_mask,
6255 + current->exec_domain->signal_map);
6256 + if(new_sa.sa_flags & ABI_SA_ONSTACK)
6257 + nsa.sa_flags |= SA_ONSTACK;
6258 + if(new_sa.sa_flags & ABI_SA_RESTART)
6259 + nsa.sa_flags |= SA_RESTART;
6260 + if(new_sa.sa_flags & ABI_SA_NODEFER)
6261 + nsa.sa_flags |= SA_NODEFER;
6262 + if(new_sa.sa_flags & ABI_SA_RESETHAND)
6263 + nsa.sa_flags |= SA_RESETHAND;
6264 + if(new_sa.sa_flags & ABI_SA_NOCLDSTOP)
6265 + nsa.sa_flags |= SA_NOCLDSTOP;
6266 + if(new_sa.sa_flags & ABI_SA_NOCLDWAIT)
6267 + nsa.sa_flags |= SA_NOCLDWAIT;
6270 + old_fs = get_fs();
6272 + error = SYS(rt_sigaction)(signo,
6273 + action ? &nsa : NULL,
6274 + oldaction ? &osa : NULL,
6275 + sizeof(sigset_t));
6278 + if (!error && oldaction) {
6279 + old_sa.sa_handler = osa.sa_handler;
6280 + old_sa.sa_mask = map_sigvec_from_kernel(osa.sa_mask,
6281 + current->exec_domain->signal_invmap);
6282 + old_sa.sa_flags = 0;
6283 + if(osa.sa_flags & SA_ONSTACK)
6284 + old_sa.sa_flags |= ABI_SA_ONSTACK;
6285 + if(osa.sa_flags & SA_RESTART)
6286 + old_sa.sa_flags |= ABI_SA_RESTART;
6287 + if(osa.sa_flags & SA_NODEFER)
6288 + old_sa.sa_flags |= ABI_SA_NODEFER;
6289 + if(osa.sa_flags & SA_RESETHAND)
6290 + old_sa.sa_flags |= ABI_SA_RESETHAND;
6291 + if(osa.sa_flags & SA_NOCLDSTOP)
6292 + old_sa.sa_flags |= ABI_SA_NOCLDSTOP;
6293 + if(osa.sa_flags & SA_NOCLDWAIT)
6294 + old_sa.sa_flags |= ABI_SA_NOCLDWAIT;
6295 + /* This should never fail... */
6296 + copy_to_user(oldaction, &old_sa, sizeof(struct abi_sigaction));
6301 +EXPORT_SYMBOL(abi_sigaction);
6304 +static short int howcnv[] = {SIG_SETMASK, SIG_BLOCK, SIG_UNBLOCK, SIG_SETMASK};
6307 +abi_sigprocmask(int how, unsigned long *abinset, unsigned long *abioset)
6309 + sigset_t new_set, *nset, old_set, *oset;
6310 + unsigned long new_set_abi, old_set_abi;
6311 + mm_segment_t old_fs;
6314 + nset = oset = NULL;
6317 + get_user(new_set_abi, abinset);
6318 + new_set = map_sigvec_to_kernel(new_set_abi,
6319 + current->exec_domain->signal_map);
6325 + old_fs = get_fs();
6327 + error = SYS(rt_sigprocmask)(howcnv[how], nset, oset, sizeof(sigset_t));
6330 + if (!error && abioset) {
6331 + old_set_abi = map_sigvec_from_kernel(old_set,
6332 + current->exec_domain->signal_invmap);
6333 + put_user(old_set_abi, abioset);
6340 +EXPORT_SYMBOL(abi_sigprocmask);
6343 +int abi_sigsuspend(struct pt_regs * regs)
6345 + unsigned long * set;
6346 + unsigned long oldset;
6347 + old_sigset_t newset;
6350 + if (personality(PER_BSD)) {
6351 + oldset = get_syscall_parameter (regs, 0);
6354 + set = (unsigned long *)get_syscall_parameter (regs, 0);
6355 + error = get_user(oldset, set);
6359 + newset = map_bitvec(oldset,
6360 + current->exec_domain->signal_map);
6362 + abi_trace(ABI_TRACE_SIGNAL,
6363 + "sigsuspend oldset, newset = %lx %lx", oldset, newset);
6366 + extern do_sigpause(unsigned int, struct pt_regs *);
6367 + return do_sigpause(newset, regs);
6370 + return SYS(sigsuspend)(0, oldset,
6371 + newset, regs->esi, regs->edi,
6372 + regs->ebp, regs->eax,
6373 + regs->xds, regs->xes,
6375 + regs->eip, regs->xcs, regs->eflags,
6376 + regs->esp, regs->xss);
6379 +EXPORT_SYMBOL(abi_sigsuspend);
6380 +#endif /* __sparc__ */
6381 diff -uNr --exclude-from=dontdiff linux-2.4.3/abi/common/socket.c linux/abi/common/socket.c
6382 --- linux-2.4.3/abi/common/socket.c Thu Jan 1 01:00:00 1970
6383 +++ linux/abi/common/socket.c Mon Mar 12 16:34:48 2001
6387 + * socket.c - generic emulated socket code
6389 + * Copyright (C) 1994, 1996 Mike Jagdis (jaggy@purplet.demon.co.uk)
6393 +#include <linux/config.h>
6394 +#include <linux/module.h>
6396 +#include <asm/uaccess.h>
6398 +#include <linux/types.h>
6399 +#include <linux/fs.h>
6400 +#include <linux/mm.h>
6401 +#include <linux/ptrace.h>
6402 +#include <linux/net.h>
6403 +#include <linux/socket.h>
6404 +#include <linux/sys.h>
6406 +#include <abi/abi.h>
6407 +#include <abi/socket.h>
6408 +#include <abi/map.h>
6409 +#include <abi/trace.h>
6413 +abi_do_setsockopt(unsigned long *sp)
6416 + int level, optname;
6418 + error = verify_area(VERIFY_READ,
6419 + ((unsigned long *)sp),
6424 + get_user(level, ((unsigned long *)sp)+1);
6425 + get_user(optname, ((unsigned long *)sp)+2);
6427 + if (abi_traced(ABI_TRACE_STREAMS|ABI_TRACE_SOCKSYS)) {
6428 + u_long optval, optlen;
6430 + get_user(optval, ((u_long *)sp) + 3);
6431 + get_user(optlen, ((u_long *)sp) + 4);
6432 + __abi_trace("setsockopt level=%d, optname=%d, "
6433 + "optval=0x%08lx, optlen=0x%08lx\n",
6434 + level, optname, optval, optlen);
6438 + case 0: /* IPPROTO_IP aka SOL_IP */
6439 + /* This is correct for the SCO family. Hopefully
6440 + * it is correct for other SYSV...
6445 + if (optname > 4) {
6447 + if (optname <= 33)
6449 + if (optname < 32 || optname > 36)
6452 + put_user(optname, ((unsigned long *)sp)+2);
6456 + put_user(SOL_SOCKET, ((unsigned long *)sp)+1);
6457 + optname = map_value(current->exec_domain->sockopt_map, optname, 0);
6458 + put_user(optname, ((unsigned long *)sp)+2);
6460 + switch (optname) {
6462 + unsigned long optlen;
6464 + /* SO_LINGER takes a struct linger
6465 + * as the argument but some code
6466 + * uses an int and expects to get
6467 + * away without an error. Sigh...
6469 + get_user(optlen, ((unsigned long *)sp)+4);
6470 + if (optlen == sizeof(int))
6475 + /* The following are not currently implemented
6476 + * under Linux so we must fake them in
6477 + * reasonable ways. (Only SO_PROTOTYPE is
6478 + * documented in SCO's man page).
6480 + case SO_PROTOTYPE:
6484 + return -ENOPROTOOPT;
6486 + case SO_USELOOPBACK:
6491 + /* The following are not currenty implemented
6492 + * under Linux and probably aren't settable
6495 + case SO_IMASOCKET:
6496 + return -ENOPROTOOPT;
6500 + /* FIXME: We assume everything else uses the
6501 + * same level and option numbers. This is true
6502 + * for IPPROTO_TCP(/SOL_TCP) and TCP_NDELAY
6503 + * but is known to be incorrect for other
6504 + * potential options :-(.
6509 + return SYS(socketcall)(SYS_SETSOCKOPT, sp);
6512 +EXPORT_SYMBOL(abi_do_setsockopt);
6515 +abi_do_getsockopt(unsigned long *sp)
6518 + int level, optname;
6522 + error = verify_area(VERIFY_READ,
6523 + ((unsigned long *)sp),
6528 + get_user((unsigned long) level, ((unsigned long *)sp)+1);
6529 + get_user((unsigned long) optname, ((unsigned long *)sp)+2);
6530 + get_user((unsigned long) optval, ((unsigned long *)sp)+3);
6531 + get_user((unsigned long) optlen, ((unsigned long *)sp)+4);
6533 + if (abi_traced(ABI_TRACE_STREAMS|ABI_TRACE_SOCKSYS)) {
6536 + get_user(l, optlen);
6537 + __abi_trace("getsockopt level=%d, optname=%d, optval=0x%08lx, "
6538 + "optlen=0x%08lx[%ld]\n", level, optname,
6539 + (u_long)optval, (u_long)optlen, l);
6543 + case 0: /* IPPROTO_IP aka SOL_IP */
6544 + /* This is correct for the SCO family. Hopefully
6545 + * it is correct for other SYSV...
6550 + if (optname > 4) {
6552 + if (optname <= 33)
6554 + if (optname < 32 || optname > 36)
6557 + put_user(optname, ((unsigned long *)sp)+2);
6561 + put_user(SOL_SOCKET, ((unsigned long *)sp)+1);
6562 + optname = map_value(current->exec_domain->sockopt_map, optname, 0);
6563 + put_user(optname, ((unsigned long *)sp)+2);
6565 + switch (optname) {
6569 + /* SO_LINGER takes a struct linger
6570 + * as the argument but some code
6571 + * uses an int and expects to get
6572 + * away without an error. Sigh...
6574 + get_user(l, optlen);
6575 + if (l == sizeof(int)) {
6576 + put_user(0, (long *)optval);
6582 + /* The following are not currently implemented
6583 + * under Linux so we must fake them in
6584 + * reasonable ways. (Only SO_PROTOTYPE is
6585 + * documented in SCO's man page).
6587 + case SO_PROTOTYPE: {
6588 + unsigned long len;
6589 + error = get_user(len, optlen);
6592 + if (len < sizeof(long))
6595 + error = verify_area(VERIFY_WRITE,
6599 + put_user(0, (long *)optval);
6600 + put_user(sizeof(long),
6609 + return -ENOPROTOOPT;
6611 + case SO_USELOOPBACK:
6614 + case SO_IMASOCKET: {
6615 + unsigned long len;
6616 + error = get_user(len, optlen);
6619 + if (len < sizeof(long))
6622 + error = verify_area(VERIFY_WRITE,
6626 + put_user(1, (long *)optval);
6627 + put_user(sizeof(long),
6635 + /* FIXME: We assume everything else uses the
6636 + * same level and option numbers. This is true
6637 + * for IPPROTO_TCP(/SOL_TCP) and TCP_NDELAY
6638 + * but is known to be incorrect for other
6639 + * potential options :-(.
6644 + return SYS(socketcall)(SYS_GETSOCKOPT, sp);
6647 +EXPORT_SYMBOL(abi_do_getsockopt);
6648 diff -uNr --exclude-from=dontdiff linux-2.4.3/abi/common/socksys.c linux/abi/common/socksys.c
6649 --- linux-2.4.3/abi/common/socksys.c Thu Jan 1 01:00:00 1970
6650 +++ linux/abi/common/socksys.c Sun Mar 18 18:45:12 2001
6653 + * socksys.c - svr4 /dev/socksys emulation
6655 + * Copyright 1994-1996 Mike Jagdis (jaggy@purplet.demon.co.uk)
6658 +#include <linux/config.h>
6659 +#include <linux/module.h>
6661 +#include <linux/types.h>
6662 +#include <linux/errno.h>
6663 +#include <linux/fs.h>
6664 +#include <linux/fcntl.h>
6665 +#include <linux/major.h>
6666 +#include <linux/kernel.h>
6667 +#include <linux/in.h>
6668 +#include <linux/net.h>
6669 +#include <linux/sched.h>
6670 +#include <linux/signal.h>
6671 +#include <linux/socket.h>
6672 +#include <net/sock.h>
6673 +#include <linux/slab.h>
6674 +#include <linux/mm.h>
6675 +#include <linux/un.h>
6676 +#include <linux/utsname.h>
6677 +#include <linux/time.h>
6678 +#include <linux/termios.h>
6679 +#include <linux/sys.h>
6680 +#include <linux/file.h>
6681 +#include <linux/poll.h>
6682 +#include <linux/capability.h>
6683 +#include <linux/init.h>
6686 +#include <asm/uaccess.h>
6688 +#include <abi/abi.h>
6689 +#include <abi/map.h>
6690 +#include <abi/trace.h>
6691 +#include <abi/socksys.h>
6692 +#include <abi/tli.h>
6695 +static int socksys_read(struct file *filep,
6696 + char *buf, size_t count, loff_t *offset);
6697 +static int socksys_write(struct file *filep,
6698 + const char *buf, size_t count, loff_t *offset);
6699 +static int socksys_open(struct inode *ino, struct file *filep);
6700 +static int socksys_close(struct inode *ino, struct file *filep);
6701 +static unsigned int socksys_poll(struct file *filep, struct poll_table_struct *wait);
6705 + * socksys_fops defines the file operations that can be applied to the
6706 + * /dev/socksys device.
6708 +static struct file_operations socksys_fops = {
6709 + owner: THIS_MODULE,
6710 + read: socksys_read,
6711 + write: socksys_write,
6712 + open: socksys_open,
6713 + release: socksys_close,
6716 +/* socksys_socket_fops defines the file operations that can be applied to
6717 + * sockets themselves. This gets initialised when the first socket is
6720 +static struct file_operations socksys_socket_fops = {
6724 +static int (*sock_close)(struct inode *inode, struct file *file);
6725 +static unsigned int (*sock_poll)(struct file *filep, struct poll_table_struct *wait);
6729 +inherit_socksys_funcs(unsigned int fd, int state)
6731 +#ifdef CONFIG_ABI_XTI
6732 + struct T_private *priv;
6734 + struct inode *ino;
6735 + struct file *filep = fget(fd);
6739 + ino = filep->f_dentry->d_inode;
6741 +#ifdef SO_BSDCOMPAT
6742 + /* SYSV sockets are BSD like with respect to ICMP errors
6743 + * with UDP rather than RFC conforming. I think.
6745 + ino->u.socket_i.sk->bsdism = 1;
6748 +#ifdef CONFIG_ABI_XTI
6749 + priv = (struct T_private *)kmalloc(sizeof(struct T_private), GFP_KERNEL);
6751 + priv->magic = XTI_MAGIC;
6752 + priv->state = state;
6754 + priv->pfirst = priv->plast = NULL;
6756 + filep->private_data = priv;
6759 + /* If our file operations don't appear to match
6760 + * what the socket system is advertising it may
6761 + * be because we haven't initialised ours at all
6762 + * yet or it may be because the old socket system
6763 + * module was unloaded and reloaded. This isn't
6764 + * entirely safe because we may still have open
6765 + * sockets which *should* use the old routines
6766 + * until they close - tough, for now.
6768 + if (socksys_socket_fops.read != filep->f_op->read) {
6769 + memcpy(&socksys_socket_fops,
6771 + sizeof(struct file_operations));
6772 + sock_close = socksys_socket_fops.release;
6773 + sock_poll = socksys_socket_fops.poll;
6774 + socksys_socket_fops.release = socksys_close;
6775 + socksys_socket_fops.poll = socksys_poll;
6777 + filep->f_op = &socksys_socket_fops;
6779 + ino->i_mode = 0020000; /* S_IFCHR */
6780 + ino->i_rdev = MKDEV(SOCKSYS_MAJOR, 0);
6783 + // MOD_INC_USE_COUNT;
6786 +EXPORT_SYMBOL(inherit_socksys_funcs);
6789 +spx_connect(unsigned int fd, int spxnum)
6791 + int newfd, err, args[3];
6792 + struct sockaddr_un addr = {
6793 + AF_UNIX, "/tmp/.X11-unix/X0"
6795 + mm_segment_t old_fs = get_fs();
6797 + abi_trace(ABI_TRACE_SOCKSYS,
6798 + "SPX: %u choose service %d", fd, spxnum);
6800 + /* Rather than use an explicit path to the X :0 server
6801 + * socket we should use the given number to look up a path
6802 + * name to use (we can't rely on servers registering their
6803 + * sockets either - for one thing we don't emulate that yet
6804 + * and for another thing different OS binaries do things in
6805 + * different ways but all must interoperate).
6806 + * I suggest putting the mapping in, say, /dev/spx.map/%d
6807 + * where each file is a symlink containing the path of the
6808 + * socket to use. Then we can just do a readlink() here to
6809 + * get the pathname.
6810 + * Hey, this is what we do here now!
6812 + addr.sun_family = AF_UNIX;
6813 + sprintf(addr.sun_path, "/dev/spx.map/%u", spxnum);
6815 + err = SYS(readlink)(addr.sun_path, addr.sun_path,
6816 + sizeof(addr.sun_path)-1);
6818 + if (err == -ENOENT) {
6820 + abi_trace(ABI_TRACE_SOCKSYS,
6821 + "SPX: %u no symlink \"%s\", try X :0",
6822 + fd, addr.sun_path);
6823 + strcpy(addr.sun_path, "/tmp/.X11-unix/X0");
6827 + addr.sun_path[err] = '\0';
6830 + abi_trace(ABI_TRACE_SOCKSYS, "SPX: %u get a Unix domain socket", fd);
6832 + args[0] = AF_UNIX;
6833 + args[1] = SOCK_STREAM;
6836 + newfd = SYS(socketcall)(SYS_SOCKET, args);
6841 + abi_trace(ABI_TRACE_SOCKSYS, "SPX: %u connect to \"%s\"",
6842 + fd, addr.sun_path);
6845 + args[1] = (int)&addr;
6846 + args[2] = sizeof(struct sockaddr_un);
6848 + err = SYS(socketcall)(SYS_CONNECT, args);
6851 + SYS(close)(newfd);
6859 +abi_socksys_fd_init(int fd, int rw, const char *buf, int *count)
6861 + struct file *filep;
6862 + struct inode *ino;
6863 + int error, sockfd;
6865 + /* FIXME: we are always holding the filep when we get here
6866 + * anyway so we could just use fcheck here...
6871 + ino = filep->f_dentry->d_inode;
6873 + abi_trace(ABI_TRACE_SOCKSYS, "socksys: fd=%d initializing", fd);
6875 + /* Minor = 0 is the socksys device itself. No special handling
6876 + * will be needed as it is controlled by the application
6879 + if (MINOR(ino->i_rdev) == 0) {
6884 + /* Minor = 1 is the spx device. This is the client side of a
6885 + * streams pipe to the X server. Under SCO and friends
6886 + * the library code messes around setting the connection
6887 + * up itself. We do it ourselves - this means we don't
6888 + * need to worry about the implementation of the server
6889 + * side (/dev/X0R - which must exist but can be a link
6890 + * to /dev/null) nor do we need to actually implement
6893 + if (MINOR(ino->i_rdev) == 1) {
6898 + /* It seems early spx implementations were just a
6899 + * quick hack to get X to work. They only supported
6900 + * one destination and connected automatically.
6901 + * Later versions take a single byte write, the
6902 + * value of the byte telling them which destination
6903 + * to connect to. Hence this quick hack to work
6904 + * with both. If the first write is a single byte
6905 + * it's a connect request otherwise we auto-connect
6906 + * to destination 1.
6908 + if (rw == 1 && *count == 1) {
6909 + error = get_user(unit, buf);
6915 + sockfd = spx_connect(fd, unit);
6921 + * Otherwise the high 4 bits specify the address/protocol
6922 + * family (AF_INET, AF_UNIX etc.) and the low 4 bits determine
6923 + * the protocol (IPPROTO_IP, IPPROTO_UDP, IPPROTO_TCP etc.)
6924 + * although not using a one-to-one mapping as the minor number
6925 + * is not big enough to hold everything directly. The socket
6926 + * type is inferrred from the protocol.
6930 + mm_segment_t old_fs = get_fs();
6932 + /* Grab a socket. */
6934 + abi_trace(ABI_TRACE_SOCKSYS,
6935 + "XTI: %d get socket for transport end"
6936 + " point (dev = 0x%04x)",
6939 + switch ((args[0] = ((MINOR(ino->i_rdev) >> 4) & 0x0f))) {
6941 + args[1] = SOCK_STREAM;
6947 + IPPROTO_ICMP, IPPROTO_ICMP,
6948 + IPPROTO_IGMP, IPPROTO_IPIP,
6949 + IPPROTO_TCP, IPPROTO_EGP,
6950 + IPPROTO_PUP, IPPROTO_UDP,
6951 + IPPROTO_IDP, IPPROTO_RAW,
6954 + SOCK_RAW, SOCK_RAW,
6955 + SOCK_RAW, SOCK_RAW,
6956 + SOCK_STREAM, SOCK_RAW,
6957 + SOCK_RAW, SOCK_DGRAM,
6958 + SOCK_RAW, SOCK_RAW,
6960 + int i = MINOR(ino->i_rdev) & 0x0f;
6961 + args[2] = prot[i];
6962 + args[1] = type[i];
6967 + args[1] = SOCK_RAW;
6973 + abi_trace(ABI_TRACE_SOCKSYS,
6974 + "XTI: %d socket %d %d %d",
6975 + fd, args[0], args[1], args[2]);
6978 + sockfd = SYS(socketcall)(SYS_SOCKET, args);
6984 + /* Redirect operations on the socket fd via our emulation
6985 + * handlers then swap the socket fd and the original fd,
6986 + * discarding the original fd.
6988 + inherit_socksys_funcs(sockfd, TS_UNBND);
6990 + abi_trace(ABI_TRACE_SOCKSYS, "XTI: %d -> %d", fd, sockfd);
6992 + SYS(dup2)(sockfd, fd);
6993 + SYS(close)(sockfd);
6996 +EXPORT_SYMBOL(abi_socksys_fd_init);
7000 +socksys_read(struct file *filep, char *buf, size_t count, loff_t *offset)
7002 + struct inode *ino = filep->f_dentry->d_inode;
7004 + /* FIXME: this condition *must* be true - if we have already
7005 + * replaced this with a socket we have changed the file ops
7008 + if (ino && !ino->i_sock) {
7010 + for (fd = 0; fd < current->files->max_fdset; fd++) {
7011 + if (fcheck(fd) == filep) {
7013 + error = abi_socksys_fd_init(fd, 0, NULL, NULL);
7017 + return filep->f_op->read(filep, buf,
7020 + return error ? error : -EINVAL;
7029 +socksys_write(struct file *filep, const char *buf, size_t count, loff_t *offset)
7031 + struct inode *ino = filep->f_dentry->d_inode;
7033 + /* FIXME: this condition *must* be true - if we have already
7034 + * replaced this with a socket we have changed the file ops
7037 + if (ino && !ino->i_sock) {
7039 + for (fd = 0; fd < current->files->max_fdset; fd++) {
7040 + if (fcheck(fd) == filep) {
7042 + error = abi_socksys_fd_init(fd, 1, buf, &count);
7047 + ? filep->f_op->write(filep, buf,
7051 + return error ? error : -EINVAL;
7060 +socksys_syscall(int *sp)
7064 + error = get_user(cmd, sp);
7069 + if (abi_traced(ABI_TRACE_SOCKSYS)) {
7070 + u_long a0, a1, a2, a3, a4, a5;
7071 + static const char * const cmd_map[] = {
7072 + "", "accept", "bind", "connect", "getpeername",
7073 + "getsockname", "getsockopt", "listen", "recv",
7074 + "recvfrom", "send", "sendto", "setsockopt", "shutdown",
7075 + "socket", "select", "getipdomain", "setipdomain",
7076 + "adjtime", "setreuid", "setregid", "gettimeofday",
7077 + "settimeofday", "getitimer", "setitimer",
7078 + "recvmsg", "sendmsg", "sockpair"
7081 + get_user(a0, sp+0);
7082 + get_user(a1, sp+1);
7083 + get_user(a2, sp+2);
7084 + get_user(a3, sp+3);
7085 + get_user(a4, sp+4);
7086 + get_user(a5, sp+5);
7088 + __abi_trace("socksys: %s (%d) "
7089 + "<0x%lx,0x%lx,0x%lx,0x%lx,0x%lx,0x%lx>",
7091 + cmd < sizeof(cmd_map) / sizeof(cmd_map[0]))
7092 + ? cmd_map[cmd] : "???", cmd,
7093 + a0, a1, a2, a3, a4, a5);
7097 + case SSYS_SO_SOCKET: {
7098 + /* Get a socket but replace the socket file
7099 + * operations with our own so we can do the
7100 + * right thing for ioctls.
7105 + get_user(x, ((unsigned long *)sp)+0);
7106 + put_user(map_value(current->exec_domain->af_map, x, 0),
7107 + ((unsigned long *)sp)+0);
7108 + get_user(x, ((unsigned long *)sp)+1);
7109 + put_user(map_value(current->exec_domain->socktype_map, x, 0),
7110 + ((unsigned long *)sp)+1);
7112 + if ((fd = SYS(socketcall)(SYS_SOCKET, sp)) < 0)
7115 + inherit_socksys_funcs(fd, TS_UNBND);
7119 + case SSYS_SO_ACCEPT: {
7122 + if ((fd = SYS(socketcall)(SYS_ACCEPT, sp)) < 0)
7125 + inherit_socksys_funcs(fd, TS_DATA_XFER);
7128 + case SSYS_SO_BIND:
7129 + return SYS(socketcall)(SYS_BIND, sp);
7130 + case SSYS_SO_CONNECT:
7131 + return SYS(socketcall)(SYS_CONNECT, sp);
7132 + case SSYS_SO_GETPEERNAME:
7133 + return SYS(socketcall)(SYS_GETPEERNAME, sp);
7134 + case SSYS_SO_GETSOCKNAME:
7135 + return SYS(socketcall)(SYS_GETSOCKNAME, sp);
7136 + case SSYS_SO_GETSOCKOPT:
7137 + return abi_do_getsockopt((unsigned long *)sp);
7138 + case SSYS_SO_LISTEN:
7139 + return SYS(socketcall)(SYS_LISTEN, sp);
7140 + case SSYS_SO_RECV: {
7141 + int err = SYS(socketcall)(SYS_RECV, sp);
7142 + if (err == -EAGAIN) err = -EWOULDBLOCK;
7145 + case SSYS_SO_RECVFROM: {
7146 + int err = SYS(socketcall)(SYS_RECVFROM, sp);
7147 + if (err == -EAGAIN) err = -EWOULDBLOCK;
7150 + case SSYS_SO_SEND: {
7151 + int err = SYS(socketcall)(SYS_SEND, sp);
7152 + if (err == -EAGAIN) err = -EWOULDBLOCK;
7155 + case SSYS_SO_SENDTO: {
7156 + int err = SYS(socketcall)(SYS_SENDTO, sp);
7157 + if (err == -EAGAIN) err = -EWOULDBLOCK;
7160 + case SSYS_SO_SETSOCKOPT:
7161 + return abi_do_setsockopt((unsigned long *)sp);
7162 + case SSYS_SO_SHUTDOWN:
7163 + return SYS(socketcall)(SYS_SHUTDOWN, sp);
7165 + case SSYS_SO_GETIPDOMAIN: {
7169 + error = get_user((unsigned long) name, (char *)(sp+0));
7171 + get_user(len, sp+1);
7173 + down_read(&uts_sem);
7174 + error = verify_area(VERIFY_WRITE, name, len);
7177 + for (p=system_utsname.nodename; *p && *p != '.'; p++);
7181 + p = system_utsname.domainname;
7182 + if (strcmp(p, "(none)"))
7183 + for (;*p && len > 0; p++,len--) {
7184 + __put_user(*p, name);
7187 + __put_user('\0', name);
7189 + up_read(&uts_sem);
7193 + case SSYS_SO_SETIPDOMAIN: {
7194 + int error, len, togo;
7197 + if (!capable(CAP_SYS_ADMIN))
7200 + error = get_user((unsigned long) name, (char *)(sp+0));
7202 + error = get_user(len, sp+1);
7206 + down_write(&uts_sem);
7207 + togo = __NEW_UTS_LEN;
7208 + for (p=system_utsname.nodename; *p && *p != '.'; p++,togo--);
7213 + if (len <= togo) {
7214 + while (len-- > 0) {
7215 + get_user(*p, name);
7222 + up_write(&uts_sem);
7226 + case SSYS_SO_SETREUID:
7227 + case SSYS_SO_SETREGID: {
7231 + error = get_user(ruid, sp+0);
7233 + error = get_user(euid, sp+1);
7236 + return (cmd == SSYS_SO_SETREUID)
7237 + ? SYS(setreuid)(ruid, euid)
7238 + : SYS(setregid)(ruid, euid);
7241 + case SSYS_SO_GETTIME:
7242 + case SSYS_SO_SETTIME: {
7244 + struct timeval *tv;
7245 + struct timezone *tz;
7247 + error = get_user((unsigned long) tv, sp+0);
7249 + error = get_user((unsigned long) tz, sp+1);
7252 + return (cmd == SSYS_SO_GETTIME)
7253 + ? SYS(gettimeofday)(tv, tz)
7254 + : SYS(settimeofday)(tv, tz);
7257 + case SSYS_SO_GETITIMER: {
7259 + struct itimerval *value;
7261 + error = get_user((unsigned long) which, sp+0);
7263 + error = get_user((unsigned long) value, sp+1);
7266 + return SYS(getitimer)(which, value);
7268 + case SSYS_SO_SETITIMER: {
7270 + struct itimerval *value, *ovalue;
7272 + error = get_user((unsigned long) which, sp+0);
7274 + error = get_user((unsigned long) value, sp+1);
7276 + error = get_user((unsigned long) ovalue, sp+2);
7279 + return SYS(setitimer)(which, value, ovalue);
7282 + case SSYS_SO_SELECT:
7283 + /* This may be wrong? I don't know how to trigger
7284 + * this case. Select seems to go via the Xenix
7285 + * select entry point.
7287 + return SYS(select)(sp);
7289 + case SSYS_SO_ADJTIME:
7292 + /* These appear in SCO 3.2v5. I assume that the format of
7293 + * a msghdr is identical with Linux. I have not checked.
7295 + case SSYS_SO_RECVMSG: {
7296 + int err = SYS(socketcall)(SYS_RECVMSG, sp);
7297 + if (err == -EAGAIN) err = -EWOULDBLOCK;
7300 + case SSYS_SO_SENDMSG: {
7301 + int err = SYS(socketcall)(SYS_SENDMSG, sp);
7302 + if (err == -EAGAIN) err = -EWOULDBLOCK;
7306 + case SSYS_SO_SOCKPAIR: {
7307 + /* Get a socketpair but replace the socket file
7308 + * operations with our own so we can do the
7309 + * right thing for ioctls.
7311 + struct file *filep;
7312 + struct inode *ino;
7313 + int error, args[4], pairin[2], pairout[2];
7314 + mm_segment_t old_fs = get_fs();
7316 + /* The first two arguments are file descriptors
7317 + * of sockets which have already been opened
7318 + * and should now be connected back to back.
7320 + error = get_user(pairin[0], sp+0);
7322 + error = get_user(pairin[1], sp+1);
7326 + filep = fget(pairin[0]);
7329 + ino = filep->f_dentry->d_inode;
7330 + if (!ino || !ino->i_sock) {
7335 + args[0] = AF_UNIX;
7336 + args[1] = ino->u.socket_i.type;
7338 + args[3] = (int)pairout;
7342 + /* FIXME: Do we need to close these here? If we
7343 + * fail to connect them should they be open?
7345 + SYS(close)(pairin[0]);
7346 + SYS(close)(pairin[1]);
7349 + error = SYS(socketcall)(SYS_SOCKETPAIR, args);
7354 + if (pairout[0] != pairin[0]) {
7355 + SYS(dup2)(pairout[0], pairin[0]);
7356 + SYS(close)(pairout[0]);
7358 + if (pairout[1] != pairin[1]) {
7359 + SYS(dup2)(pairout[1], pairin[1]);
7360 + SYS(close)(pairout[1]);
7363 + inherit_socksys_funcs(pairin[0], TS_DATA_XFER);
7364 + inherit_socksys_funcs(pairin[1], TS_DATA_XFER);
7373 +EXPORT_SYMBOL(socksys_syscall);
7376 +abi_ioctl_socksys(int fd, unsigned int cmd, void *arg)
7381 + /* Strictly the ip domain and nis domain are separate and
7382 + * distinct under SCO but Linux only has the one domain.
7384 + case NIOCGETDOMNAM: {
7385 + struct domnam_args dn;
7388 + error = copy_from_user(&dn, (char *)arg,
7389 + sizeof(struct domnam_args));
7393 + down_read(&uts_sem);
7394 + error = verify_area(VERIFY_WRITE, dn.name, dn.namelen);
7397 + for (p=system_utsname.domainname; *p && dn.namelen > 0; p++,dn.namelen--) {
7398 + __put_user(*p, dn.name);
7401 + __put_user('\0', dn.name);
7403 + up_read(&uts_sem);
7406 + case NIOCSETDOMNAM: {
7407 + struct domnam_args dn;
7409 + error = copy_from_user(&dn, (char *)arg,
7410 + sizeof(struct domnam_args));
7414 + return SYS(setdomainname)(dn.name, dn.namelen);
7418 + /* I think this was used before symlinks were added
7419 + * to the base SCO OS?
7421 + struct lstat_args st;
7423 + error = copy_from_user(&st, (char *)arg,
7424 + sizeof(struct lstat_args));
7428 + return abi_lstat(st.fname, st.statb);
7431 + case NIOCOLDGETFH:
7433 + struct getfh_args gf;
7434 + struct nameidata nd;
7436 + if (!capable(CAP_SYS_ADMIN))
7439 + error = copy_from_user(&gf, (char *)arg,
7440 + sizeof(struct getfh_args));
7444 + /* XXX: is this needed anymore? */
7445 + error = verify_area(VERIFY_WRITE, (char *)gf.fhp, sizeof(fhandle_t));
7449 + error = user_path_walk(gf.fname, &nd);
7453 + error = do_revalidate(nd.dentry);
7455 + struct inode *ino = nd.dentry->d_inode;
7456 + __put_user(ino->i_dev, &gf.fhp->fh.fsid);
7457 + __put_user(ino->i_ino, &gf.fhp->fh.fno);
7458 + __put_user(0L, &gf.fhp->fh.fgen);
7459 + __put_user(ino->i_dev, &gf.fhp->fh.ex_fsid);
7460 + __put_user(ino->i_ino, &gf.fhp->fh.ex_fno);
7461 + __put_user(0L, &gf.fhp->fh.ex_fgen);
7464 + path_release(&nd);
7470 + case NIOCCLNTHAND:
7471 + case NIOCEXPORTFS:
7474 + case SSYS_SIOCSOCKSYS: /* Pseudo socket syscall */
7475 + case SVR4_SIOCSOCKSYS:
7476 + return socksys_syscall((int *)arg);
7478 + case SSYS_SIOCSHIWAT: /* set high watermark */
7479 + case SVR4_SIOCSHIWAT:
7480 + case SSYS_SIOCSLOWAT: /* set low watermark */
7481 + case SVR4_SIOCSLOWAT:
7482 + /* Linux doesn't support them but lie anyway
7483 + * or some things take it as fatal (why?)
7484 + * FIXME: actually we can do this now...
7488 + case SSYS_SIOCGHIWAT: /* get high watermark */
7489 + case SVR4_SIOCGHIWAT:
7490 + case SSYS_SIOCGLOWAT: /* get low watermark */
7491 + case SVR4_SIOCGLOWAT:
7492 + /* Linux doesn't support them but lie anyway
7493 + * or some things take it as fatal (why?)
7494 + * FIXME: actually we can do this now...
7496 + if ((error = verify_area(VERIFY_WRITE, (char *)arg,
7497 + sizeof(unsigned long))))
7499 + put_user(0, (unsigned long *)arg);
7502 + case SSYS_SIOCATMARK: /* at oob mark? */
7503 + case SVR4_SIOCATMARK:
7504 + return SYS(ioctl)(fd, SIOCATMARK, arg);
7506 + case SSYS_SIOCSPGRP: /* set process group */
7507 + case SVR4_SIOCSPGRP:
7508 + return SYS(ioctl)(fd, SIOCSPGRP, arg);
7509 + case SSYS_SIOCGPGRP: /* get process group */
7510 + case SVR4_SIOCGPGRP:
7511 + return SYS(ioctl)(fd, SIOCGPGRP, arg);
7514 + case SSYS_FIONREAD: /* BSD compatibilty */
7515 + error = SYS(ioctl)(fd, TIOCINQ, arg);
7517 + if (!error && abi_traced(ABI_TRACE_SOCKSYS)) {
7520 + get_user(n, (u_long *)arg);
7521 + __abi_trace("socksys: %d FIONREAD "
7522 + "found %lu bytes ready",
7528 + case SSYS_FIONBIO: /* BSD compatibilty */
7529 + return SYS(ioctl)(fd, FIONBIO, arg);
7531 + case SSYS_FIOASYNC: /* BSD compatibilty */
7532 + return SYS(ioctl)(fd, FIOASYNC, arg);
7534 + case SSYS_SIOCADDRT: /* add route */
7535 + case SVR4_SIOCADDRT:
7536 + return SYS(ioctl)(fd, SIOCADDRT, arg);
7537 + case SSYS_SIOCDELRT: /* delete route */
7538 + case SVR4_SIOCDELRT:
7539 + return SYS(ioctl)(fd, SIOCDELRT, arg);
7541 + case SSYS_SIOCSIFADDR: /* set ifnet address */
7542 + case SVR4_SIOCSIFADDR:
7543 + return SYS(ioctl)(fd, SIOCSIFADDR, arg);
7544 + case SSYS_SIOCGIFADDR: /* get ifnet address */
7545 + case SVR4_SIOCGIFADDR:
7546 + return SYS(ioctl)(fd, SIOCGIFADDR, arg);
7548 + case SSYS_SIOCSIFDSTADDR: /* set p-p address */
7549 + case SVR4_SIOCSIFDSTADDR:
7550 + return SYS(ioctl)(fd, SIOCSIFDSTADDR, arg);
7551 + case SSYS_SIOCGIFDSTADDR: /* get p-p address */
7552 + case SVR4_SIOCGIFDSTADDR:
7553 + return SYS(ioctl)(fd, SIOCGIFDSTADDR, arg);
7555 + case SSYS_SIOCSIFFLAGS: /* set ifnet flags */
7556 + case SVR4_SIOCSIFFLAGS:
7557 + return SYS(ioctl)(fd, SIOCSIFFLAGS, arg);
7558 + case SSYS_SIOCGIFFLAGS: /* get ifnet flags */
7559 + case SVR4_SIOCGIFFLAGS:
7561 + case SVRX_SIOCGIFFLAGS:
7563 + return SYS(ioctl)(fd, SIOCGIFFLAGS, arg);
7565 + case SSYS_SIOCGIFCONF: /* get ifnet list */
7566 + case SVR4_SIOCGIFCONF:
7568 + case SVRX_SIOCGIFCONF:
7570 + return SYS(ioctl)(fd, SIOCGIFCONF, arg);
7572 + case SSYS_SIOCGIFBRDADDR: /* get broadcast addr */
7573 + case SVR4_SIOCGIFBRDADDR:
7574 + return SYS(ioctl)(fd, SIOCGIFBRDADDR, arg);
7575 + case SSYS_SIOCSIFBRDADDR: /* set broadcast addr */
7576 + case SVR4_SIOCSIFBRDADDR:
7577 + return SYS(ioctl)(fd, SIOCSIFBRDADDR, arg);
7579 + case SSYS_SIOCGIFNETMASK: /* get net addr mask */
7580 + case SVR4_SIOCGIFNETMASK:
7581 + return SYS(ioctl)(fd, SIOCGIFNETMASK, arg);
7582 + case SSYS_SIOCSIFNETMASK: /* set net addr mask */
7583 + return SYS(ioctl)(fd, SIOCSIFNETMASK, arg);
7585 + case SSYS_SIOCGIFMETRIC: /* get IF metric */
7586 + case SVR4_SIOCGIFMETRIC:
7587 + return SYS(ioctl)(fd, SIOCGIFMETRIC, arg);
7588 + case SSYS_SIOCSIFMETRIC: /* set IF metric */
7589 + case SVR4_SIOCSIFMETRIC:
7590 + return SYS(ioctl)(fd, SIOCSIFMETRIC, arg);
7592 + case SSYS_SIOCSARP: /* set arp entry */
7593 + case SVR4_SIOCSARP:
7594 + return SYS(ioctl)(fd, SIOCSARP, arg);
7595 + case SSYS_SIOCGARP: /* get arp entry */
7596 + case SVR4_SIOCGARP:
7597 + return SYS(ioctl)(fd, SIOCGARP, arg);
7598 + case SSYS_SIOCDARP: /* delete arp entry */
7599 + case SVR4_SIOCDARP:
7600 + return SYS(ioctl)(fd, SIOCDARP, arg);
7602 + case SSYS_SIOCGENADDR: /* Get ethernet addr */
7603 + case SVR4_SIOCGENADDR:
7604 + return SYS(ioctl)(fd, SIOCGIFHWADDR, arg);
7606 + case SSYS_SIOCSIFMTU: /* get if_mtu */
7607 + case SVR4_SIOCSIFMTU:
7608 + return SYS(ioctl)(fd, SIOCSIFMTU, arg);
7609 + case SSYS_SIOCGIFMTU: /* set if_mtu */
7610 + case SVR4_SIOCGIFMTU:
7611 + return SYS(ioctl)(fd, SIOCGIFMTU, arg);
7613 + case SSYS_SIOCGETNAME: /* getsockname */
7614 + case SVR4_SIOCGETNAME:
7615 + case SSYS_SIOCGETPEER: /* getpeername */
7616 + case SVR4_SIOCGETPEER:
7618 + struct sockaddr uaddr;
7619 + int uaddr_len = sizeof(struct sockaddr);
7621 + mm_segment_t old_fs;
7623 + if ((error = verify_area(VERIFY_WRITE, (char *)arg, sizeof(struct sockaddr))))
7625 + if (cmd == SSYS_SIOCGETNAME || cmd == SVR4_SIOCGETNAME)
7626 + op = SYS_GETSOCKNAME;
7628 + op = SYS_GETPEERNAME;
7630 + args[1] = (int)&uaddr;
7631 + args[2] = (int)&uaddr_len;
7632 + old_fs = get_fs();
7633 + set_fs (get_ds());
7634 + error = SYS(socketcall)(op, args);
7637 + copy_to_user((char *)arg, &uaddr, uaddr_len);
7641 + case SSYS_IF_UNITSEL: /* set unit number */
7642 + case SVR4_IF_UNITSEL:
7643 + case SSYS_SIOCXPROTO: /* empty proto table */
7644 + case SVR4_SIOCXPROTO:
7646 + case SSYS_SIOCIFDETACH: /* detach interface */
7647 + case SVR4_SIOCIFDETACH:
7648 + case SSYS_SIOCGENPSTATS: /* get ENP stats */
7649 + case SVR4_SIOCGENPSTATS:
7651 + case SSYS_SIOCSIFNAME: /* set interface name */
7652 + case SVR4_SIOCSIFNAME:
7653 + case SSYS_SIOCGIFONEP: /* get one-packet params */
7654 + case SSYS_SIOCSIFONEP: /* set one-packet params */
7656 + case SSYS_SIOCPROTO: /* link proto */
7657 + case SVR4_SIOCPROTO:
7658 + case SSYS_SIOCX25XMT:
7659 + case SVR4_SIOCX25XMT:
7660 + case SSYS_SIOCX25RCV:
7661 + case SVR4_SIOCX25RCV:
7662 + case SSYS_SIOCX25TBL:
7663 + case SVR4_SIOCX25TBL:
7666 + printk(KERN_DEBUG "%d iBCS: socksys: %d: ioctl 0x%x with argument 0x%lx requested\n",
7668 + cmd, (unsigned long)arg);
7675 +EXPORT_SYMBOL(abi_ioctl_socksys);
7679 +socksys_open(struct inode *ino, struct file *filep)
7681 + abi_trace(ABI_TRACE_SOCKSYS,
7682 + "socksys: filep=0x%08lx, inode=0x%08lx opening",
7683 + (u_long)filep, (u_long)ino);
7688 +static unsigned int
7689 +socksys_poll(struct file *filep, struct poll_table_struct *wait)
7691 + unsigned int mask = 0;
7693 +#ifdef CONFIG_ABI_XTI
7694 + struct inode *ino = filep->f_dentry->d_inode;
7696 + /* If this is a timod transport end point and there
7697 + * is a control message queued we have readable data.
7699 + if (ino && ino->i_sock && MINOR(ino->i_rdev) != 1
7700 + && Priv(filep) && Priv(filep)->pfirst)
7701 + mask = Priv(filep)->pfirst->pri == MSG_HIPRI
7707 + mask |= (*sock_poll)(filep, wait);
7713 +socksys_close(struct inode *ino, struct file *filep)
7717 + /* Not being a socket is not an error - it is probably
7718 + * just the pseudo device transport provider.
7721 + if (ino && ino->i_sock) {
7722 +#ifdef CONFIG_ABI_XTI
7723 + if (filep->private_data) {
7724 + struct T_primsg *it;
7725 + it = ((struct T_private *)filep->private_data)->pfirst;
7727 + struct T_primsg *tmp = it;
7731 + kfree(filep->private_data);
7734 + error = sock_close(ino, filep);
7737 + abi_trace(ABI_TRACE_SOCKSYS, "socksys: %lx closed", (u_long)filep);
7742 +static int __init init_abi(void)
7746 + if ((ret = register_chrdev(SOCKSYS_MAJOR, "socksys", &socksys_fops)))
7747 + printk(KERN_ERR "abi: unable register socksys char major\n");
7751 +static void __exit cleanup_abi(void)
7753 + unregister_chrdev(SOCKSYS_MAJOR, "socksys");
7756 +module_init(init_abi);
7757 +module_exit(cleanup_abi);
7758 diff -uNr --exclude-from=dontdiff linux-2.4.3/abi/common/stat.c linux/abi/common/stat.c
7759 --- linux-2.4.3/abi/common/stat.c Thu Jan 1 01:00:00 1970
7760 +++ linux/abi/common/stat.c Sun Mar 18 17:35:53 2001
7763 + * stat.c - iABI stat(2) emulation
7765 + * Copyright (C) 1991, 1992 Linus Torvalds
7767 + * Hacked by Eric Youngdale for iBCS.
7768 + * Added to by Drew Sullivan.
7769 + * Heavily rewritten by Christoph Hellwig for Linux 2.4.
7772 +#include <linux/module.h>
7774 +#include <linux/errno.h>
7775 +#include <linux/stat.h>
7776 +#include <linux/fs.h>
7777 +#include <linux/sched.h>
7778 +#include <linux/kernel.h>
7779 +#include <linux/mm.h>
7780 +#include <linux/file.h>
7782 +#include <asm/uaccess.h>
7783 +#include <abi/abi.h>
7787 +static int cp_abi_stat(struct inode * inode, struct ibcs_stat * statbuf)
7789 + struct ibcs_stat tmp;
7791 + memset ((void *) &tmp, 0, sizeof (tmp));
7792 + tmp.st_dev = inode->i_dev;
7793 + tmp.st_ino = inode->i_ino;
7794 + tmp.st_mode = inode->i_mode;
7795 + tmp.st_nlink = inode->i_nlink;
7796 + tmp.st_uid = inode->i_uid;
7797 + tmp.st_gid = inode->i_gid;
7798 + tmp.st_rdev = inode->i_rdev;
7799 + tmp.st_size = inode->i_size;
7800 + tmp.st_atime.tv_sec = inode->i_atime;
7801 + tmp.st_mtime.tv_sec = inode->i_mtime;
7802 + tmp.st_ctime.tv_sec = inode->i_ctime;
7803 + tmp.st_blksize = inode->i_blksize;
7804 + tmp.st_blocks = inode->i_blocks;
7805 + return copy_to_user(statbuf,&tmp,sizeof(tmp)) ? -EFAULT : 0;
7808 +#else /* if not sparc... */
7811 + * Believe it or not, the original stat structure is compatible with ibcs2.
7812 + * The xstat struct used by SVr4 is different than our new struct, but we will
7813 + * deal with that later
7815 +static int cp_abi_stat(struct inode * inode, struct ibcs_stat * statbuf)
7817 + struct ibcs_stat tmp;
7819 + /* Note that we have to fold a long inode number down to a short.
7820 + * This must match what happens in coff:ibcs_read() and
7821 + * open.c:svr4_getdents() since code that figures out cwd needs
7822 + * the inodes to match. Because it must match read() on a
7823 + * directory we have to avoid the situation where we end up
7824 + * with a zero inode value. A zero inode value in a read()
7825 + * on a directory indicates an empty directory slot.
7827 + if ((unsigned long)inode->i_ino & 0xffff)
7828 + tmp.st_ino = (unsigned long)inode->i_ino & 0xffff;
7830 + tmp.st_ino = 0xfffe;
7832 + tmp.st_dev = inode->i_dev;
7833 + tmp.st_mode = inode->i_mode;
7834 + tmp.st_nlink = inode->i_nlink;
7835 + tmp.st_uid = inode->i_uid;
7836 + tmp.st_gid = inode->i_gid;
7837 + tmp.st_rdev = inode->i_rdev;
7838 + tmp.st_size = inode->i_size;
7839 + tmp.st_atime = inode->i_atime;
7840 + tmp.st_mtime = inode->i_mtime;
7841 + tmp.st_ctime = inode->i_ctime;
7842 + return copy_to_user(statbuf,&tmp,sizeof(tmp)) ? -EFAULT : 0;
7844 +#endif /* not sparc */
7847 +int abi_stat(char *filename, struct ibcs_stat *st)
7849 + struct nameidata nd;
7852 + error = user_path_walk(filename, &nd);
7854 + error = do_revalidate(nd.dentry);
7856 + error = cp_abi_stat(nd.dentry->d_inode, st);
7857 + path_release(&nd);
7862 +EXPORT_SYMBOL(abi_stat);
7865 +int abi_lstat(char *filename, struct ibcs_stat *st)
7867 + struct nameidata nd;
7870 + error = user_path_walk_link(filename, &nd);
7872 + error = do_revalidate(nd.dentry);
7874 + error = cp_abi_stat(nd.dentry->d_inode, st);
7875 + path_release(&nd);
7880 +EXPORT_SYMBOL(abi_lstat);
7883 +int abi_fstat(unsigned int fd, struct ibcs_stat *st)
7890 + struct dentry * dentry = f->f_dentry;
7891 + err = do_revalidate(dentry);
7893 + err = cp_abi_stat(dentry->d_inode, st);
7900 +EXPORT_SYMBOL(abi_fstat);
7901 diff -uNr --exclude-from=dontdiff linux-2.4.3/abi/common/verb_errmap.inc linux/abi/common/verb_errmap.inc
7902 --- linux-2.4.3/abi/common/verb_errmap.inc Thu Jan 1 01:00:00 1970
7903 +++ linux/abi/common/verb_errmap.inc Mon Mar 12 16:34:48 2001
7906 +#ifdef CONFIG_ABI_VERBOSE_ERRORS
7907 +static char *errmsg[] = {
7909 + "Operation not permitted",
7910 + "No such file or directory",
7911 + "No such process",
7912 + "Interrupted system call",
7914 + "No such device or address",
7915 + "Arg list too long",
7916 + "Exec format error",
7917 + "Bad file number",
7918 + "No child processes",
7921 + "Permission denied",
7923 + "Block device required",
7924 + "Device or resource busy",
7926 + "Cross-device link",
7928 + "Not a directory",
7930 + "Invalid argument",
7931 + "File table overflow",
7932 + "Too many open files",
7933 + "Not a typewriter",
7936 + "No space left on device",
7938 + "Read-only file system",
7941 + "Math argument out of domain of func",
7942 + "Math result not representable",
7943 + "Resource deadlock would occur",
7944 + "File name too long",
7945 + "No record locks available",
7946 + "Function not implemented",
7947 + "Directory not empty",
7948 + "Too many symbolic links encountered",
7950 + "No message of desired type",
7951 + "Identifier removed",
7952 + "Channel number out of range",
7953 + "Level 2 not synchronized",
7956 + "Link number out of range",
7957 + "Protocol driver not attached",
7958 + "No CSI structure available",
7960 + "Invalid exchange",
7961 + "Invalid request descriptor",
7964 + "Invalid request code",
7966 + "File locking deadlock error",
7967 + "Bad font file format",
7968 + "Device not a stream",
7969 + "No data available",
7971 + "Out of streams resources",
7972 + "Machine is not on the network",
7973 + "Package not installed",
7974 + "Object is remote",
7975 + "Link has been severed",
7976 + "Advertise error",
7978 + "Communication error on send",
7980 + "Multihop attempted",
7981 + "RFS specific error",
7982 + "Not a data message",
7983 + "Value too large for defined data type",
7984 + "Name not unique on network",
7985 + "File descriptor in bad state",
7986 + "Remote address changed",
7987 + "Can not access a needed shared library",
7988 + "Accessing a corrupted shared library",
7989 + ".lib section in a.out corrupted",
7990 + "Attempting to link in too many shared libraries",
7991 + "Cannot exec a shared library directly",
7992 + "Illegal byte sequence",
7993 + "Interrupted system call should be restarted",
7994 + "Streams pipe error",
7996 + "Socket operation on non-socket",
7997 + "Destination address required",
7998 + "Message too long",
7999 + "Protocol wrong type for socket",
8000 + "Protocol not available",
8001 + "Protocol not supported",
8002 + "Socket type not supported",
8003 + "Operation not supported on transport endpoint",
8004 + "Protocol family not supported",
8005 + "Address family not supported by protocol",
8006 + "Address already in use",
8007 + "Cannot assign requested address",
8008 + "Network is down",
8009 + "Network is unreachable",
8010 + "Network dropped connection because of reset",
8011 + "Software caused connection abort",
8012 + "Connection reset by peer",
8013 + "No buffer space available",
8014 + "Transport endpoint is already connected",
8015 + "Transport endpoint is not connected",
8016 + "Cannot send after transport endpoint shutdown",
8017 + "Too many references: cannot splice",
8018 + "Connection timed out",
8019 + "Connection refused",
8021 + "No route to host",
8022 + "Operation already in progress",
8023 + "Operation now in progress",
8024 + "Stale NFS file handle",
8025 + "Structure needs cleaning",
8026 + "Not a XENIX named type file",
8027 + "No XENIX semaphores available",
8028 + "Is a named type file",
8029 + "Remote I/O error",
8033 +#endif /* CONFIG_ABI_VERBOSE_ERRORS */
8034 diff -uNr --exclude-from=dontdiff linux-2.4.3/abi/common/wysev386.c linux/abi/common/wysev386.c
8035 --- linux-2.4.3/abi/common/wysev386.c Thu Jan 1 01:00:00 1970
8036 +++ linux/abi/common/wysev386.c Mon Mar 12 16:34:48 2001
8040 + * wysev386.c - wyse386 specific syscalls
8042 + * Copyright 1994, 1996 Mike Jagdis (jaggy@purplet.demon.co.uk)
8044 + * XXX: the name of this file is wrong -- ch
8047 +#include <linux/module.h>
8049 +#include <asm/uaccess.h>
8051 +#include <linux/mm.h>
8052 +#include <linux/sched.h>
8053 +#include <linux/utsname.h>
8054 +#include <linux/wait.h>
8055 +#include <linux/net.h>
8056 +#include <linux/sys.h>
8058 +#include <abi/abi.h>
8059 +#include <abi/map.h>
8060 +#include <abi/socket.h>
8063 +int abi_gethostname(char *name, int len)
8068 + down_read(&uts_sem);
8069 + error = verify_area(VERIFY_WRITE, name, len);
8072 + for (p = system_utsname.nodename; *p && len; p++,len--) {
8073 + __put_user(*p, name);
8076 + __put_user('\0', name);
8078 + up_read(&uts_sem);
8083 +EXPORT_SYMBOL(abi_gethostname);
8085 +int abi_getdomainname(char *name, int len)
8090 + down_read(&uts_sem);
8091 + error = verify_area(VERIFY_WRITE, name, len);
8094 + for (p = system_utsname.domainname; *p && len; p++,len--) {
8095 + __put_user(*p, name);
8098 + __put_user('\0', name);
8100 + up_read(&uts_sem);
8105 +EXPORT_SYMBOL(abi_getdomainname);
8107 +int abi_wait3(int *loc)
8111 + pid = SYS(wait4)(-1, loc, WNOHANG, 0);
8115 + __get_user(res, (unsigned long *) loc);
8116 + if ((res & 0xff) == 0x7f) {
8117 + int sig = (res >> 8) & 0xff;
8118 + sig = current->exec_domain->signal_map[sig];
8119 + res = (res & (~0xff00)) | (sig << 8);
8120 + put_user(res, (unsigned long *)loc);
8121 + } else if (res && res == (res & 0xff)) {
8122 + res = current->exec_domain->signal_map[res & 0x7f];
8123 + put_user(res, (unsigned long *)loc);
8130 +EXPORT_SYMBOL(abi_wait3);
8133 +/* It would probably be better to remove the statics in linux/net/socket.c
8134 + * and go direct to the sock_ calls than via the indirection routine.
8136 +int abi_socket(struct pt_regs *regs)
8140 + get_user(v, ((unsigned long*)regs->esp)+1);
8142 + map_value(current->exec_domain->af_map, v, 0),
8143 + ((unsigned long *)regs->esp)+1);
8144 + get_user(v, ((unsigned long*)regs->esp)+2);
8146 + map_value(current->exec_domain->socktype_map, v, 0),
8147 + ((unsigned long *)regs->esp)+2);
8149 + return SYS(socketcall)(SYS_SOCKET, ((unsigned long *)regs->esp) + 1);
8152 +EXPORT_SYMBOL(abi_socket);
8154 +int abi_connect(struct pt_regs *regs)
8156 + return SYS(socketcall)(SYS_CONNECT, ((unsigned long *)regs->esp) + 1);
8159 +EXPORT_SYMBOL(abi_connect);
8161 +int abi_accept(struct pt_regs *regs)
8163 + return SYS(socketcall)(SYS_ACCEPT, ((unsigned long *)regs->esp) + 1);
8166 +EXPORT_SYMBOL(abi_accept);
8168 +int abi_send(struct pt_regs *regs)
8170 + int err = SYS(socketcall)(SYS_SEND, ((unsigned long *)regs->esp) + 1);
8171 + if (err == -EAGAIN)
8172 + err = -EWOULDBLOCK;
8176 +EXPORT_SYMBOL(abi_send);
8178 +int abi_recv(struct pt_regs *regs)
8180 + int err = SYS(socketcall)(SYS_RECV, ((unsigned long *)regs->esp) + 1);
8181 + if (err == -EAGAIN)
8182 + err = -EWOULDBLOCK;
8186 +EXPORT_SYMBOL(abi_recv);
8189 +int abi_bind(struct pt_regs *regs)
8191 + return SYS(socketcall)(SYS_BIND, ((unsigned long *)regs->esp) + 1);
8194 +EXPORT_SYMBOL(abi_bind);
8196 +int abi_setsockopt(struct pt_regs *regs)
8198 + return abi_do_setsockopt(((unsigned long *)regs->esp) + 1);
8201 +EXPORT_SYMBOL(abi_setsockopt);
8203 +int abi_listen(struct pt_regs *regs)
8205 + return SYS(socketcall)(SYS_LISTEN, ((unsigned long *)regs->esp) + 1);
8208 +EXPORT_SYMBOL(abi_listen);
8210 +int abi_getsockopt(struct pt_regs *regs)
8212 + return abi_do_getsockopt(((unsigned long *)regs->esp) + 1);
8215 +EXPORT_SYMBOL(abi_getsockopt);
8217 +int abi_recvfrom(struct pt_regs *regs)
8219 + int err = SYS(socketcall)(SYS_RECVFROM, ((unsigned long *)regs->esp) + 1);
8220 + if (err == -EAGAIN)
8221 + err = -EWOULDBLOCK;
8225 +EXPORT_SYMBOL(abi_recvfrom);
8227 +int abi_sendto(struct pt_regs *regs)
8229 + int err = SYS(socketcall)(SYS_SENDTO, ((unsigned long *)regs->esp) + 1);
8230 + if (err == -EAGAIN)
8231 + err = -EWOULDBLOCK;
8235 +EXPORT_SYMBOL(abi_sendto);
8237 +int abi_shutdown(struct pt_regs *regs)
8239 + return SYS(socketcall)(SYS_SHUTDOWN, ((unsigned long *)regs->esp) + 1);
8242 +EXPORT_SYMBOL(abi_shutdown);
8244 +int abi_socketpair(struct pt_regs *regs)
8246 + return SYS(socketcall)(SYS_SOCKETPAIR, ((unsigned long *)regs->esp) + 1);
8249 +EXPORT_SYMBOL(abi_socketpair);
8251 +int abi_getpeername(struct pt_regs *regs)
8253 + return SYS(socketcall)(SYS_GETPEERNAME, ((unsigned long *)regs->esp) + 1);
8256 +EXPORT_SYMBOL(abi_getpeername);
8258 +int abi_getsockname(struct pt_regs *regs)
8260 + return SYS(socketcall)(SYS_GETSOCKNAME, ((unsigned long *)regs->esp) + 1);
8263 +EXPORT_SYMBOL(abi_getsockname);
8264 diff -uNr --exclude-from=dontdiff linux-2.4.3/abi/solaris/Makefile linux/abi/solaris/Makefile
8265 --- linux-2.4.3/abi/solaris/Makefile Thu Jan 1 01:00:00 1970
8266 +++ linux/abi/solaris/Makefile Mon Mar 12 16:34:48 2001
8269 +# Makefile for the kernel ABI code for Solaris emulation
8272 +O_TARGET := dummy.o
8274 +list-multi := abi-solaris.o
8275 +abi-solaris-objs:= do_solaris.o lfs.o solarisx86.o
8277 +obj-$(CONFIG_ABI_SOLARIS) += abi-solaris.o
8280 +include $(TOPDIR)/Rules.make
8282 +abi-solaris.o: $(abi-solaris-objs)
8283 + $(LD) -r -o $@ $(abi-solaris-objs)
8284 diff -uNr --exclude-from=dontdiff linux-2.4.3/abi/solaris/do_solaris.c linux/abi/solaris/do_solaris.c
8285 --- linux-2.4.3/abi/solaris/do_solaris.c Thu Jan 1 01:00:00 1970
8286 +++ linux/abi/solaris/do_solaris.c Mon Mar 12 16:34:48 2001
8288 +#include <linux/kernel.h>
8289 +#include <linux/module.h>
8290 +#include <linux/init.h>
8292 +#include <abi/abi.h>
8293 +#include <abi/abi4.h>
8294 +#include <abi/svr4.h>
8295 +#include <abi/solaris.h>
8299 +extern ABI_func svr4_generic_funcs[];
8301 +static ABI_func Solaris_funcs[] = {
8302 + { 0, Ukn ITR(1, "vtrace", "") }, /* 142 */
8303 + { 0, Ukn ITR(1, "fork1", "") }, /* 143 */
8304 + { 0, Ukn ITR(1, "sigtimedwait", "") }, /* 144 */
8305 + { 0, Ukn ITR(1, "lwp_info", "") }, /* 145 */
8306 + { 0, Ukn ITR(1, "yield", "") }, /* 146 */
8307 + { 0, Ukn ITR(1, "lwp_sema_wait", "") }, /* 147 */
8308 + { 0, Ukn ITR(1, "lwp_sema_post", "") }, /* 148 */
8309 + { 0, Ukn ITR(1, "lwp_sema_trywait","") }, /* 149 */
8310 + { 0, Ukn ITR(1, "?", "") }, /* 150 */
8311 + { 0, Ukn ITR(1, "?", "") }, /* 151 */
8312 + { 0, Ukn ITR(1, "modctl", "") }, /* 152 */
8313 + { 0, Ukn ITR(1, "fchroot", "") }, /* 153 */
8314 + { 0, Ukn ITR(1, "utimes", "") }, /* 154 */
8315 + { 0, Ukn ITR(1, "vhangup", "") }, /* 155 */
8316 + { SC(gettimeofday), -2 ITR(0, "gettimeofday", "xx") }, /* 156 */
8317 + { SC(getitimer), -2 ITR(0, "getitimer", "dx") }, /* 157 */
8318 + { SC(setitimer), -3 ITR(0, "setitimer", "dxx") }, /* 158 */
8319 + { 0, Ukn ITR(1, "lwp_create", "") }, /* 159 */
8320 + { 0, Ukn ITR(1, "lwp_exit", "") }, /* 160 */
8321 + { 0, Ukn ITR(1, "lwp_suspend", "") }, /* 161 */
8322 + { 0, Ukn ITR(1, "lwp_continue", "") }, /* 162 */
8323 + { 0, Ukn ITR(1, "lwp_kill", "") }, /* 163 */
8324 + { 0, Ukn ITR(1, "lwp_self", "") }, /* 164 */
8325 + { 0, Ukn ITR(1, "lwp_setprivate","") }, /* 165 */
8326 + { 0, Ukn ITR(1, "lwp_getprivate","") }, /* 166 */
8327 + { 0, Ukn ITR(1, "lwp_wait", "") }, /* 167 */
8328 + { 0, Ukn ITR(1, "lwp_mutex_unlock","") }, /* 168 */
8329 + { 0, Ukn ITR(1, "lwp_mutex_lock","") }, /* 169 */
8330 + { 0, Ukn ITR(1, "lwp_cond_wait", "") }, /* 170 */
8331 + { 0, Ukn ITR(1, "lwp_cond_signal","") }, /* 171 */
8332 + { 0, Ukn ITR(1, "lwp_cond_broadcast","") }, /* 172 */
8333 + { SC(pread), -4 ITR(1, "pread", "dpdd") }, /* 173 */
8334 + { SC(pwrite), -4 ITR(1, "pwrite", "dpdd") }, /* 174 */
8335 + { sol_llseek, Spl ITR(1, "llseek", "dxxd") }, /* 175 */
8336 + { 0, Ukn ITR(1, "inst_sync", "") }, /* 176 */
8337 + { 0, Ukn ITR(1, "?", "") }, /* 177 */
8338 + { 0, Ukn ITR(1, "kaio", "") }, /* 178 */
8339 + { 0, Ukn ITR(1, "?", "") }, /* 179 */
8340 + { 0, Ukn ITR(1, "?", "") }, /* 180 */
8341 + { 0, Ukn ITR(1, "?", "") }, /* 181 */
8342 + { 0, Ukn ITR(1, "?", "") }, /* 182 */
8343 + { 0, Ukn ITR(1, "?", "") }, /* 183 */
8344 + { 0, Ukn ITR(1, "tsolsys", "") }, /* 184 */
8345 + { sol_acl, 4 ITR(1, "acl", "sddp") }, /* 185 */
8346 + { 0, Ukn ITR(1, "auditsys", "") }, /* 186 */
8347 + { 0, Ukn ITR(1, "processor_bind","") }, /* 187 */
8348 + { 0, Ukn ITR(1, "processor_info","") }, /* 188 */
8349 + { 0, Ukn ITR(1, "p_online", "") }, /* 189 */
8350 + { 0, Ukn ITR(1, "sigqueue", "") }, /* 190 */
8351 + { 0, Ukn ITR(1, "clock_gettime", "") }, /* 191 */
8352 + { 0, Ukn ITR(1, "clock_settime", "") }, /* 192 */
8353 + { 0, Ukn ITR(1, "clock_getres", "") }, /* 193 */
8354 + { 0, Ukn ITR(1, "timer_create", "") }, /* 194 */
8355 + { 0, Ukn ITR(1, "timer_delete", "") }, /* 195 */
8356 + { 0, Ukn ITR(1, "timer_settime", "") }, /* 196 */
8357 + { 0, Ukn ITR(1, "timer_gettime", "") }, /* 197 */
8358 + { 0, Ukn ITR(1, "timer_getoverrun","") }, /* 198 */
8359 + { SC(nanosleep), -2 ITR(1, "nanosleep", "pp") }, /* 199 */
8360 + { 0, Ukn ITR(1, "modstat", "") }, /* 200 */
8361 + { 0, Ukn ITR(1, "facl", "") }, /* 201 */
8362 + { SC(setreuid), -2 ITR(1, "setreuid", "dd") }, /* 202 */
8363 + { SC(setregid), -2 ITR(1, "setregid", "dd") }, /* 203 */
8364 + { 0, Ukn ITR(1, "install_utrap", "") }, /* 204 */
8365 + { 0, Ukn ITR(1, "signotify", "") }, /* 205 */
8366 + { 0, Ukn ITR(1, "schedctl", "") }, /* 206 */
8367 + { 0, Ukn ITR(1, "pset", "") }, /* 207 */
8368 + { 0, Ukn ITR(1, "?", "") }, /* 208 */
8369 + { 0, Ukn ITR(1, "resolvepath", "") }, /* 209 */
8370 + { 0, Ukn ITR(1, "signotifywait", "") }, /* 210 */
8371 + { 0, Ukn ITR(1, "lwp_sigredirect","") }, /* 211 */
8372 + { 0, Ukn ITR(1, "lwp_alarm", "") }, /* 212 */
8373 + { sol_getdents64, 3 ITR(0, "getdents64", "dxd") }, /* 213 */
8374 + { sol_mmap64, 7 ITR(1, "mmap64", "pxdddxx")}, /*214 */
8375 + { sol_stat64, 2 ITR(0, "stat64", "sp") }, /* 215 */
8376 + { sol_lstat64, 2 ITR(0, "lstat64", "sp") }, /* 216 */
8377 + { sol_fstat64, 2 ITR(0, "fstat64", "dp") }, /* 217 */
8378 + { 0, Ukn ITR(1, "statvfs64", "") }, /* 218 */
8379 + { 0, Ukn ITR(1, "fstatvfs64", "") }, /* 219 */
8380 + { 0, Ukn ITR(1, "setrlimit64", "") }, /* 220 */
8381 + { 0, Ukn ITR(1, "getrlimit64", "") }, /* 221 */
8382 + { 0, Ukn ITR(1, "pread64", "") }, /* 222 */
8383 + { 0, Ukn ITR(1, "pwrite64", "") }, /* 223 */
8384 + { 0, Ukn ITR(1, "creat64", "") }, /* 224 */
8385 + { sol_open64, 3 ITR(0, "open64", "soo") }, /* 225 */
8386 + { 0, Ukn ITR(1, "rpcsys", "") }, /* 226 */
8387 + { 0, Ukn ITR(1, "?", "") }, /* 227 */
8388 + { 0, Ukn ITR(1, "?", "") }, /* 228 */
8389 + { 0, Ukn ITR(1, "?", "") }, /* 229 */
8390 + { abi_socket, Spl ITR(1, "so_socket", "ddd") }, /* 230 */
8391 + { abi_socketpair, Spl ITR(1, "so_socketpair", "dddx") }, /* 231 */
8392 + { abi_bind, Spl ITR(1, "bind", "dxd") }, /* 232 */
8393 + { abi_listen, Spl ITR(1, "listen", "dd") }, /* 233 */
8394 + { abi_accept, Spl ITR(1, "accept", "dxx") }, /* 234 */
8395 + { abi_connect, Spl ITR(1, "connect", "dxd") }, /* 235 */
8396 + { abi_shutdown, Spl ITR(1, "shutdown", "dd") }, /* 236 */
8397 + { abi_recv, Spl ITR(1, "recv", "dxdd") }, /* 237 */
8398 + { abi_recvfrom, Spl ITR(1, "recvfrom", "dxddxd")}, /* 238 */
8399 + { 0, Ukn ITR(1, "recvmsg", "") }, /* 239 */
8400 + { abi_send, Spl ITR(1, "send", "dxdd") }, /* 240 */
8401 + { 0, Ukn ITR(0, "sendmsg", "") }, /* 241 */
8402 + { abi_sendto, Spl ITR(1, "sendto", "dxddxd")}, /* 242 */
8403 + { abi_getpeername, Spl ITR(1, "getpeername", "dxx") }, /* 243 */
8404 + { abi_getsockname, Spl ITR(1, "getsockname", "") }, /* 244 */
8405 + { abi_getsockopt, Spl ITR(1, "getsockopt", "dddxx")}, /* 245 */
8406 + { abi_setsockopt, Spl ITR(1, "setsockopt", "dddxd")}, /* 246 */
8407 + { 0, Ukn ITR(1, "sockconfig", "") }, /* 247 */
8408 + { 0, Ukn ITR(1, "ntp_gettime", "") }, /* 248 */
8409 + { 0, Ukn ITR(0, "ntp_adjtime", "") }, /* 249 */
8410 + { 0, Ukn ITR(1, "?", "") }, /* 250 */
8411 + { 0, Ukn ITR(1, "?", "") }, /* 251 */
8412 + { 0, Ukn ITR(1, "?", "") }, /* 252 */
8413 + { 0, Ukn ITR(1, "?", "") }, /* 253 */
8414 + { 0, Ukn ITR(1, "?", "") }, /* 254 */
8415 + { 0, Ukn ITR(1, "?", "") } /* 255 */
8420 +static void Solaris_lcall7(int segment, struct pt_regs * regs)
8422 + int i = regs->eax & 0xff;
8426 + p = &svr4_generic_funcs[i];
8428 + p = &Solaris_funcs[i - 142];
8430 + abi_dispatch(regs, p, 1);
8433 +extern struct map_segment svr4_err_map[];
8434 +extern struct map_segment svr4_socktype_map[];
8435 +extern struct map_segment abi_sockopt_map[];
8436 +extern struct map_segment abi_af_map[];
8438 +extern long linux_to_ibcs_signals[];
8439 +extern long ibcs_to_linux_signals[];
8442 +struct exec_domain solaris_exec_domain = {
8445 + 13 /* PER_SOLARIS */, 13 /* PER_SOLARIS */,
8446 + ibcs_to_linux_signals,
8447 + linux_to_ibcs_signals,
8449 + svr4_socktype_map,
8457 +static void __exit solaris_cleanup(void)
8459 + unregister_exec_domain(&solaris_exec_domain);
8462 +static int __init solaris_init(void)
8464 + return register_exec_domain(&solaris_exec_domain);
8467 +module_init(solaris_init);
8468 +module_exit(solaris_cleanup);
8469 diff -uNr --exclude-from=dontdiff linux-2.4.3/abi/solaris/lfs.c linux/abi/solaris/lfs.c
8470 --- linux-2.4.3/abi/solaris/lfs.c Thu Jan 1 01:00:00 1970
8471 +++ linux/abi/solaris/lfs.c Fri Mar 30 16:13:52 2001
8474 + * lfs.c - Solaris Large File Summit support
8478 +#include <linux/errno.h>
8479 +#include <linux/stat.h>
8480 +#include <linux/fs.h>
8481 +#include <linux/sched.h>
8482 +#include <linux/kernel.h>
8483 +#include <linux/mm.h>
8484 +#include <linux/file.h>
8485 +#include <linux/slab.h>
8486 +#include <linux/mman.h>
8487 +#include <linux/un.h>
8488 +#include <linux/dirent.h>
8489 +#include <asm/uaccess.h>
8491 +#include <abi/abi.h>
8492 +#include <abi/lfs.h>
8494 +extern unsigned short fl_ibcs_to_linux[];
8495 +extern unsigned short fl_ibcs_to_linux[];
8499 +sol_open64(const char *fname, int flag, int mode)
8501 + int error, fd, args[3];
8502 + struct file *file;
8503 + mm_segment_t old_fs;
8505 + struct sockaddr_un addr;
8507 + fd = SYS(open)(fname, map_flags(flag, fl_ibcs_to_linux) | O_LARGEFILE, mode);
8511 + /* Sometimes a program may open a pathname which it expects
8512 + * to be a named pipe (or STREAMS named pipe) when the
8513 + * Linux domain equivalent is a Unix domain socket. (e.g.
8514 + * UnixWare uses a STREAMS named pipe /dev/X/Nserver.0 for
8515 + * X :0 but Linux uses a Unix domain socket /tmp/.X11-unix/X0)
8516 + * It isn't enough just to make the symlink because you cannot
8517 + * open() a socket and read/write it. If we spot the error we can
8518 + * switch to socket(), connect() and things will likely work
8519 + * as expected however.
8523 + return fd; /* Huh?!? */
8524 + if (!S_ISSOCK(file->f_dentry->d_inode->i_mode)) {
8531 + args[0] = AF_UNIX;
8532 + args[1] = SOCK_STREAM;
8534 + old_fs = get_fs();
8536 + fd = SYS(socketcall)(SYS_SOCKET, args);
8541 + p = getname(fname);
8544 + return PTR_ERR(p);
8546 + if (strlen(p) >= UNIX_PATH_MAX) {
8551 + addr.sun_family = AF_UNIX;
8552 + strcpy(addr.sun_path, p);
8556 + args[1] = (int)&addr;
8557 + args[2] = sizeof(struct sockaddr_un);
8559 + error = SYS(socketcall)(SYS_CONNECT, args);
8571 +cp_sol_stat64(struct inode *inode, struct sol_stat64 * statbuf)
8573 + struct sol_stat64 tmp;
8575 + memset(&tmp, 0, sizeof(struct sol_stat64));
8577 + /* I don't see why this makes sense for solaris --hch */
8578 + if ((unsigned long)inode->i_ino & 0xffff)
8579 + tmp.st_ino = (unsigned long)inode->i_ino & 0xffff;
8581 + tmp.st_ino = 0xfffe;
8583 + tmp.st_dev = inode->i_dev;
8584 + tmp.st_mode = inode->i_mode;
8585 + tmp.st_nlink = inode->i_nlink;
8586 + tmp.st_uid = inode->i_uid;
8587 + tmp.st_gid = inode->i_gid;
8588 + tmp.st_rdev = inode->i_rdev;
8589 + tmp.st_size = inode->i_size;
8590 + tmp.st_atime = inode->i_atime;
8591 + tmp.st_mtime = inode->i_mtime;
8592 + tmp.st_ctime = inode->i_ctime;
8594 + return copy_to_user(statbuf, &tmp, sizeof(tmp)) ? -EFAULT : 0;
8598 +sol_stat64(char *filename, struct sol_stat64 *statbuf)
8600 + struct nameidata nd;
8603 + error = user_path_walk(filename, &nd);
8605 + error = do_revalidate(nd.dentry);
8607 + error = cp_sol_stat64(nd.dentry->d_inode, statbuf);
8608 + path_release(&nd);
8614 +sol_lstat64(char *filename, struct sol_stat64 *statbuf)
8616 + struct nameidata nd;
8619 + error = user_path_walk_link(filename, &nd);
8621 + error = do_revalidate(nd.dentry);
8623 + error = cp_sol_stat64(nd.dentry->d_inode, statbuf);
8624 + path_release(&nd);
8630 +sol_fstat64(unsigned int fd, struct sol_stat64 * statbuf)
8637 + struct dentry *dentry = fp->f_dentry;
8639 + err = do_revalidate(dentry);
8641 + err = cp_sol_stat64(dentry->d_inode, statbuf);
8650 +/* If/when the readdir function is changed to read multiple entries
8651 + * at once this should be updated to take advantage of the fact.
8653 + * N.B. For Linux the reclen in a dirent is the number of characters
8654 + * in the filename, for SCO (at least) reclen is the total size of
8655 + * the particular dirent rounded up to the next multiple of 4. The SCO
8656 + * behaviour is faithfully emulated here.
8659 + * We don't truncate long filenames at all when copying. If we meet a
8660 + * long filename and the buffer supplied by the application simply isn't
8661 + * big enough to hold it we'll return without filling the buffer (i.e
8662 + * return 0). The application will see this as a (premature) end of
8663 + * directory. Is there a work around for this at all???
8666 +sol_getdents64(int fd, char *buf, int nbytes)
8668 + int error, here, posn, reclen;
8669 + struct file *file;
8671 + mm_segment_t old_fs;
8673 + error = verify_area(VERIFY_WRITE, buf, nbytes);
8677 + /* Check the file handle here. This is so we can access the current
8678 + * position in the file structure safely without a tedious call
8679 + * to sys_lseek that does nothing useful.
8685 + d = (struct dirent *)__get_free_page(GFP_KERNEL);
8691 + error = posn = reclen = 0;
8692 + while (posn + reclen < nbytes) {
8693 + struct sol_dirent64 tmpbuf;
8694 + /* Save the current position and get another dirent */
8695 + here = file->f_pos;
8696 + old_fs = get_fs();
8697 + set_fs (get_ds());
8698 + error = SYS(readdir)(fd, d, 1);
8703 + /* If it'll fit in the buffer save it otherwise back up
8704 + * so it is read next time around.
8705 + * Oh, if we're at the beginning of the buffer there's
8706 + * no chance that this entry will ever fit so don't
8707 + * copy it and don't back off - we'll just pretend it
8710 + reclen = (sizeof(long long) + sizeof(long long)
8711 + + sizeof(unsigned short) + d->d_reclen + 1
8713 + if (posn + reclen <= nbytes) {
8714 + tmpbuf.d_off = file->f_pos;
8715 + tmpbuf.d_ino = d->d_ino;
8716 + tmpbuf.d_off = file->f_pos;
8717 + tmpbuf.d_reclen = reclen;
8718 + copy_to_user(buf+posn, &tmpbuf,
8719 + sizeof(struct sol_dirent64) -1);
8720 + copy_to_user(buf+posn+sizeof(struct sol_dirent64)-2,
8721 + &d->d_name, d->d_reclen+1);
8723 + } else if (posn) {
8724 + SYS(lseek)(fd, here, 0);
8725 + } /* else posn == 0 */
8728 + /* Loose the intermediate buffer. */
8729 + free_page((unsigned long)d);
8733 + /* If we've put something in the buffer return the byte count
8734 + * otherwise return the error status.
8736 + return ((posn > 0) ? posn : error);
8741 +sol_mmap64(u_int addr, u_int len, int prot, int flags,
8742 + int fd, u_int off_hi, u_int off)
8744 + loff_t off64 = (off | ((loff_t)off_hi << 32));
8745 + u_long pgoff = (off64 >> PAGE_SHIFT);
8746 + struct file *file = NULL;
8749 + if ((off64 + PAGE_ALIGN(len)) < off64)
8752 + if (!(off64 & ~PAGE_MASK))
8755 + flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
8756 + if (!(flags & MAP_ANONYMOUS)) {
8757 + if (!(file = fget(fd)))
8761 + if (!(flags & 0x80000000) && addr)
8762 + flags |= MAP_FIXED;
8764 + flags &= 0x7fffffff;
8766 + down_write(¤t->mm->mmap_sem);
8767 + error = do_mmap_pgoff(file, addr, len, prot, flags, pgoff);
8768 + up_write(¤t->mm->mmap_sem);
8774 diff -uNr --exclude-from=dontdiff linux-2.4.3/abi/solaris/solarisx86.c linux/abi/solaris/solarisx86.c
8775 --- linux-2.4.3/abi/solaris/solarisx86.c Thu Jan 1 01:00:00 1970
8776 +++ linux/abi/solaris/solarisx86.c Mon Mar 12 16:34:48 2001
8778 +#include <abi/abi.h>
8779 +#include <linux/config.h>
8780 +#include <linux/version.h>
8781 +#include <asm/uaccess.h>
8782 +#include <linux/types.h>
8783 +#include <linux/kernel.h>
8784 +#include <linux/file.h>
8785 +#include <linux/mm.h>
8786 +#include <abi/svr4sig.h>
8787 +#include <abi/solaris.h>
8789 +int sol_llseek(struct pt_regs * regs)
8792 + unsigned long offset_high, offset_low;
8795 + unsigned int rvalue;
8796 + mm_segment_t old_fs;
8797 + struct inode *inode;
8798 + struct file *file;
8799 + get_user(fd, ((unsigned int *)regs->esp)+1);
8800 + get_user(offset_low, ((unsigned long *)regs->esp)+2);
8801 + get_user(offset_high, ((unsigned long *)regs->esp)+3);
8802 + get_user(origin, ((unsigned int *)regs->esp)+4);
8804 + old_fs = get_fs();
8806 + rvalue = SYS(_llseek)(fd,offset_high,offset_low,&res,origin);
8809 + if ( rvalue < -ENOIOCTLCMD) {
8810 + regs->edx = (res >> 32);
8811 + rvalue = (res & 0xffffffff);
8813 + else if (rvalue == -ESPIPE) {
8814 + /* Solaris allows you to seek on a pipe */
8817 + inode = file->f_dentry->d_inode;
8818 + if (inode && (S_ISCHR(inode->i_mode)
8819 + || S_ISBLK(inode->i_mode))) {
8830 +int ibcs_memcntl(unsigned addr, unsigned len, int cmd, unsigned arg,
8831 + int attr, int mask)
8833 + // printk("ibcs_memcntl being ignored\n");
8837 +int sol_acl(char *pathp, int cmd, int nentries, void *aclbufp)
8853 diff -uNr --exclude-from=dontdiff linux-2.4.3/abi/svr4/Makefile linux/abi/svr4/Makefile
8854 --- linux-2.4.3/abi/svr4/Makefile Thu Jan 1 01:00:00 1970
8855 +++ linux/abi/svr4/Makefile Mon Mar 12 16:34:48 2001
8858 +# Makefile for the kernel ABI code which is shared by iBCS, Solaris and UW7
8859 +# Loosely speaking, this is the SVR4 code - so that's the name it's got.
8862 +O_TARGET := dummy.o
8864 +objs := isc.o isc_funcs.o vtkbd.o xnx.o
8865 +export-objs := funcs.o hrtsys.o ioctl.o ipc.o mmap.o open.o poll.o ptrace.o \
8866 + svr4.o sysconf.o sysfs.o sysinfo.o sysi86.o syslocal.o \
8867 + ulimit.o utsname.o stream.o timod.o xnx_funcs.o xstat.o
8868 +list-multi := abi-svr4.o
8869 +abi-svr4-objs := $(objs) $(export-objs)
8871 +ifeq ($(CONFIG_ABI_IBCS_SCO),y)
8872 +abi-svr4-objs += sco_secureware.o
8874 +ifeq ($(CONFIG_ABI_IBCS_WYSE),y)
8875 +abi-svr4-objs += wyse_nfs.o wyse_tcp.o
8879 +obj-$(CONFIG_ABI_SVR4) += abi-svr4.o
8882 +include $(TOPDIR)/Rules.make
8884 +abi-svr4.o: $(abi-svr4-objs)
8885 + $(LD) -r -o $@ $(abi-svr4-objs)
8886 diff -uNr --exclude-from=dontdiff linux-2.4.3/abi/svr4/funcs.c linux/abi/svr4/funcs.c
8887 --- linux-2.4.3/abi/svr4/funcs.c Thu Jan 1 01:00:00 1970
8888 +++ linux/abi/svr4/funcs.c Sun Mar 18 17:28:55 2001
8891 + * funcs.c - iBCS syscall dispatch table
8895 +#include <linux/kernel.h>
8896 +#include <linux/module.h>
8897 +#include <linux/init.h>
8898 +#include <abi/abi.h>
8899 +#include <abi/signal.h>
8900 +#include <abi/svr4.h>
8901 +#include <abi/abi4.h>
8903 +#ifdef CONFIG_ABI_IBCS_SCO
8904 +MODULE_PARM(sco_serial, "1-10s");
8905 +MODULE_PARM_DESC(sco_serial, "SCO Serial Number");
8908 +extern void iBCS_class_XNX(struct pt_regs *regs);
8909 +extern void iBCS_class_ISC(struct pt_regs *regs);
8911 +#ifdef CONFIG_ABI_IBCS_WYSE
8912 +extern void iBCS_class_WYSETCP(struct pt_regs *regs);
8913 +extern void iBCS_class_WYSENFS(struct pt_regs *regs);
8917 +static char type_svr4_to_linux_seg1[] = {
8925 +struct map_segment svr4_socktype_map[] = {
8926 + /* 1 to 6 are remapped as indicated. Nothing else is valid. */
8927 + { 1, 6, type_svr4_to_linux_seg1 },
8931 +EXPORT_SYMBOL(svr4_socktype_map);
8933 +/* Map Linux RESTART* values (512,513,514) to EINTR */
8934 +static unsigned char LNX_err_table[] = {
8935 + EINTR, EINTR, EINTR
8940 + * Default Linux to iBCS mapping.
8941 + * We could remove some of the long identity mapped runs but at the
8942 + * expense of extra comparisons for each mapping at run time...
8944 +static unsigned char SVR4_err_table[] = {
8945 + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
8946 + 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
8947 + 32, 33, 34, 45, 78, 46, 89, 93, 90, 90, 35, 36, 37, 38, 39, 40,
8948 + 41, 42, 43, 44, 50, 51, 52, 53, 54, 55, 56, 57, 60, 61, 62, 63,
8949 + 64, 65, 66, 67, 68, 69, 70, 71, 74, 76, 77, 79, 80, 81, 82, 83,
8950 + 84, 85, 86, 87, 88, 91, 92, 94, 95, 96, 97, 98, 99,120,121,122,
8951 + 123,124,125,126,127,128,129,130,131,132,133,134,143,144,145,146,
8952 + 147,148,149,150, 22,135,137,138,139,140, 28
8956 +/* SVR4 (aka the full official iBCS) is the base mapping - no exceptions,
8957 + * other than the RESTART* values.
8959 +struct map_segment svr4_err_map[] = {
8960 + { 0, 0+sizeof(SVR4_err_table)-1, SVR4_err_table },
8961 + { 512, 512+sizeof(LNX_err_table)-1, LNX_err_table },
8965 +EXPORT_SYMBOL(svr4_err_map);
8967 +ABI_func svr4_generic_funcs[] = {
8968 + { abi_syscall, Fast ITR(0, "syscall", "") }, /* 0 */
8969 + { SC(exit), -1 ITR(0, "exit", "d") }, /* 1 */
8970 + { abi_fork, Spl ITR(0, "fork", "") }, /* 2 */
8971 + { abi_read, 3 ITR(0, "read", "dpd") }, /* 3 */
8972 + { SC(write), -3 ITR(0, "write", "dpd") }, /* 4 */
8973 + { svr4_open, 3 ITR(0, "open", "soo") }, /* 5 */
8974 + { SC(close), -1 ITR(0, "close", "d") }, /* 6 */
8975 + { abi_wait, Spl ITR(0, "wait", "xxx") }, /* 7 */
8976 + { SC(creat), -2 ITR(0, "creat", "so") }, /* 8 */
8977 + { SC(link), -2 ITR(0, "link", "ss") }, /* 9 */
8978 + { SC(unlink), -1 ITR(0, "unlink", "s") }, /* 10 */
8979 + { abi_exec, Spl ITR(0, "exec", "sxx") }, /* 11 */
8980 + { SC(chdir), -1 ITR(0, "chdir", "s") }, /* 12 */
8981 + { abi_time, 0 ITR(0, "time", "") }, /* 13 */
8982 + { abi_mknod, 3 ITR(0, "mknod", "soo") }, /* 14 */
8983 + { SC(chmod), -2 ITR(0, "chmod", "so") }, /* 15 */
8984 + { SC(chown), -3 ITR(0, "chown", "sdd") }, /* 16 */
8985 + { abi_brk, 1 ITR(0, "brk/break", "x") }, /* 17 */
8986 + { abi_stat, 2 ITR(0, "stat", "sp") }, /* 18 */
8987 + { abi_lseek, 3 ITR(0, "seek/lseek", "ddd") }, /* 19 */
8988 + { abi_getpid, Spl ITR(0, "getpid", "") }, /* 20 */
8989 + { 0, Ukn ITR(1, "mount", "") }, /* 21 */
8990 + { SC(umount), -1 ITR(0, "umount", "s") }, /* 22 */
8991 + { SC(setuid), -1 ITR(0, "setuid", "d") }, /* 23 */
8992 + { abi_getuid, Spl ITR(0, "getuid", "") }, /* 24 */
8993 + { SC(stime), -1 ITR(0, "stime", "d") }, /* 25 */
8994 + { svr4_ptrace, 4 ITR(0, "ptrace", "xdxx") }, /* 26 */
8995 + { SC(alarm), -1 ITR(0, "alarm", "d") }, /* 27 */
8996 + { abi_fstat, 2 ITR(0, "fstat", "dp") }, /* 28 */
8997 + { SC(pause), -ZERO ITR(0, "pause", "") }, /* 29 */
8998 + { SC(utime), -2 ITR(0, "utime", "xx") }, /* 30 */
8999 + { 0, Ukn ITR(0, "stty", "") }, /* 31 */
9000 + { 0, Ukn ITR(1, "gtty", "") }, /* 32 */
9001 + { SC(access), -2 ITR(0, "access", "so") }, /* 33 */
9002 + { SC(nice), -1 ITR(0, "nice", "d") }, /* 34 */
9003 + { svr4_statfs, 4 ITR(0, "statfs", "spdd") }, /* 35 */
9004 + { SC(sync), -ZERO ITR(0, "sync", "") }, /* 36 */
9005 + { abi_kill, 2 ITR(0, "kill", "dd") }, /* 37 */
9006 + { svr4_fstatfs, 4 ITR(0, "fstatfs", "dpdd") }, /* 38 */
9007 + { abi_procids, Spl ITR(0, "ibcs_procids", "d") }, /* 39 */
9008 + { iBCS_class_XNX, Fast ITR(0, "cxenix", "") }, /* 40 */
9009 + { SC(dup), -1 ITR(0, "dup", "d") }, /* 41 */
9010 + { abi_pipe, Spl ITR(0, "pipe", "") }, /* 42 */
9011 + { SC(times), -1 ITR(0, "times", "p") }, /* 43 */
9012 + { SC(profil), -4 ITR(0, "prof", "xxxx")}, /* 44 */
9013 + { 0, Ukn ITR(1, "lock/plock", "") }, /* 45 */
9014 + { SC(setgid), -1 ITR(0, "setgid", "d") }, /* 46 */
9015 + { abi_getgid, Spl ITR(0, "getgid", "") }, /* 47 */
9016 + { abi_sigfunc, Fast ITR(0, "sigfunc", "xxx") }, /* 48 */
9017 + { svr4_msgsys, Spl ITR(0, "msgsys", "dxddd")}, /* 49 */
9018 + { svr4_sysi86, Spl ITR(0, "sysi86/sys3b", "d") }, /* 50 */
9019 + { SC(acct), -1 ITR(0, "acct/sysacct", "x") }, /* 51 */
9020 + { svr4_shmsys, Fast ITR(0, "shmsys", "ddxo")}, /* 52 */
9021 + { svr4_semsys, Spl ITR(0, "semsys", "dddx")}, /* 53 */
9022 + { svr4_ioctl, Spl ITR(0, "ioctl", "dxx") }, /* 54 */
9023 + { 0, 3 ITR(0, "uadmin", "xxx") }, /* 55 */
9024 + { 0, Ukn ITR(1, "?", "") }, /* 56 */
9025 + { v7_utsname, 1 ITR(0, "utsys", "x") }, /* 57 */
9026 + { SC(fsync), -1 ITR(0, "fsync", "d") }, /* 58 */
9027 + { abi_exec, Spl ITR(0, "execv", "spp") }, /* 59 */
9028 + { SC(umask), -1 ITR(0, "umask", "o") }, /* 60 */
9029 + { SC(chroot), -1 ITR(0, "chroot", "s") }, /* 61 */
9030 + { svr4_fcntl, Spl ITR(0, "fcntl", "dxx") }, /* 62 */
9031 + { svr4_ulimit, 2 ITR(0, "ulimit", "xx") }, /* 63 */
9032 + { 0, Ukn ITR(1, "?", "") }, /* 64 */
9033 + { 0, Ukn ITR(1, "?", "") }, /* 65 */
9034 + { 0, Ukn ITR(1, "?", "") }, /* 66 */
9035 + { 0, Ukn ITR(1, "?", "") }, /* 67 */
9036 + { 0, Ukn ITR(1, "?", "") }, /* 68 */
9037 + { 0, Ukn ITR(1, "?", "") }, /* 69 */
9038 + { 0, Ukn ITR(1, "advfs", "") }, /* 70 */
9039 + { 0, Ukn ITR(1, "unadvfs", "") }, /* 71 */
9040 + { 0, Ukn ITR(1, "rmount", "") }, /* 72 */
9041 + { 0, Ukn ITR(1, "rumount", "") }, /* 73 */
9042 + { 0, Ukn ITR(1, "rfstart", "") }, /* 74 */
9043 + { 0, Ukn ITR(1, "?", "") }, /* 75 */
9044 + { 0, Ukn ITR(1, "rdebug", "") }, /* 76 */
9045 + { 0, Ukn ITR(1, "rfstop", "") }, /* 77 */
9046 + { 0, Ukn ITR(1, "rfsys", "") }, /* 78 */
9047 + { SC(rmdir), -1 ITR(0, "rmdir", "s") }, /* 79 */
9048 + { abi_mkdir, 2 ITR(0, "mkdir", "so") }, /* 80 */
9049 + { svr4_getdents, 3 ITR(0, "getdents", "dxd") }, /* 81 */
9050 + { 0, Ukn ITR(1, "libattach", "") }, /* 82 */
9051 + { 0, Ukn ITR(1, "libdetach", "") }, /* 83 */
9052 + { svr4_sysfs, 3 ITR(0, "sysfs", "dxx") }, /* 84 */
9053 + { svr4_getmsg, Spl ITR(0, "getmsg", "dxxx") }, /* 85 */
9054 + { svr4_putmsg, Spl ITR(0, "putmsg", "dxxd") }, /* 86 */
9055 + { svr4_poll, 3 ITR(0, "poll", "xdd") }, /* 87 */
9056 + { abi_lstat, 2 ITR(0, "lstat", "sp") }, /* 88 */
9057 + { SC(symlink), -2 ITR(0, "symlink", "ss") }, /* 89 */
9058 + { SC(readlink), -3 ITR(0, "readlink", "spd") }, /* 90 */
9059 + { 0, Ukn ITR(0, "svr4_setgroups","dp") }, /* 91 */
9060 + { 0, Ukn ITR(0, "svr4_getgroups","dp") }, /* 92 */
9061 + { SC(fchmod), -2 ITR(0, "fchmod", "do") }, /* 93 */
9062 + { SC(fchown), -3 ITR(0, "fchown", "ddd") }, /* 94 */
9063 + { abi_sigprocmask, 3 ITR(0, "sigprocmask", "dxx") }, /* 95 */
9064 + { abi_sigsuspend, Spl ITR(0, "sigsuspend", "x") }, /* 96 */
9065 + { 0, 2 ITR(1, "sigaltstack", "xx") }, /* 97 */
9066 + { abi_sigaction, 3 ITR(0, "sigaction", "dxx") }, /* 98 */
9067 + { svr4_sigpending, 2 ITR(1, "sigpending", "dp") }, /* 99 */
9068 + { svr4_context, Spl ITR(0, "context", "") }, /* 100 */
9069 + { 0, Ukn ITR(1, "evsys", "") }, /* 101 */
9070 + { 0, Ukn ITR(1, "evtrapret", "") }, /* 102 */
9071 + { abi_statvfs, 2 ITR(0, "statvfs", "sp") }, /* 103 */
9072 + { abi_statvfs, 2 ITR(0, "fstatvfs", "dp") }, /* 104 */
9073 + { iBCS_class_ISC, Fast ITR(0, "sysisc", "") }, /* 105 */
9074 + { 0, Ukn ITR(1, "nfssys", "") }, /* 106 */
9075 + { 0, 4 ITR(0, "waitid", "ddxd") }, /* 107 */
9076 + { 0, 3 ITR(1, "sigsendsys", "ddd") }, /* 108 */
9077 + { svr4_hrtsys, Spl ITR(0, "hrtsys", "xxx") }, /* 109 */
9078 + { 0, 3 ITR(1, "acancel", "dxd") }, /* 110 */
9079 + { 0, Ukn ITR(1, "async", "") }, /* 111 */
9080 + { 0, Ukn ITR(1, "priocntlsys", "") }, /* 112 */
9081 + { svr4_pathconf, 2 ITR(1, "pathconf", "sd") }, /* 113 */
9082 + { 0, 3 ITR(1, "mincore", "xdx") }, /* 114 */
9083 + { svr4_mmap, 6 ITR(0, "mmap", "xxxxdx") },/* 115 */
9084 + { SC(mprotect), -3 ITR(0, "mprotect", "xdx") },/* 116 */
9085 + { SC(munmap), -2 ITR(0, "munmap", "xd") },/* 117 */
9086 + { svr4_fpathconf, 2 ITR(1, "fpathconf", "dd") }, /* 118 */
9087 + { abi_fork, Spl ITR(0, "vfork", "") }, /* 119 */
9088 + { SC(fchdir), -1 ITR(0, "fchdir", "d") }, /* 120 */
9089 + { SC(readv), -3 ITR(0, "readv", "dxd") }, /* 121 */
9090 + { SC(writev), -3 ITR(0, "writev", "dxd") }, /* 122 */
9091 + { svr4_xstat, 3 ITR(0, "xstat", "dsx") }, /* 123 */
9092 + { svr4_lxstat, 3 ITR(0, "lxstat", "dsx") }, /* 124 */
9093 + { svr4_fxstat, 3 ITR(0, "fxstat", "ddx") }, /* 125 */
9094 + { svr4_xmknod, 4 ITR(0, "xmknod", "dsox")}, /* 126 */
9095 + { svr4_syslocal, Spl ITR(0, "syslocal", "d") }, /* 127 */
9096 + { svr4_getrlimit, 2 ITR(0, "setrlimit", "dx") }, /* 128 */
9097 + { svr4_setrlimit, 2 ITR(0, "getrlimit", "dx") }, /* 129 */
9098 + { 0, 3 ITR(1, "lchown", "sdd") }, /* 130 */
9099 + { 0, Ukn ITR(1, "memcntl", "") }, /* 131 */
9100 +#ifdef CONFIG_ABI_XTI
9101 + { svr4_getpmsg, 5 ITR(0, "getpmsg", "dxxxx")}, /* 132 */
9102 + { svr4_putpmsg, 5 ITR(0, "putpmsg", "dxxdd")}, /* 133 */
9104 + { 0, 5 ITR(0, "getpmsg", "dxxxx")}, /* 132 */
9105 + { 0, 5 ITR(0, "putpmsg", "dxxdd")}, /* 133 */
9107 + { SC(rename), -2 ITR(0, "rename", "ss") }, /* 134 */
9108 + { abi_utsname, 1 ITR(0, "uname", "x") }, /* 135 */
9109 + { svr4_setegid, 1 ITR(1, "setegid", "d") }, /* 136 */
9110 + { svr4_sysconfig, 1 ITR(0, "sysconfig", "d") }, /* 137 */
9111 + { 0, Ukn ITR(1, "adjtime", "") }, /* 138 */
9112 + { svr4_sysinfo, 3 ITR(0, "systeminfo", "dsd") }, /* 139 */
9113 + { socksys_syscall, 1 ITR(0, "socksys_syscall","x") }, /* 140 */
9114 + { svr4_seteuid, 1 ITR(1, "seteuid", "d") }, /* 141 */
9117 +EXPORT_SYMBOL(svr4_generic_funcs);
9120 +static ABI_func iBCS_funcs[] = {
9121 + { 0, Ukn ITR(1, "?", "") }, /* 142 */
9122 + { 0, Ukn ITR(1, "?", "") }, /* 143 */
9123 + { 0, 2 ITR(1, "secsys", "dx") }, /* 144 */
9124 + { 0, 4 ITR(1, "filepriv", "sdxd") }, /* 145 */
9125 + { 0, 3 ITR(1, "procpriv", "dxd") }, /* 146 */
9126 + { 0, 3 ITR(1, "devstat", "sdx") }, /* 147 */
9127 + { 0, 5 ITR(1, "aclipc", "ddddx")}, /* 148 */
9128 + { 0, 3 ITR(1, "fdevstat", "ddx") }, /* 149 */
9129 + { 0, 3 ITR(1, "flvlfile", "ddx") }, /* 150 */
9130 + { 0, 3 ITR(1, "lvlfile", "sdx") }, /* 151 */
9131 + { 0, Ukn ITR(1, "?", "") }, /* 152 */
9132 + { 0, 2 ITR(1, "lvlequal", "xx") }, /* 153 */
9133 + { 0, 2 ITR(1, "lvlproc", "dx") }, /* 154 */
9134 + { 0, Ukn ITR(1, "?", "") }, /* 155 */
9135 + { 0, 4 ITR(1, "lvlipc", "dddx") }, /* 156 */
9136 + { 0, 4 ITR(1, "acl", "sddx") }, /* 157 */
9137 + { 0, Ukn ITR(1, "auditevt", "") }, /* 158 */
9138 + { 0, Ukn ITR(1, "auditctl", "") }, /* 159 */
9139 + { 0, Ukn ITR(1, "auditdmp", "") }, /* 160 */
9140 + { 0, Ukn ITR(1, "auditlog", "") }, /* 161 */
9141 + { 0, Ukn ITR(1, "auditbuf", "") }, /* 162 */
9142 + { 0, 2 ITR(1, "lvldom", "xx") }, /* 163 */
9143 + { 0, Ukn ITR(1, "lvlvfs", "") }, /* 164 */
9144 + { 0, 2 ITR(1, "mkmld", "so") }, /* 165 */
9145 + { 0, Ukn ITR(1, "mlddone", "") }, /* 166 */
9146 + { 0, 2 ITR(0, "secadvise", "xx") }, /* 167 */
9147 + { 0, Ukn ITR(1, "online", "") }, /* 168 */
9148 + { SC(setitimer), -3 ITR(0, "setitimer", "dxx") }, /* 169 */
9149 + { SC(getitimer), -2 ITR(0, "getitimer", "dx") }, /* 170 */
9150 + { SC(gettimeofday), -2 ITR(0, "gettimeofday", "xx") }, /* 171 */
9151 + { SC(settimeofday), -2 ITR(0, "settimeofday", "xx") }, /* 172 */
9152 + { 0, Ukn ITR(1, "lwpcreate", "") }, /* 173 */
9153 + { 0, Ukn ITR(1, "lwpexit", "") }, /* 174 */
9154 + { 0, Ukn ITR(1, "lwpwait", "") }, /* 175 */
9155 + { 0, Ukn ITR(1, "lwpself", "") }, /* 176 */
9156 + { 0, Ukn ITR(1, "lwpinfo", "") }, /* 177 */
9157 + { 0, Ukn ITR(1, "lwpprivate", "") }, /* 178 */
9158 + { 0, Ukn ITR(1, "processorbind", "") }, /* 179 */
9159 + { 0, Ukn ITR(1, "processorexbind","") }, /* 180 */
9160 + { 0, Ukn ITR(1, "", "") }, /* 181 */
9161 + { 0, Ukn ITR(1, "sync_mailbox", "") }, /* 182 */
9162 + { 0, Ukn ITR(1, "prepblock", "") }, /* 183 */
9163 + { 0, Ukn ITR(1, "block", "") }, /* 184 */
9164 + { 0, Ukn ITR(1, "rdblock", "") }, /* 185 */
9165 + { 0, Ukn ITR(1, "unblock", "") }, /* 186 */
9166 + { 0, Ukn ITR(1, "cancelblock", "") }, /* 187 */
9167 + { 0, Ukn ITR(1, "?", "") }, /* 188 */
9168 + { 0, Ukn ITR(1, "pread", "") }, /* 189 */
9169 + { 0, Ukn ITR(1, "pwrite", "") }, /* 190 */
9170 + { SC(truncate), -2 ITR(0, "truncate", "sd") }, /* 191 */
9171 + { SC(ftruncate), -2 ITR(0, "ftruncate", "dd") }, /* 192 */
9172 + { 0, Ukn ITR(1, "lwpkill", "") }, /* 193 */
9173 + { 0, Ukn ITR(1, "sigwait", "") }, /* 194 */
9174 + { 0, Ukn ITR(1, "fork1", "") }, /* 195 */
9175 + { 0, Ukn ITR(1, "forkall", "") }, /* 196 */
9176 + { 0, Ukn ITR(1, "modload", "") }, /* 197 */
9177 + { 0, Ukn ITR(1, "moduload", "") }, /* 198 */
9178 + { 0, Ukn ITR(1, "modpath", "") }, /* 199 */
9179 + { 0, Ukn ITR(1, "modstat", "") }, /* 200 */
9180 + { 0, Ukn ITR(1, "modadm", "") }, /* 201 */
9181 + { 0, Ukn ITR(1, "getksym", "") }, /* 202 */
9182 + { 0, Ukn ITR(1, "lwpsuspend", "") }, /* 203 */
9183 + { 0, Ukn ITR(1, "lwpcontinue", "") }, /* 204 */
9184 + { 0, Ukn ITR(1, "?", "") }, /* 205 */
9185 + { 0, Ukn ITR(1, "?", "") }, /* 206 */
9186 + { 0, Ukn ITR(1, "?", "") }, /* 207 */
9187 + { 0, Ukn ITR(1, "?", "") },
9188 + { 0, Ukn ITR(1, "?", "") },
9189 + { 0, Ukn ITR(1, "?", "") },
9190 + { 0, Ukn ITR(1, "?", "") },
9191 + { 0, Ukn ITR(1, "?", "") },
9192 + { 0, Ukn ITR(1, "?", "") },
9193 +#ifdef CONFIG_ABI_IBCS_WYSE
9194 + { iBCS_class_WYSETCP,Fast ITR(1, "?", "") },
9196 + { 0, Fast ITR(1, "?", "") },
9198 + { 0, Ukn ITR(1, "?", "") }
9201 +#ifdef CONFIG_ABI_IBCS_SCO
9202 +static ABI_func SCO_funcs[] = {
9203 + { 0, Ukn ITR(1, "?", "") }, /* 88 */
9204 + { sw_security, 6 ITR(0, "security", "dxxxxx")},/* 89 */
9205 + { SC(symlink), -2 ITR(0, "symlink", "ss") }, /* 90 */
9206 + { abi_lstat, 2 ITR(0, "lstat", "sp") }, /* 91 */
9207 + { SC(readlink), -3 ITR(0, "readlink", "spd") }, /* 92 */
9208 + { 0, Ukn ITR(1, "?", "") }, /* 93 */
9209 + { 0, Ukn ITR(1, "?", "") }, /* 94 */
9210 + { 0, Ukn ITR(1, "?", "") } /* 95 */
9214 +#ifdef CONFIG_ABI_IBCS_WYSE
9215 +static ABI_func WYSE_funcs[] = {
9216 + { abi_lstat, 2 ITR(0, "lstat", "sp") }, /* 128 */
9217 + { SC(readlink), -3 ITR(0, "readlink", "spd") }, /* 129 */
9218 + { SC(symlink), -2 ITR(0, "symlink", "ss") }, /* 130 */
9219 + { iBCS_class_WYSETCP,Fast ITR(0, "?", "") }, /* 131 */
9220 + { iBCS_class_WYSENFS,Fast ITR(0, "?", "") }, /* 132 */
9221 + { abi_gethostname, 2 ITR(0, "gethostname", "xd") }, /* 133 */
9222 + { SC(sethostname), -2 ITR(0, "sethostname", "sd") }, /* 134 */
9223 + { abi_getdomainname,2 ITR(0, "getdomainname","xd") }, /* 135 */
9224 + { SC(setdomainname), -2 ITR(0, "setdomainname","sd") }, /* 136 */
9225 + { 0, Ukn ITR(1, "?", "") }, /* 137 */
9226 + { SC(setreuid), -2 ITR(0, "setreuid", "dd") }, /* 138 */
9227 + { SC(setregid), -2 ITR(0, "setregid", "dd") }, /* 139 */
9228 + { 0, Ukn ITR(1, "?", "") }, /* 140 */
9229 + { 0, Ukn ITR(1, "?", "") }, /* 141 */
9230 + { 0, Ukn ITR(1, "?", "") }, /* 142 */
9231 + { 0, Ukn ITR(1, "?", "") } /* 143 */
9236 +iBCS_lcall7(int segment, struct pt_regs * regs)
9238 + int i = regs->eax & 0xff;
9241 + if (segment == 0x27) {
9242 + printk(KERN_ERR "solaris binary slipped into svr4 handler, exiting\n");
9246 +#ifdef CONFIG_ABI_IBCS_WYSE
9247 + if (i < 0x88 && i > 0x77 && current->personality == PER_WYSEV386)
9248 + p = &WYSE_funcs[i - 0x78];
9251 +#ifdef CONFIG_ABI_IBCS_SCO
9252 + if (i < 0x60 && i > 0x57 && current->personality == PER_SCOSVR3)
9253 + p = &SCO_funcs[i - 0x58];
9257 + p = &svr4_generic_funcs[i];
9259 + p = &iBCS_funcs[i - 142];
9261 + abi_dispatch(regs, p, 1);
9264 +extern struct map_segment svr4_err_map[];
9265 +extern struct map_segment svr4_socktype_map[];
9266 +extern struct map_segment abi_sockopt_map[];
9267 +extern struct map_segment abi_af_map[];
9270 +long linux_to_ibcs_signals[NSIGNALS+1] = {
9272 + IBCS_SIGHUP, IBCS_SIGINT, IBCS_SIGQUIT, IBCS_SIGILL,
9273 + IBCS_SIGTRAP, IBCS_SIGABRT, -1, IBCS_SIGFPE,
9274 + IBCS_SIGKILL, IBCS_SIGUSR1, IBCS_SIGSEGV, IBCS_SIGUSR2,
9275 + IBCS_SIGPIPE, IBCS_SIGALRM, IBCS_SIGTERM, IBCS_SIGSEGV,
9276 + IBCS_SIGCHLD, IBCS_SIGCONT, IBCS_SIGSTOP, IBCS_SIGTSTP,
9277 + IBCS_SIGTTIN, IBCS_SIGTTOU, IBCS_SIGURG, IBCS_SIGGXCPU,
9278 + IBCS_SIGGXFSZ, IBCS_SIGVTALRM, IBCS_SIGPROF, IBCS_SIGWINCH,
9279 + IBCS_SIGIO, IBCS_SIGPWR, -1, -1
9282 +long ibcs_to_linux_signals[NSIGNALS+1] = {
9284 + SIGHUP, SIGINT, SIGQUIT, SIGILL,
9285 + SIGTRAP, SIGIOT, SIGUNUSED, SIGFPE,
9286 + SIGKILL, SIGUNUSED, SIGSEGV, SIGUNUSED,
9287 + SIGPIPE, SIGALRM, SIGTERM, SIGUSR1,
9288 + SIGUSR2, SIGCHLD, SIGPWR, SIGWINCH,
9289 + SIGURG, SIGPOLL, SIGSTOP, SIGTSTP,
9290 + SIGCONT, SIGTTIN, SIGTTOU, SIGVTALRM,
9291 + SIGPROF, SIGXCPU, SIGXFSZ, -1
9294 +EXPORT_SYMBOL(linux_to_ibcs_signals);
9295 +EXPORT_SYMBOL(ibcs_to_linux_signals);
9297 +#ifdef CONFIG_ABI_IBCS_SCO
9298 +static long linux_to_sco_signals[NSIGNALS+1] = {
9300 + IBCS_SIGHUP, IBCS_SIGINT, IBCS_SIGQUIT, IBCS_SIGILL,
9301 + IBCS_SIGTRAP, IBCS_SIGABRT, -1, IBCS_SIGFPE,
9302 + IBCS_SIGKILL, IBCS_SIGUSR1, IBCS_SIGSEGV, IBCS_SIGUSR2,
9303 + IBCS_SIGPIPE, IBCS_SIGALRM, IBCS_SIGTERM, IBCS_SIGSEGV,
9304 + IBCS_SIGCHLD, IBCS_SIGCONT, IBCS_SIGSTOP, IBCS_SIGTSTP,
9305 + IBCS_SIGTTIN, IBCS_SIGTTOU, IBCS_SIGUSR1, IBCS_SIGGXCPU,
9306 + IBCS_SIGGXFSZ, IBCS_SIGVTALRM, IBCS_SIGPROF, IBCS_SIGWINCH,
9307 + IBCS_SIGIO, IBCS_SIGPWR, -1, -1
9310 +static long sco_to_linux_signals[NSIGNALS+1] = {
9312 + SIGHUP, SIGINT, SIGQUIT, SIGILL,
9313 + SIGTRAP, SIGIOT, SIGUNUSED, SIGFPE,
9314 + SIGKILL, SIGUNUSED, SIGSEGV, SIGUNUSED,
9315 + SIGPIPE, SIGALRM, SIGTERM, SIGURG,
9316 + SIGUSR2, SIGCHLD, SIGPWR, SIGWINCH,
9317 + SIGUNUSED, SIGPOLL, SIGSTOP, SIGTSTP,
9318 + SIGCONT, SIGTTIN, SIGTTOU, SIGVTALRM,
9319 + SIGPROF, SIGXCPU, SIGXFSZ, -1
9323 +extern long linux_to_ibcs_signals[];
9324 +extern long ibcs_to_linux_signals[];
9327 +#ifdef CONFIG_ABI_IBCS_ISC
9328 +static long linux_to_isc_signals[NSIGNALS+1] = {
9330 + IBCS_SIGHUP, IBCS_SIGINT, IBCS_SIGQUIT, IBCS_SIGILL,
9331 + IBCS_SIGTRAP, IBCS_SIGABRT, -1, IBCS_SIGFPE,
9332 + IBCS_SIGKILL, IBCS_SIGUSR1, IBCS_SIGSEGV, IBCS_SIGUSR2,
9333 + IBCS_SIGPIPE, IBCS_SIGALRM, IBCS_SIGTERM, IBCS_SIGSEGV,
9334 + IBCS_SIGCHLD, ISC_SIGCONT, ISC_SIGSTOP, ISC_SIGTSTP,
9335 + IBCS_SIGTTIN, IBCS_SIGTTOU, IBCS_SIGUSR1, IBCS_SIGGXCPU,
9336 + IBCS_SIGGXFSZ, IBCS_SIGVTALRM, IBCS_SIGPROF, IBCS_SIGWINCH,
9337 + IBCS_SIGIO, IBCS_SIGPWR, -1, -1
9340 +static long isc_to_linux_signals[NSIGNALS+1] = {
9342 + SIGHUP, SIGINT, SIGQUIT, SIGILL,
9343 + SIGTRAP, SIGIOT, SIGUNUSED, SIGFPE,
9344 + SIGKILL, SIGUNUSED, SIGSEGV, SIGUNUSED,
9345 + SIGPIPE, SIGALRM, SIGTERM, SIGUSR1,
9346 + SIGUSR2, SIGCHLD, SIGPWR, SIGWINCH,
9347 + -1, SIGPOLL, SIGCONT, SIGSTOP,
9348 + SIGTSTP, SIGTTIN, SIGTTOU, SIGVTALRM,
9349 + SIGPROF, SIGXCPU, SIGXFSZ, -1
9351 +#endif /* CONFIG_ABI_IBCS_ISC */
9353 +#ifdef CONFIG_ABI_XENIX
9354 +static long linux_to_xnx_signals[NSIGNALS+1] = {
9356 + IBCS_SIGHUP, IBCS_SIGINT, IBCS_SIGQUIT, IBCS_SIGILL,
9357 + IBCS_SIGTRAP, IBCS_SIGABRT, -1, IBCS_SIGFPE,
9358 + IBCS_SIGKILL, IBCS_SIGUSR1, IBCS_SIGSEGV, IBCS_SIGUSR2,
9359 + IBCS_SIGPIPE, IBCS_SIGALRM, IBCS_SIGTERM, IBCS_SIGSEGV,
9360 + IBCS_SIGCHLD, IBCS_SIGCONT, IBCS_SIGSTOP, IBCS_SIGTSTP,
9361 + IBCS_SIGTTIN, IBCS_SIGTTOU, IBCS_SIGUSR1, IBCS_SIGGXCPU,
9362 + IBCS_SIGGXFSZ, IBCS_SIGVTALRM, IBCS_SIGPROF, IBCS_SIGWINCH,
9363 + 20 /*XNX_SIGIO*/, IBCS_SIGPWR, -1, -1
9366 +static long xnx_to_linux_signals[NSIGNALS+1] = {
9368 + SIGHUP, SIGINT, SIGQUIT, SIGILL,
9369 + SIGTRAP, SIGIOT, SIGUNUSED, SIGFPE,
9370 + SIGKILL, SIGUNUSED, SIGSEGV, SIGUNUSED,
9371 + SIGPIPE, SIGALRM, SIGTERM, SIGUSR1,
9372 + SIGUSR2, SIGCHLD, SIGPWR, SIGPOLL,
9379 +struct exec_domain ibcs_exec_domain = {
9381 + handler: iBCS_lcall7,
9382 + pers_low: 1 /* PER_SVR4 */,
9383 + pers_high: 2 /* PER_SVR3 */,
9384 + signal_map: ibcs_to_linux_signals,
9385 + signal_invmap: linux_to_ibcs_signals,
9386 + err_map: svr4_err_map,
9387 + socktype_map: svr4_socktype_map,
9388 + sockopt_map: abi_sockopt_map,
9389 + af_map: abi_af_map,
9390 + module: THIS_MODULE
9393 +#ifdef CONFIG_ABI_IBCS_SCO
9394 +struct exec_domain sco_exec_domain = {
9395 + name: "OpenServer",
9396 + handler: iBCS_lcall7,
9397 + pers_low: 3 /* PER_SCOSVR3 */,
9398 + pers_high: 3 /* PER_SCOSVR3 */,
9399 + signal_map: sco_to_linux_signals,
9400 + signal_invmap: linux_to_sco_signals,
9401 + err_map: svr4_err_map,
9402 + socktype_map: svr4_socktype_map,
9403 + sockopt_map: abi_sockopt_map,
9404 + af_map: abi_af_map,
9405 + module: THIS_MODULE
9409 +#ifdef CONFIG_ABI_IBCS_XENIX
9410 +struct exec_domain xnx_exec_domain = {
9412 + handler: iBCS_lcall7,
9413 + pers_low: 7 /* PER_XENIX */,
9414 + pers_high: 7 /* PER_XENIX */,
9415 + signal_map: xnx_to_linux_signals,
9416 + signal_invmap: linux_to_xnx_signals,
9417 + err_map: svr4_err_map,
9418 + socktype_map: svr4_socktype_map,
9419 + sockopt_map: abi_sockopt_map,
9420 + af_map: abi_af_map,
9421 + module: THIS_MODULE
9425 +#ifdef CONFIG_ABI_IBCS_ISC
9426 +struct exec_domain isc_exec_domain = {
9428 + handler: iBCS_lcall7,
9429 + pers_low: 5 /* PER_ISCR4 */,
9430 + pers_high: 5 /* PER_ISCR4 */,
9431 + signal_map: isc_to_linux_signals,
9432 + signal_invmap: linux_to_isc_signals,
9433 + err_map: svr4_err_map,
9434 + socktype_map: svr4_socktype_map,
9435 + sockopt_map: abi_sockopt_map,
9436 + af_map: abi_af_map,
9437 + module: THIS_MODULE
9446 +#ifdef CONFIG_ABI_IBCS_ISC
9447 + unregister_exec_domain(&isc_exec_domain);
9449 +#ifdef CONFIG_ABI_IBCS_XENIX
9450 + unregister_exec_domain(&xnx_exec_domain);
9452 +#ifdef CONFIG_ABI_IBCS_SCO
9453 + unregister_exec_domain(&sco_exec_domain);
9455 + unregister_exec_domain(&ibcs_exec_domain);
9462 + register_exec_domain(&ibcs_exec_domain);
9463 +#ifdef CONFIG_ABI_IBCS_SCO
9464 + register_exec_domain(&sco_exec_domain);
9466 +#ifdef CONFIG_ABI_IBCS_XENIX
9467 + register_exec_domain(&xnx_exec_domain);
9469 +#ifdef CONFIG_ABI_IBCS_ISC
9470 + register_exec_domain(&isc_exec_domain);
9475 +module_init(ibcs_init);
9476 +module_exit(ibcs_cleanup);
9477 diff -uNr --exclude-from=dontdiff linux-2.4.3/abi/svr4/hrtsys.c linux/abi/svr4/hrtsys.c
9478 --- linux-2.4.3/abi/svr4/hrtsys.c Thu Jan 1 01:00:00 1970
9479 +++ linux/abi/svr4/hrtsys.c Mon Mar 12 16:34:48 2001
9483 + * This file contins the emulated SVR4 hrtsys interface
9485 + * Copyright (C) 1994 Eric Youngdale.
9487 + * The hrtsys interface is used by SVR4, and is effectively a way of doing
9488 + * itimer. I do not know why this is used instead of the regular itimer
9489 + * stuff, but it appears to be related to bsd programs/functionality.
9493 +#include <linux/config.h>
9494 +#include <linux/module.h>
9496 +#include <asm/uaccess.h>
9498 +#include <linux/ptrace.h>
9499 +#include <linux/errno.h>
9500 +#include <linux/mm.h>
9501 +#include <linux/string.h>
9503 +#include <abi/abi.h>
9504 +#include <abi/trace.h>
9507 +struct hrt_time_t {
9508 + unsigned long secs;
9509 + unsigned long sub_sec; /* Less than one second. */
9510 + unsigned long resolution; /* Resolution of timer */
9516 + struct hrt_time_t interval;
9517 + struct hrt_time_t tod;
9524 +ibcs_hrtcntl (struct pt_regs * regs)
9526 + unsigned int param[4];
9527 + struct timeval * tv;
9530 + for (i=0; i<4; i++)
9531 + param[i] = get_syscall_parameter (regs, 1+i);
9533 + if (param[0] != 1 || param[1] != 1 || param[2] != 0)
9536 + tv = (struct timeval *) param[3];
9538 + abi_trace(ABI_TRACE_API, "hrtcntl(0x%lx)\n", (u_long)tv);
9540 + error = verify_area(VERIFY_WRITE, (char *) tv,sizeof *tv);
9544 + return SYS(gettimeofday)(tv, NULL);
9548 +ibcs_hrtalarm (struct pt_regs * regs)
9550 + struct itimerval get_buffer;
9551 + struct hrtcmd * hcmd;
9552 + int i, error, cmd, retval, which;
9553 + mm_segment_t old_fs = get_fs();
9555 + i = get_syscall_parameter (regs, 2);
9559 + hcmd = (struct hrtcmd *) get_syscall_parameter (regs, 1);
9561 + error = verify_area (VERIFY_WRITE, (char *) hcmd,sizeof *hcmd);
9565 + get_user (cmd, ((unsigned long *) hcmd));
9567 + /* Now figure out which clock we want to fiddle with */
9568 + get_user (which, ((unsigned long *) hcmd)+1);
9570 + abi_trace(ABI_TRACE_API, "%d hrtalarm(0x%lx %d)",
9571 + (u_long)cmd, which);
9589 + if(({long r; get_user(r, ((unsigned long *) hcmd)+4); r;}) != 1000000)
9591 + copy_from_user(&get_buffer.it_value, ((unsigned long *) hcmd)+2,
9592 + sizeof(struct timeval));
9593 + memset(&get_buffer.it_interval, 0, sizeof(struct timeval));
9595 + retval = SYS(setitimer)(which, &get_buffer, NULL);
9600 + retval = SYS(getitimer)(which, &get_buffer);
9603 + abi_trace(ABI_TRACE_API, "hrtalarm(d %lx) %lx %lx %lx %lx",
9605 + get_buffer.it_interval.tv_sec,
9606 + get_buffer.it_interval.tv_usec,
9607 + get_buffer.it_value.tv_sec,
9608 + get_buffer.it_value.tv_usec);
9610 + put_user(1000000, &hcmd->interval.resolution);
9611 + copy_to_user(((unsigned long *) hcmd)+2, &get_buffer.it_interval,
9612 + sizeof(get_buffer));
9616 + if(({long r; get_user(r, ((unsigned long *) hcmd)+4); r;}) != 1000000)
9618 + if(({long r; get_user(r, ((unsigned long *) hcmd)+7); r;}) != 1000000)
9620 + copy_from_user(&get_buffer.it_value, &hcmd->tod,
9621 + sizeof(struct timeval));
9622 + copy_from_user(&get_buffer.it_interval, &hcmd->interval,
9623 + sizeof(struct timeval));
9625 + retval = SYS(setitimer)(which, &get_buffer, NULL);
9629 + memset(&get_buffer, 0, sizeof(get_buffer));
9631 + retval = SYS(setitimer)(which, &get_buffer, NULL);
9642 +svr4_hrtsys (struct pt_regs * regs)
9646 + func = get_syscall_parameter (regs, 0);
9648 + abi_trace(ABI_TRACE_API, "hrtsys(%d)", func);
9652 + retval = ibcs_hrtcntl(regs);
9655 + retval = ibcs_hrtalarm(regs);
9666 +EXPORT_SYMBOL(svr4_hrtsys);
9667 diff -uNr --exclude-from=dontdiff linux-2.4.3/abi/svr4/ioctl.c linux/abi/svr4/ioctl.c
9668 --- linux-2.4.3/abi/svr4/ioctl.c Thu Jan 1 01:00:00 1970
9669 +++ linux/abi/svr4/ioctl.c Sun Mar 18 11:54:28 2001
9673 + * This file contains a SYSV compatibe ioctl(2) implementation
9675 + * Copyright (C) 1991, 1992 Linus Torvalds
9677 + * Written by Drew Sullivan.
9678 + * Rewritten by Mike Jagdis.
9682 +#include <linux/config.h>
9683 +#include <linux/module.h>
9684 +#include <linux/version.h>
9686 +#include <asm/uaccess.h>
9688 +#include <linux/errno.h>
9689 +#include <linux/stat.h>
9690 +#include <linux/fs.h>
9691 +#include <linux/sched.h>
9692 +#include <linux/kernel.h>
9693 +#include <linux/termios.h>
9694 +#include <linux/mtio.h>
9695 +#include <linux/time.h>
9696 +#include <linux/sockios.h>
9697 +#include <linux/mm.h>
9698 +#include <linux/file.h>
9699 +#include <linux/slab.h>
9701 +#include <abi/abi.h>
9702 +#include <abi/bsd.h>
9703 +#include <abi/stream.h>
9704 +#include <abi/tli.h>
9705 +#include <abi/svr4.h>
9706 +#include <abi/trace.h>
9709 +#ifdef CONFIG_ABI_IBCS_SCO
9710 +static int sco_ioctl_tape(int fd, unsigned int func, unsigned long arg);
9712 +static int bsd_ioctl_file(int fd, unsigned int func, void *arg);
9713 +static int ibcs_ioctl_tape(int fd, unsigned int func, unsigned long arg);
9714 +static int ibcs_ioctl_termios(int fd, unsigned int func, void *arg);
9715 +static int ibcs_ioctl_termio(int fd, unsigned int func, void *arg);
9716 +extern int abi_ioctl_console(int fd, unsigned int func, void *arg);
9717 +extern int abi_ioctl_video(int fd, unsigned int func, void *arg);
9719 +/* do_ioctl() is a meta mapper, that is
9720 + it looks up the class of the ioctl and then
9721 + dispatchs to lower level routines to handle the
9722 + mapping of the actual ioctls
9726 +do_ioctl(struct pt_regs *regs, int fd, unsigned long ioctl_num, void *arg)
9728 + unsigned int class = ioctl_num >> 8;
9729 + char class_str[4];
9732 + case 0: /* SCO ioctls on the pseudo NFS device probably. */
9733 + return abi_ioctl_socksys(fd, ioctl_num, arg);
9735 + case 'A': /* ??? SCO console keyboard stuff? */
9738 +#ifdef CONFIG_ABI_IBCS_SCO
9740 + return sco_ioctl_tape(fd, ioctl_num, (unsigned long)arg);
9743 + if (personality(PER_SVR4))
9744 + return ibcs_ioctl_tape(fd, ioctl_num, (unsigned long)arg);
9746 + return bsd_ioctl_termios(fd, ioctl_num, arg);
9749 + return bsd_ioctl_file(fd, ioctl_num, arg);
9751 + case 'T': /* xenix ioctl compatibility */
9752 + return ibcs_ioctl_termio(fd, ioctl_num & 0xFF, arg);
9754 + case ('i' << 16) | ('X' << 8): /* iBCS2 POSIX */
9755 + case 'x': /* Pre-iBCS2 POSIX */
9756 + return ibcs_ioctl_termios(fd, ioctl_num & 0xFF, arg);
9760 + return abi_ioctl_console(fd, ioctl_num, arg);
9762 + case ('i' << 16) | ('C' << 8): /* iBCS2 POSIX */
9763 + return abi_ioctl_video(fd, ioctl_num & 0xFF, arg);
9765 + /* SCO 3.2.2 uses ('X'<<8)|1 for access to the video map
9766 + * and the 'X' set is also used for synchronous comm
9767 + * lines (I think?). SVR4 uses it for tty extensions to
9768 + * support hardware flow control and external clocks.
9771 + if (personality(PER_SVR4) || personality(PER_SOLARIS))
9772 + return svr4_ioctl_termiox(fd, ioctl_num & 0xFF, arg);
9775 + /* These aren't implemented and are never likely to be as they
9776 + * are specific to drivers for obscure hardware. (For those
9777 + * that don't know they're the JERQ ioctls. Says it all
9783 + /* The 'S' set could also be display mode switch
9784 + * ioctls in a SCO 3.2.x x<4 environment. It should
9785 + * depend on the descriptor they are applied to.
9786 + * According to ISC the Xenix STREAMS ioctls had the
9787 + * high bit set on the command to differentiate them
9788 + * from mode switch ioctls. Yuk, yuk, yuk...
9791 + return svr4_ioctl_stream(regs, fd, ioctl_num & 0x7F, arg);
9793 + /* These are STREAMS socket module ioctls. */
9795 +#if defined(CONFIG_ABI_XTI)
9796 + return svr4_ioctl_sockmod(fd, ioctl_num & 0xFF, arg);
9801 + /* These are SCO <vtkd.h> ioctls - see vtkd.h */
9804 + return ibcs_ioctl_vtkd(fd, ioctl_num, arg);
9806 + /* EUC ioctls. These are something to do with chararcter
9807 + * code set conversions in SVR4. If we don't support
9808 + * them the correct thing to do is to return EINVAL.
9813 + /* SCO channel mapping. I can't find any documentation
9814 + * for this. These are the LD?MAP ioctls defined in
9815 + * sys/termio.h and sys/emap.h. They are used by mapchan.
9821 + /* If we haven't handled it yet it must be a BSD style ioctl
9822 + * with a (possible) argument description in the high word of
9825 + switch (class & 0xff) {
9826 + /* From SVR4 as specified in sys/iocomm.h */
9828 + return bsd_ioctl_file(fd, ioctl_num, arg);
9830 + /* BSD or V7 terminal ioctls. */
9832 + return bsd_ioctl_termios(fd, ioctl_num, arg);
9834 + /* "Traditional" BSD and Wyse V/386 3.2.1A TCP/IP ioctls. */
9838 + return abi_ioctl_socksys(fd, ioctl_num, arg);
9840 + /* SVR3 streams based socket TCP/IP ioctls.
9841 + * These are handed over to the standard ioctl
9842 + * handler since /dev/socksys is an emulated device
9843 + * and front ends any sockets created through it.
9844 + * Note that 'S' ioctls without the BSDish argument
9845 + * type in the high bytes are STREAMS ioctls and 'I'
9846 + * ioctls without the BSDish type in the high bytes
9847 + * are the STREAMS socket module ioctls. (see above).
9852 + return abi_ioctl_socksys(fd, ioctl_num, arg);
9855 + /* If nothing has handled it yet someone may have to do some
9858 + class_str[0] = class & 0xFF0000 ? (char)((class >> 16) & 0xFF) : '.';
9859 + class_str[1] = class & 0x00FF00 ? (char)((class >> 8) & 0xFF) : '.';
9860 + class_str[2] = class & 0x0000FF ? (char)((class ) & 0xFF) : '.';
9863 + printk(KERN_ERR "iBCS: ioctl(%d, %lx[%s], 0x%lx) unsupported\n",
9864 + fd, ioctl_num, class_str, (unsigned long)arg);
9870 +/* Some of these are used by SVR3/4 too... */
9871 +static int bsd_ioctl_file(int fd, unsigned int func, void *arg)
9874 + case BSD__IOV('f', 1): case BSD__IO('f', 1): /* FIOCLEX */
9875 + FD_SET(fd, current->files->close_on_exec);
9878 + case BSD__IOV('f', 2): case BSD__IO('f', 2): /* FIONCLEX */
9879 + FD_CLR(fd, current->files->close_on_exec);
9882 + case BSD__IOV('f', 3): case BSD__IO('f', 3): { /* FIORDCHK */
9883 + int error, nbytes;
9884 + mm_segment_t old_fs;
9886 + old_fs = get_fs();
9887 + set_fs (get_ds());
9888 + error = SYS(ioctl)(fd, FIONREAD, &nbytes);
9891 + return (error <= 0 ? error : nbytes);
9894 + case BSD__IOW('f', 123, int): /* FGETOWN */
9895 + return SYS(ioctl)(fd, FIOGETOWN, arg);
9897 + case BSD__IOW('f', 124, int): /* FSETOWN */
9898 + return SYS(ioctl)(fd, FIOSETOWN, arg);
9900 + case BSD__IOW('f', 125, int): /* FIOASYNC */
9901 + return SYS(ioctl)(fd, FIOASYNC, arg);
9903 + case BSD__IOW('f', 126, int): /* FIONBIO */
9904 + return SYS(ioctl)(fd, FIONBIO, arg);
9906 + case BSD__IOR('f', 127, int): /* FIONREAD */
9907 + return SYS(ioctl)(fd, FIONREAD, arg);
9910 + printk(KERN_ERR "iBCS: file ioctl 0x%08lx unsupported\n",
9911 + (unsigned long)func);
9915 +static int svr_to_linux_termio(int fd, int op, struct svr_termio *it)
9918 + mm_segment_t old_fs;
9920 + unsigned short lflag;
9923 + error = verify_area(VERIFY_READ, it, sizeof(struct svr_termio));
9927 + old_fs = get_fs();
9929 + error = SYS(ioctl)(fd, TCGETA, &t);
9934 + /* Save things we may need later. */
9936 + lflag = t.c_lflag;
9938 + /* Copy the entire structure then fix up as necessary. */
9939 + copy_from_user(&t, it, sizeof(struct svr_termio));
9941 + /* If ICANON isn't set then we've been given VMIN in place
9944 + if (!(t.c_lflag & 0000002)) {
9945 + t.c_cc[6] = t.c_cc[4];
9949 + if (t.c_cflag & 0100000) /* CRTSFL - SCO only? */
9950 + t.c_cflag |= CRTSCTS;
9951 + t.c_cflag &= ~0170000; /* LOBLK|CTSFLOW|RTSFLOW|CRTSFL */
9954 + error = SYS(ioctl)(fd, op, &t);
9960 +static int linux_to_svr_termio(int fd, struct svr_termio *it)
9963 + mm_segment_t old_fs;
9966 + error = verify_area(VERIFY_WRITE, it, sizeof(struct svr_termio));
9970 + old_fs = get_fs();
9972 + error = SYS(ioctl)(fd, TCGETA, &t);
9977 + /* If ICANON isn't set then we substitute VEOF with VMIN. */
9978 + if (!(t.c_lflag & 0000002)) {
9979 + t.c_cc[4] = t.c_cc[6];
9982 + /* Copy to the user supplied structure. */
9983 + copy_to_user(it, &t, sizeof(struct svr_termio));
9989 +#ifdef CONFIG_ABI_IBCS_SCO
9990 +#define SCO_NCCS (SVR_NCC+5)
9991 +struct sco_termios {
9992 + unsigned short c_iflag;
9993 + unsigned short c_oflag;
9994 + unsigned short c_cflag;
9995 + unsigned short c_lflag;
9997 + unsigned char c_cc[SCO_NCCS];
10001 +static int sco_to_linux_termios(int fd, int op, struct sco_termios *it)
10003 + struct termios t;
10004 + mm_segment_t old_fs;
10005 + unsigned short lflag, r;
10006 + char sco_cc[SCO_NCCS];
10009 + error = verify_area(VERIFY_READ, it, sizeof(struct sco_termios));
10013 + old_fs = get_fs();
10014 + set_fs(get_ds());
10015 + error = SYS(ioctl)(fd, TCGETS, &t);
10020 + __get_user(t.c_iflag, &it->c_iflag);
10021 + t.c_iflag &= ~0100000; /* DOSMODE */
10023 + __get_user(t.c_oflag, &it->c_oflag);
10025 + __get_user(t.c_cflag, &it->c_cflag);
10026 + if (t.c_cflag & 0100000) /* CRTSFL - SCO only? */
10027 + t.c_cflag |= CRTSCTS;
10028 + t.c_cflag &= ~0170000; /* LOBLK|CTSFLOW|RTSFLOW|CRTSFL */
10030 + lflag = t.c_lflag;
10031 + t.c_lflag &= ~0100777;
10032 + __get_user(r, &it->c_lflag);
10034 + if ((t.c_lflag & 0100000))
10035 + SYS(ioctl)(fd, TIOCEXCL, 0);
10037 + SYS(ioctl)(fd, TIOCNXCL, 0);
10038 + t.c_lflag &= ~0100000;
10039 + t.c_lflag |= (t.c_lflag & 0000400) << 7; /* Move IEXTEN */
10040 + t.c_lflag &= ~0000400;
10041 + t.c_lflag |= (t.c_lflag & 0001000) >> 1; /* Move TOSTOP */
10042 + t.c_lflag &= ~0001000;
10043 + t.c_lflag |= (lflag & 0001000); /* Restore ECHOCTL */
10045 + __get_user(t.c_line, &it->c_line); /* XXX Map this? */
10047 + copy_from_user(sco_cc, &it->c_cc, SCO_NCCS);
10048 + t.c_cc[0] = sco_cc[0];
10049 + t.c_cc[1] = sco_cc[1];
10050 + t.c_cc[2] = sco_cc[2];
10051 + t.c_cc[3] = sco_cc[3];
10052 + t.c_cc[7] = sco_cc[7];
10053 + t.c_cc[8] = sco_cc[11];
10054 + t.c_cc[9] = sco_cc[12];
10055 + t.c_cc[10] = sco_cc[10];
10056 + t.c_cc[16] = sco_cc[6];
10057 + if (t.c_lflag & ICANON) {
10058 + t.c_cc[4] = sco_cc[4];
10059 + t.c_cc[11] = sco_cc[5];
10061 + t.c_cc[4] = sco_cc[8];
10062 + t.c_cc[5] = sco_cc[5];
10063 + t.c_cc[6] = sco_cc[4];
10064 + t.c_cc[11] = sco_cc[9];
10067 + set_fs(get_ds());
10068 + error = SYS(ioctl)(fd, op, &t);
10074 +static int linux_to_sco_termios(int fd, int op, struct sco_termios *it)
10076 + struct termios t;
10077 + char sco_cc[SCO_NCCS];
10078 + mm_segment_t old_fs;
10081 + error = verify_area(VERIFY_WRITE, it, sizeof(struct sco_termios));
10085 + old_fs = get_fs();
10086 + set_fs(get_ds());
10087 + error = SYS(ioctl)(fd, op, &t);
10092 + put_user(t.c_iflag & 0017777, &it->c_iflag);
10094 + put_user(t.c_oflag & 0177777, &it->c_oflag);
10096 + if (t.c_cflag & CRTSCTS)
10097 + t.c_cflag |= 0100000; /* CRTSFL - SCO only? */
10098 + put_user(t.c_cflag & 0177777, &it->c_cflag);
10100 + t.c_lflag &= ~0001000;
10101 + t.c_lflag |= (t.c_lflag & 0000400) << 1;
10102 + t.c_lflag &= ~0000400;
10103 + t.c_lflag |= (t.c_lflag & 0100000) >> 7;
10104 + t.c_lflag &= ~0100000;
10105 + put_user(t.c_lflag & 0001777, &it->c_lflag);
10107 + put_user(t.c_line, &it->c_line); /* XXX Map this? */
10109 + sco_cc[0] = t.c_cc[0];
10110 + sco_cc[1] = t.c_cc[1];
10111 + sco_cc[2] = t.c_cc[2];
10112 + sco_cc[3] = t.c_cc[3];
10113 + sco_cc[6] = t.c_cc[16];
10114 + sco_cc[7] = t.c_cc[7];
10115 + sco_cc[8] = t.c_cc[4];
10116 + sco_cc[9] = t.c_cc[11];
10117 + sco_cc[10] = t.c_cc[10];
10118 + sco_cc[11] = t.c_cc[8];
10119 + sco_cc[12] = t.c_cc[9];
10120 + if (t.c_lflag & ICANON) {
10121 + sco_cc[4] = t.c_cc[4];
10122 + sco_cc[5] = t.c_cc[11];
10124 + sco_cc[4] = t.c_cc[6];
10125 + sco_cc[5] = t.c_cc[5];
10128 + copy_to_user(&it->c_cc, sco_cc, SCO_NCCS);
10132 +#endif /* CONFIG_ABI_IBCS_SCO */
10135 +/* XXX This is just copied from SCO above. There are minor differences
10136 + * but not in any of the critical flags and non of them overlap - I think.
10139 +static int svr4_to_linux_termios(int fd, int op, struct svr4_termios *it)
10141 + struct termios t;
10142 + mm_segment_t old_fs;
10143 + unsigned short lflag, r;
10144 + char svr4_cc[SVR4_NCCS];
10147 + error = verify_area(VERIFY_READ, it, sizeof(struct svr4_termios));
10151 + old_fs = get_fs();
10152 + set_fs(get_ds());
10153 + error = SYS(ioctl)(fd, TCGETS, &t);
10158 + __get_user(t.c_iflag, &it->c_iflag);
10159 + t.c_iflag &= ~0100000; /* DOSMODE */
10161 + __get_user(t.c_oflag, &it->c_oflag);
10163 + __get_user(t.c_cflag, &it->c_cflag);
10164 + if (t.c_cflag & 0100000) /* CRTSFL - SCO only? */
10165 + t.c_cflag |= CRTSCTS;
10166 + t.c_cflag &= ~0170000; /* LOBLK|CTSFLOW|RTSFLOW|CRTSFL */
10168 + lflag = t.c_lflag;
10169 + t.c_lflag &= ~0100777;
10170 + __get_user(r, &it->c_lflag);
10172 + if ((t.c_lflag & 0100000))
10173 + SYS(ioctl)(fd, TIOCEXCL, 0);
10175 + SYS(ioctl)(fd, TIOCNXCL, 0);
10176 + t.c_lflag &= ~0100000;
10177 + t.c_lflag |= (t.c_lflag & 0000400) << 7; /* Move IEXTEN */
10178 + t.c_lflag &= ~0000400;
10179 + t.c_lflag |= (t.c_lflag & 0001000) >> 1; /* Move TOSTOP */
10180 + t.c_lflag &= ~0001000;
10181 + t.c_lflag |= (lflag & 0001000); /* Restore ECHOCTL */
10183 + copy_from_user(svr4_cc, &it->c_cc, SVR4_NCCS);
10184 + t.c_cc[0] = svr4_cc[0];
10185 + t.c_cc[1] = svr4_cc[1];
10186 + t.c_cc[2] = svr4_cc[2];
10187 + t.c_cc[3] = svr4_cc[3];
10188 + t.c_cc[7] = svr4_cc[7];
10189 + t.c_cc[8] = svr4_cc[8];
10190 + t.c_cc[9] = svr4_cc[9];
10191 + t.c_cc[10] = svr4_cc[10];
10192 + t.c_cc[12] = svr4_cc[12];
10193 + t.c_cc[13] = svr4_cc[13];
10194 + t.c_cc[14] = svr4_cc[14];
10195 + t.c_cc[15] = svr4_cc[15];
10196 + t.c_cc[16] = svr4_cc[16];
10197 + if (t.c_lflag & ICANON) {
10198 + t.c_cc[4] = svr4_cc[4];
10199 + t.c_cc[11] = svr4_cc[5];
10201 + t.c_cc[5] = svr4_cc[5];
10202 + t.c_cc[6] = svr4_cc[4];
10203 + t.c_cc[11] = svr4_cc[6];
10206 + set_fs(get_ds());
10207 + error = SYS(ioctl)(fd, op, &t);
10213 +static int linux_to_svr4_termios(int fd, int op, struct svr4_termios *it)
10215 + struct termios t;
10216 + char svr4_cc[SVR4_NCCS];
10217 + mm_segment_t old_fs;
10220 + error = verify_area(VERIFY_WRITE, it, sizeof(struct svr4_termios));
10224 + old_fs = get_fs();
10225 + set_fs(get_ds());
10226 + error = SYS(ioctl)(fd, op, &t);
10231 + put_user(t.c_iflag & 0017777, &it->c_iflag);
10233 + put_user(t.c_oflag & 0177777, &it->c_oflag);
10235 + if (t.c_cflag & CRTSCTS)
10236 + t.c_cflag |= 0100000; /* CRTSFL - SCO only? */
10237 + put_user(t.c_cflag & 0177777, &it->c_cflag);
10239 + t.c_lflag &= ~0001000;
10240 + t.c_lflag |= (t.c_lflag & 0000400) << 1;
10241 + t.c_lflag &= ~0000400;
10242 + t.c_lflag |= (t.c_lflag & 0100000) >> 7;
10243 + t.c_lflag &= ~0100000;
10244 + put_user(t.c_lflag & 0001777, &it->c_lflag);
10246 + svr4_cc[0] = t.c_cc[0];
10247 + svr4_cc[1] = t.c_cc[1];
10248 + svr4_cc[2] = t.c_cc[2];
10249 + svr4_cc[3] = t.c_cc[3];
10250 + svr4_cc[6] = t.c_cc[16];
10251 + svr4_cc[7] = t.c_cc[7];
10252 + svr4_cc[8] = t.c_cc[8];
10253 + svr4_cc[9] = t.c_cc[9];
10254 + svr4_cc[10] = t.c_cc[10];
10255 + svr4_cc[11] = t.c_cc[10];
10256 + svr4_cc[12] = t.c_cc[12];
10257 + svr4_cc[13] = t.c_cc[13];
10258 + svr4_cc[14] = t.c_cc[14];
10259 + svr4_cc[15] = t.c_cc[15];
10260 + if (t.c_lflag & ICANON) {
10261 + svr4_cc[4] = t.c_cc[4];
10262 + svr4_cc[5] = t.c_cc[11];
10264 + svr4_cc[4] = t.c_cc[6];
10265 + svr4_cc[5] = t.c_cc[5];
10268 + copy_to_user(&it->c_cc, svr4_cc, SVR4_NCCS);
10274 +static int ibcs_ioctl_termios(int fd, unsigned int func, void *arg)
10276 +#ifdef CONFIG_ABI_IBCS_SCO
10278 + case 1: /* XCGETA */
10279 + return linux_to_sco_termios(fd, TCGETS, arg);
10280 + case 2: /* XCSETA */
10281 + return sco_to_linux_termios(fd, TCSETS, arg);
10282 + case 3: /* XCSETAW */
10283 + return sco_to_linux_termios(fd, TCSETSW, arg);
10284 + case 4: /* XCSETAF */
10285 + return sco_to_linux_termios(fd, TCSETSF, arg);
10288 + printk(KERN_ERR "iBCS: SCO termios ioctl %d unsupported\n", func);
10292 +static int ibcs_ioctl_termio(int fd, unsigned int func, void *arg)
10295 + case 1: /* TCGETA (TIOC|1) */
10296 + return linux_to_svr_termio(fd, arg);
10298 + case 2: /* TCSETA (TIOC|2) */
10299 + return svr_to_linux_termio(fd, TCSETA, arg);
10300 + case 3: /* TCSETAW (TIOC|3) */
10301 + return svr_to_linux_termio(fd, TCSETAW, arg);
10302 + case 4: /* TCSETAF (TIOC|4) */
10303 + return svr_to_linux_termio(fd, TCSETAF, arg);
10305 + case 5: /* TCSBRK (TIOC|5) */
10306 + return SYS(ioctl)(fd, TCSBRK, arg);
10307 + case 6: /* TCXONC (TIOC|6) */
10308 + return SYS(ioctl)(fd, TCXONC, arg);
10309 + case 7: /* TCFLSH (TIOC|7) */
10310 + return SYS(ioctl)(fd, TCFLSH, arg);
10312 + /* This group appear in SVR4 but not SVR3 (SCO). */
10313 + case 8: /* TIOCKBON */
10314 + case 9: /* TIOCKBOF */
10315 + case 10: /* KBENABLED */
10318 + /* This set is used by SVR4 for termios ioctls. */
10319 + case 13: /* TCGETS */
10320 + return linux_to_svr4_termios(fd, TCGETS, arg);
10321 + case 14: /* TCSETS */
10322 + return svr4_to_linux_termios(fd, TCSETS, arg);
10323 + case 15: /* TCSETSW */
10324 + return svr4_to_linux_termios(fd, TCSETSW, arg);
10325 + case 16: /* TCSETSF */
10326 + return svr4_to_linux_termios(fd, TCSETSF, arg);
10328 + /* These two are specific to ISC. */
10329 + case 20: /* TCSETPGRP (TIOC|20) set pgrp of tty */
10330 + return SYS(ioctl)(fd, TIOCSPGRP, arg);
10331 + case 21: /* TCGETPGRP (TIOC|21) get pgrp of tty */
10332 + return SYS(ioctl)(fd, TIOCGPGRP, arg);
10334 + case 34: /* TCGETSC (TIOC|34) ioctl for scancodes */
10335 + return 0x04; /* Translates scancode to ascii */
10336 + case 35: /* TCSETSC (TIOC|35) ioctl for scancodes */
10339 + case 103: /* TIOCSWINSZ (TIOC|103) */
10340 + return SYS(ioctl)(fd, TIOCSWINSZ, arg);
10341 + case 104: /* TIOCGWINSZ (TIOC|104) */
10342 + return SYS(ioctl)(fd, TIOCGWINSZ, arg);
10344 + case 118: /* TIOCSPGRP (TIOC|118) set pgrp of tty */
10345 + return SYS(ioctl)(fd, TIOCSPGRP, arg);
10346 + case 119: /* TIOCGPGRP (TIOC|119) get pgrp of tty */
10347 + return SYS(ioctl)(fd, TIOCGPGRP, arg);
10349 + case 32: /* TCDSET (TIOC|32) */
10350 + case 33: /* RTS_TOG (TIOC|33) 386 - "RTS" toggle define 8A1 protocol */
10352 + case 120: /* TIOSETSAK (TIOC|120) set SAK sequence for tty */
10353 + case 121: /* TIOGETSAK (TIOC|121) get SAK sequence for tty */
10354 + printk(KERN_ERR "iBCS: termio ioctl %d unimplemented\n",
10358 + printk(KERN_ERR "iBCS: termio ioctl %d unsupported\n", func);
10363 + unsigned short x_hflag;
10364 + unsigned short x_cflag;
10365 + unsigned short x_rflag[5];
10366 + unsigned short x_sflag;
10369 +#define RTSXOFF 0x0001
10370 +#define CTSXON 0x0002
10372 +int svr4_ioctl_termiox(int fd, unsigned int func, void *arg)
10374 + struct termios t;
10375 + struct termiox tx;
10376 + mm_segment_t old_fs;
10379 + if (func < 1 || func > 4)
10382 + error = verify_area(func == 1 ? VERIFY_WRITE : VERIFY_READ,
10383 + arg, sizeof(struct termiox));
10387 + old_fs = get_fs();
10388 + set_fs(get_ds());
10389 + error = SYS(ioctl)(fd, TCGETS, &t);
10394 + if (func == 1) { /* TCGETX */
10395 + memset(&tx, '\0', sizeof(struct termiox));
10396 + if (t.c_cflag & CRTSCTS)
10397 + tx.x_hflag = RTSXOFF|CTSXON;
10398 + copy_to_user(arg, &tx, sizeof(struct termiox));
10402 + copy_from_user(&tx, arg, sizeof(struct termiox));
10403 + if ((tx.x_hflag != 0 && tx.x_hflag != (RTSXOFF|CTSXON))
10404 + || tx.x_cflag || tx.x_rflag[0] || tx.x_rflag[1]
10405 + || tx.x_rflag[2] || tx.x_rflag[3] || tx.x_rflag[4]
10410 + t.c_cflag |= CRTSCTS;
10412 + t.c_cflag &= (~CRTSCTS);
10414 + old_fs = get_fs();
10415 + set_fs(get_ds());
10417 + case 2: /* TCSETX */
10418 + error = SYS(ioctl)(fd, TCSETS, &t);
10420 + case 3: /* TCSETXW */
10421 + error = SYS(ioctl)(fd, TCSETSW, &t);
10423 + case 4: /* TCSETXF */
10424 + error = SYS(ioctl)(fd, TCSETSF, &t);
10430 +EXPORT_SYMBOL(svr4_ioctl_termiox);
10433 +int svr4_ioctl_stream(struct pt_regs *regs, int fd, unsigned int func, void *arg)
10435 + struct file *filep;
10436 + struct inode *ino;
10439 + filep = fget(fd);
10442 + ino = filep->f_dentry->d_inode;
10444 + if (ino && !ino->i_sock
10445 + && MAJOR(ino->i_rdev) == SOCKSYS_MAJOR) {
10446 + error = abi_socksys_fd_init(fd, 0, NULL, NULL);
10450 + filep = fget(fd);
10453 + ino = filep->f_dentry->d_inode;
10457 + case 001: /* I_NREAD */
10458 + error = verify_area(VERIFY_WRITE,
10459 + arg, sizeof(unsigned long));
10464 +#ifdef CONFIG_ABI_XTI
10465 + if (ino->i_sock && MAJOR(ino->i_rdev) == SOCKSYS_MAJOR)
10466 + timod_update_socket(fd, filep, regs);
10469 + && Priv(filep) && Priv(filep)->pfirst) {
10470 + put_user(Priv(filep)->pfirst->length,
10471 + (unsigned long *)arg);
10473 + return 1; /* at least 1... (FIXME) */
10477 + error = SYS(ioctl)(fd, TIOCINQ, arg);
10478 + if (error == -EINVAL)
10482 + __get_user(error, (unsigned long *)arg);
10483 + return (error == 0 ? 0 : 1);
10485 + case 017: { /* I_PEEK */
10486 +#ifdef CONFIG_ABI_XTI
10487 + struct strpeek buf;
10489 + error = verify_area(VERIFY_WRITE,
10490 + arg, sizeof(struct strpeek));
10495 + copy_from_user(&buf, arg, sizeof(buf));
10497 + if (ino->i_sock && MAJOR(ino->i_rdev) == SOCKSYS_MAJOR)
10498 + timod_update_socket(fd, filep, regs);
10501 + && Priv(filep) && Priv(filep)->pfirst
10502 + && (!buf.flags || buf.flags == Priv(filep)->pfirst->pri)) {
10503 + int l = buf.ctl.maxlen <= Priv(filep)->pfirst->length
10505 + : Priv(filep)->pfirst->length;
10506 + error = verify_area(VERIFY_WRITE,
10512 + copy_to_user(buf.ctl.buf,
10513 + ((char *)&Priv(filep)->pfirst->type)
10514 + + Priv(filep)->offset, l);
10515 + put_user(l, &((struct strpeek *)arg)->ctl.len);
10516 + if (buf.dat.maxlen >= 0)
10517 + put_user(0, &((struct strpeek *)arg)->dat.len);
10518 + put_user(Priv(filep)->pfirst->pri,
10519 + &((struct strpeek *)arg)->flags);
10523 + /* FIXME: I think we should also be able to peek
10524 + * at data as well?
10528 + return 0; /* Nothing to peek at. */
10535 + case 010: { /* I_STR */
10536 + /* Unpack the ioctl data and forward as a normal
10537 + * ioctl. Timeouts are not handled (yet?).
10539 + struct strioctl {
10540 + int cmd, timeout, len;
10544 + error = verify_area(VERIFY_READ,
10545 + arg, sizeof(struct strioctl));
10548 + copy_from_user(&it, arg, sizeof(struct strioctl));
10550 + abi_trace(ABI_TRACE_STREAMS,
10551 + "STREAMS I_STR ioctl(%d, 0x%08lx, 0x%08lx)",
10552 + fd, (u_long)it.cmd, (u_long)it.data);
10554 + switch (it.cmd >> 8) {
10555 + case 'T':/* timod */
10556 +#ifdef CONFIG_ABI_XTI
10557 + return timod_ioctl(regs,
10558 + fd, it.cmd & 0xff,
10560 + &((struct strioctl *)arg)->len);
10565 + return do_ioctl(regs, fd, it.cmd, it.data);
10569 + case 002: { /* I_PUSH */
10572 + /* Get the name anyway to validate it. */
10573 + tmp = getname(arg);
10575 + return PTR_ERR(tmp);
10577 + abi_trace(ABI_TRACE_STREAMS,
10578 + "%d STREAMS I_PUSH %s", fd, tmp);
10584 + case 003: /* I_POP */
10585 + abi_trace(ABI_TRACE_STREAMS, "%d STREAMS I_POP", fd);
10588 + case 005: /* I_FLUSH */
10591 + case 013: { /* I_FIND */
10594 + /* Get the name anyway to validate it. */
10595 + tmp = getname(arg);
10597 + return PTR_ERR(tmp);
10599 + abi_trace(ABI_TRACE_STREAMS,
10600 + "%d STREAMS I_FIND %s", fd, tmp);
10601 +#ifdef CONFIG_ABI_XTI
10602 + if (!strcmp(tmp, "timod")) {
10611 + /* FIXME: These are bogus. */
10612 + case 011: /* I_SETSIG */
10613 + return SYS(ioctl)(fd, FIOSETOWN, current->pid);
10614 + case 012: /* I_GETSIG */
10615 + return SYS(ioctl)(fd, FIOGETOWN, arg);
10617 + case 020: /* I_FDINSERT */
10618 +#ifdef CONFIG_ABI_XTI
10619 + return stream_fdinsert(regs, fd,
10620 + (struct strfdinsert *)arg);
10625 + case 004: /* I_LOOK */
10626 + case 006: /* I_SRDOPT */
10627 + case 007: /* I_GRDOPT */
10628 + case 014: /* I_LINK */
10629 + case 015: /* I_UNLINK */
10630 + case 021: /* I_SENDFD */
10631 + case 022: /* I_RECVFD */
10632 + case 023: /* I_SWROPT */
10633 + case 040: /* I_SETCLTIME */
10634 + return 0; /* Lie... */
10635 + case 042: /* I_CANPUT */
10636 + /* Arg is the priority band in question. We only
10637 + * support one priority band so arg must be 0.
10638 + * If the band is writable we should return 1, if
10639 + * the band is flow controlled we should return 0.
10644 + /* FIXME: How can we test if a write would block? */
10647 + case 024: /* I_GWROPT */
10648 + case 025: /* I_LIST */
10649 + case 026: /* I_PLINK */
10650 + case 027: /* I_PUNLINK */
10651 + case 030: /* I_SETEV */
10652 + case 031: /* I_GETEV */
10653 + case 032: /* I_STREV */
10654 + case 033: /* I_UNSTREV */
10655 + case 034: /* I_FLUSHBAND */
10656 + case 035: /* I_CKBAND */
10657 + case 036: /* I_GETBAND */
10658 + case 037: /* I_ATMARK */
10659 + case 041: /* I_GETCLTIME */
10660 + /* Unsupported - drop out. */
10662 + printk(KERN_ERR "iBCS: STREAMS ioctl 0%o unsupported\n", func);
10666 +EXPORT_SYMBOL(svr4_ioctl_stream);
10669 +#ifdef CONFIG_ABI_IBCS_SCO
10670 +static int sco_ioctl_tape(int fd, unsigned int func, unsigned long arg)
10672 + mm_segment_t old_fs;
10674 + struct mtop mtop;
10676 + mtop.mt_count = 1;
10678 + switch (func & 0xff) {
10679 + case 1: /* MT_RESET */
10680 + mtop.mt_op = MTRESET;
10683 + case 2: /* MT_RETEN */
10684 + mtop.mt_op = MTRETEN;
10687 + case 3: /* MT_REWIND */
10688 + mtop.mt_op = MTREW;
10691 + case 4: /* MT_ERASE */
10692 + case 23: /* HP_ERASE */
10693 + mtop.mt_op = MTERASE;
10696 + case 6: /* MT_RFM */
10697 + mtop.mt_op = MTFSF;
10700 + case 7: /* MT_WFM */
10701 + mtop.mt_op = MTWEOF;
10704 + case 8: /* MT_LOAD */
10705 + mtop.mt_op = MTLOAD;
10708 + case 9: /* MT_UNLOAD */
10709 + mtop.mt_op = MTOFFL;
10712 + case 19: /* MT_RSM */
10713 + mtop.mt_op = MTFSS;
10716 + case 20: /* MT_WSM */
10717 + mtop.mt_op = MTWSM;
10720 + case 21: /* MT_EOD */
10721 + mtop.mt_op = MTEOM;
10724 + case 24: /* MT_SETBLK */
10725 + mtop.mt_op = MTSETBLK;
10726 + mtop.mt_count = arg;
10729 + case 25: /* MT_LOCK */
10730 + mtop.mt_op = MTLOCK;
10733 + case 26: /* MT_UNLOCK */
10734 + mtop.mt_op = MTUNLOCK;
10739 +/* The following function codes are just copied from the SCO
10742 + case 0: /* MT_STATUS */
10743 + case 5: /* MT_AMOUNT */
10744 + case 10: /* MT_DSTATUS */
10745 + case 11: /* MT_FORMAT */
10746 + case 12: /* MT_GETHDR */
10747 + case 13: /* MT_PUTHDR */
10748 + case 14: /* MT_GETNEWBB */
10749 + case 15: /* MT_PUTNEWBB */
10750 + case 16: /* MT_GETVTBL */
10751 + case 17: /* MT_PUTVTBL */
10752 + case 18: /* MT_SERVO */
10753 + case 22: /* MT_FORMPART */
10754 + case 38: /* MT_SETANSI */
10755 + case 64: /* MT_REPORT */
10758 + printk (KERN_ERR "iBCS: SCO tape ioctl func=%d arg=%x unsupported\n",
10759 + func & 0xff, (int) arg);
10763 + old_fs = get_fs ();
10764 + set_fs (get_ds ());
10765 + error = SYS (ioctl) (fd, MTIOCTOP, &mtop);
10771 +static int ibcs_ioctl_tape(int fd, unsigned int func, unsigned long arg)
10773 + mm_segment_t old_fs;
10775 + struct mtop mtop;
10777 + mtop.mt_count = 1;
10779 + switch (func & 0xff) {
10780 + case 1: /* MT_RETEN */
10781 + mtop.mt_op = MTRETEN;
10784 + case 2: /* MT_REWIND */
10785 + mtop.mt_op = MTREW;
10788 + case 3: /* MT_ERASE */
10789 + mtop.mt_op = MTERASE;
10792 + case 4: /* MT_WFM */
10793 + mtop.mt_op = MTWEOF;
10796 + case 5: /* MT_RESET */
10797 + mtop.mt_op = MTRESET;
10800 + case 7: /* T_SFF */
10801 + mtop.mt_op = MTFSF;
10804 + case 8: /* T_SBF */
10805 + mtop.mt_op = MTBSF;
10808 + case 9: /* T_LOAD */
10809 + mtop.mt_op = MTLOAD;
10812 + case 10: /* MT_UNLOAD */
10813 + mtop.mt_op = MTOFFL;
10816 + case 15: /* T_WRBLKLEN */
10817 + mtop.mt_op = MTLOCK;
10818 + mtop.mt_count = arg;
10821 + case 16: /* T_PREVMV */
10822 + mtop.mt_op = MTLOCK;
10825 + case 17: /* T_ALLOMV */
10826 + mtop.mt_op = MTUNLOCK;
10829 + case 20: /* T_EOD */
10830 + mtop.mt_count = arg;
10831 + mtop.mt_op = MTEOM;
10834 + case 21: /* T_SSFB */
10835 + mtop.mt_count = arg;
10836 + mtop.mt_op = MTBSFM;
10839 + case 22: /* T_SSFF */
10840 + mtop.mt_count = arg;
10841 + mtop.mt_op = MTFSFM;
10844 + case 24: /* T_STD */
10845 + mtop.mt_count = arg;
10846 + mtop.mt_op = MTSETDENSITY;
10850 + case 6: /* T_STATUS */
10851 + case 14: /* T_RDBLKLEN */
10852 + case 18: /* T_SBB */
10853 + case 19: /* T_SFB */
10854 + case 23: /* T_STS */
10857 + printk (KERN_ERR "iBCS: SYSV tape ioctl func=%d arg=%x unsupported\n",
10858 + func & 0xff, (int) arg);
10862 + old_fs = get_fs ();
10863 + set_fs (get_ds ());
10864 + error = SYS (ioctl) (fd, MTIOCTOP, &mtop);
10870 +int svr4_ioctl(struct pt_regs * regs)
10873 + unsigned int ioctl_num;
10876 + fd = (int)get_syscall_parameter (regs, 0);
10877 + ioctl_num = (unsigned int)get_syscall_parameter (regs, 1);
10878 + arg = (void *)get_syscall_parameter (regs, 2);
10879 + return do_ioctl(regs, fd, ioctl_num, arg);
10882 +EXPORT_SYMBOL(svr4_ioctl);
10883 diff -uNr --exclude-from=dontdiff linux-2.4.3/abi/svr4/ipc.c linux/abi/svr4/ipc.c
10884 --- linux-2.4.3/abi/svr4/ipc.c Thu Jan 1 01:00:00 1970
10885 +++ linux/abi/svr4/ipc.c Fri Mar 30 15:23:46 2001
10889 + * Thiss file contains the emulated SYSV IPC impementation
10891 + * Copyright (C) 1994 Mike Jagdis (jaggy@purplet.demon.co.uk)
10893 + * Massive work over with a fine tooth comb, lots of rewriting. There
10894 + * were a *lot* of bugs in this - mismatched structs that weren't
10895 + * mapped, wrong pointers etc. I've tested this version with the
10896 + * demo programs from the Wyse V/386 IPC documentation which exercise
10897 + * all the functions. I don't have any major IPC using applications
10898 + * to test it with - as far as I know...
10900 + * Original copyright etc. follows:
10902 + * Copyright (C) 1993,1994 Joe Portman (baron@hebron.connected.com)
10903 + * First stab at ibcs shm, sem and msg handlers
10906 + * Please contact the author above before blindly making changes
10907 + * to this file. You will break things.
10909 + * 04-15-1994 JLP III
10910 + * Still no msgsys, but IPC_STAT now works for shm calls
10911 + * Corrected argument order for sys_ipc calls, to accomodate Mike's
10912 + * changes, so that we can just call sys_ipc instead of the internal
10913 + * sys_* calls for ipc functions.
10914 + * Cleaned up translation of perm structures
10915 + * tstshm for Oracle now works.
10917 + * 04-23-1994 JLP III
10918 + * Added in msgsys calls, Tested and working
10919 + * Added translation for IPC_SET portions of all xxxctl functions.
10920 + * Added SHM_LOCK and SHM_UNLOCK to shmsys
10922 + * 04-28-1994 JLP III
10923 + * Special thanks to Brad Pepers for adding in the GETALL and SETALL
10924 + * case of semaphores. (pepersb@cuug.ab.ca)
10928 +#include <linux/config.h>
10930 +#include <linux/module.h>
10932 +#include <asm/uaccess.h>
10934 +#include <linux/errno.h>
10935 +#include <linux/sched.h>
10936 +#include <linux/kernel.h>
10937 +#include <linux/mm.h>
10938 +#include <linux/stddef.h>
10939 +#include <linux/unistd.h>
10940 +#include <linux/ptrace.h>
10942 +#include <asm/system.h>
10943 +#include <linux/fs.h>
10944 +#include <linux/sys.h>
10945 +#include <asm/ipc.h>
10946 +#include <linux/ipc.h>
10947 +#include <linux/sem.h>
10948 +#include <linux/shm.h>
10949 +#include <linux/msg.h>
10950 +#include <linux/string.h>
10952 +#include <abi/abi.h>
10953 +#include <abi/trace.h>
10956 +struct ibcs_ipc_perm {
10957 + unsigned short uid; /* owner's user id */
10958 + unsigned short gid; /* owner's group id */
10959 + unsigned short cuid; /* creator's user id */
10960 + unsigned short cgid; /* creator's group id */
10961 + unsigned short mode; /* access modes */
10962 + unsigned short seq; /* slot usage sequence number */
10963 + long key; /* key */
10966 +struct ibcs_ipc_perm_l {
10967 + unsigned long uid; /* owner's user id */
10968 + unsigned long gid; /* owner's group id */
10969 + unsigned long cuid; /* creator's user id */
10970 + unsigned long cgid; /* creator's group id */
10971 + unsigned long mode; /* access modes */
10972 + unsigned long seq; /* slot usage sequence number */
10973 + long key; /* key */
10974 + void *ipc_secp; /* security structure pointer */
10975 + long pad[3]; /* reserved */
10978 +struct ibcs_semid_ds {
10979 + struct ibcs_ipc_perm sem_perm;
10980 + struct sem *sem_base;
10981 + unsigned short sem_nsems;
10983 + unsigned long sem_otime;
10984 + unsigned long sem_ctime;
10987 +struct ibcs_semid_ds_l {
10988 + struct ibcs_ipc_perm_l sem_perm;
10989 + struct sem *sem_base;
10990 + unsigned short sem_nsems;
10992 + unsigned long sem_otime;
10993 + unsigned long sem_pad1;
10994 + unsigned long sem_ctime;
10995 + unsigned long sem_pad2;
10996 + unsigned long sem_pad3[4];
10999 +struct ibcs_shmid_ds {
11000 + struct ibcs_ipc_perm shm_perm; /* operation permission struct */
11001 + int shm_segsz; /* size of segment in bytes */
11002 + struct region *__pad1; /* ptr to region structure */
11003 + char __pad2[4]; /* for swap compatibility */
11004 + ushort shm_lpid; /* pid of last shmop */
11005 + ushort shm_cpid; /* pid of creator */
11006 + unsigned short shm_nattch; /* used only for shminfo */
11007 + unsigned short __pad3;
11008 + time_t shm_atime; /* last shmat time */
11009 + time_t shm_dtime; /* last shmdt time */
11010 + time_t shm_ctime; /* last change time */
11013 +struct ibcs_shmid_ds_l {
11014 + struct ibcs_ipc_perm_l shm_perm;/* operation permission struct */
11015 + int shm_segsz; /* size of segment in bytes */
11016 + struct region *__pad1; /* ptr to region structure */
11017 + unsigned short shm_lckcnt; /* number of times it is being locked */
11018 + char __pad2[2]; /* for swap compatibility */
11019 + unsigned long shm_lpid; /* pid of last shmop */
11020 + unsigned long shm_cpid; /* pid of creator */
11021 + unsigned long shm_nattch; /* used only for shminfo */
11022 + unsigned long shm_cnattch;
11023 + unsigned long shm_atime; /* last shmat time */
11024 + unsigned long shm_pad1;
11025 + unsigned long shm_dtime; /* last shmdt time */
11026 + unsigned long shm_pad2;
11027 + unsigned long shm_ctime; /* last change time */
11028 + unsigned long shm_pad3;
11029 + unsigned long shm_pad4[4];
11032 +struct ibcs_msqid_ds {
11033 + struct ibcs_ipc_perm msg_perm;
11034 + struct msg *msg_first;
11035 + struct msg *msg_last;
11036 + ushort msg_cbytes;
11038 + ushort msg_qbytes;
11039 + ushort msg_lspid;
11040 + ushort msg_lrpid;
11041 + time_t msg_stime;
11042 + time_t msg_rtime;
11043 + time_t msg_ctime;
11046 +struct ibcs_msqid_ds_l {
11047 + struct ibcs_ipc_perm_l msg_perm;
11048 + struct msg *msg_first;
11049 + struct msg *msg_last;
11050 + unsigned long msg_cbytes;
11051 + unsigned long msg_qnum;
11052 + unsigned long msg_qbytes;
11053 + unsigned long msg_lspid;
11054 + unsigned long msg_lrpid;
11055 + unsigned long msg_stime;
11056 + unsigned long msg_pad1;
11057 + unsigned long msg_rtime;
11058 + unsigned long msg_pad2;
11059 + unsigned long msg_ctime;
11060 + unsigned long msg_pad3;
11061 + unsigned long msg_pad4[4];
11065 +static inline void ip_to_lp(struct ibcs_ipc_perm *ip, struct ipc_perm *lp)
11067 + lp->uid = ip->uid;
11068 + lp->gid = ip->gid;
11069 + lp->cuid = ip->cuid;
11070 + lp->cgid = ip->cgid;
11071 + lp->mode = ip->mode;
11072 + lp->seq = ip->seq;
11073 + lp->key = ip->key;
11076 +static inline void lp_to_ip(struct ipc_perm *lp, struct ibcs_ipc_perm *ip)
11078 + ip->uid = lp->uid;
11079 + ip->gid = lp->gid;
11080 + ip->cuid = lp->cuid;
11081 + ip->cgid = lp->cgid;
11082 + ip->mode = lp->mode;
11083 + ip->seq = lp->seq;
11084 + ip->key = lp->key;
11087 +static inline void ip_to_lp_l(struct ibcs_ipc_perm_l *ip, struct ipc_perm *lp)
11089 + lp->uid = ip->uid;
11090 + lp->gid = ip->gid;
11091 + lp->cuid = ip->cuid;
11092 + lp->cgid = ip->cgid;
11093 + lp->mode = ip->mode;
11094 + lp->seq = ip->seq;
11095 + lp->key = ip->key;
11098 +static inline void lp_to_ip_l(struct ipc_perm *lp, struct ibcs_ipc_perm_l *ip)
11100 + ip->uid = lp->uid;
11101 + ip->gid = lp->gid;
11102 + ip->cuid = lp->cuid;
11103 + ip->cgid = lp->cgid;
11104 + ip->mode = lp->mode;
11105 + ip->seq = lp->seq;
11106 + ip->key = lp->key;
11110 +#define U_SEMCTL (0)
11111 +#define U_SEMGET (1)
11112 +#define U_SEMOP (2)
11113 +#define U_SHMLOCK (3)
11114 +#define U_SHMUNLOCK (4)
11116 +#define U_IPC_RMID 0
11117 +#define U_IPC_SET 1
11118 +#define U_IPC_STAT 2
11119 +#define U_GETNCNT 3
11120 +#define U_GETPID 4
11121 +#define U_GETVAL 5
11122 +#define U_GETALL 6
11123 +#define U_GETZCNT 7
11124 +#define U_SETVAL 8
11125 +#define U_SETALL 9
11126 +#define U_IPC_RMID_L 10
11127 +#define U_IPC_SET_L 11
11128 +#define U_IPC_STAT_L 12
11130 +static inline int ibcs_sem_trans(int arg)
11133 + case U_IPC_RMID: return IPC_RMID;
11134 + case U_IPC_SET: return IPC_SET;
11135 + case U_IPC_STAT: return IPC_STAT;
11136 + case U_GETNCNT: return GETNCNT;
11137 + case U_GETPID: return GETPID;
11138 + case U_GETVAL: return GETVAL;
11139 + case U_GETALL: return GETALL;
11140 + case U_GETZCNT: return GETZCNT;
11141 + case U_SETVAL: return SETVAL;
11142 + case U_SETALL: return SETALL;
11143 + case U_IPC_RMID_L: return IPC_RMID;
11144 + case U_IPC_SET_L: return U_IPC_SET_L;
11145 + case U_IPC_STAT_L: return U_IPC_STAT_L;
11150 +static void isem_to_lsem(struct ibcs_semid_ds *is, struct semid_ds *ls)
11152 + ip_to_lp(&is->sem_perm, &ls->sem_perm);
11153 + ls->sem_base = is->sem_base;
11154 + ls->sem_nsems = is->sem_nsems;
11155 + ls->sem_otime = is->sem_otime;
11156 + ls->sem_ctime = is->sem_ctime;
11159 +static void lsem_to_isem(struct semid_ds *ls, struct ibcs_semid_ds *is)
11161 + lp_to_ip(&ls->sem_perm, &is->sem_perm);
11162 + is->sem_base = ls->sem_base;
11163 + is->sem_nsems = ls->sem_nsems;
11164 + is->sem_otime = ls->sem_otime;
11165 + is->sem_ctime = ls->sem_ctime;
11168 +static void isem_to_lsem_l(struct ibcs_semid_ds_l *is, struct semid_ds *ls)
11170 + ip_to_lp_l(&is->sem_perm, &ls->sem_perm);
11171 + ls->sem_base = is->sem_base;
11172 + ls->sem_nsems = is->sem_nsems;
11173 + ls->sem_otime = is->sem_otime;
11174 + ls->sem_ctime = is->sem_ctime;
11177 +static void lsem_to_isem_l(struct semid_ds *ls, struct ibcs_semid_ds_l *is)
11179 + memset(is, 0, sizeof(*is));
11180 + lp_to_ip_l(&ls->sem_perm, &is->sem_perm);
11181 + is->sem_base = ls->sem_base;
11182 + is->sem_nsems = ls->sem_nsems;
11183 + is->sem_otime = ls->sem_otime;
11184 + is->sem_ctime = ls->sem_ctime;
11187 +int svr4_semsys(struct pt_regs *regs)
11189 + int command = get_syscall_parameter (regs, 0);
11190 + int arg1, arg2, arg3;
11191 + union semun *arg4;
11192 + struct semid_ds ls;
11193 + union semun lsemun;
11194 + mm_segment_t old_fs;
11197 + arg1 = get_syscall_parameter (regs, 1);
11198 + arg2 = get_syscall_parameter (regs, 2);
11199 + arg3 = get_syscall_parameter (regs, 3);
11200 + switch (command) {
11202 + /* XXX - The value for arg4 depends on how union
11203 + * passing is implement on this architecture and
11204 + * compiler. The following is *only* known to be
11205 + * right for Intel (the default else case).
11208 + arg4 = (union semun *)get_syscall_parameter (regs, 4);
11210 + arg4 = (union semun *)(((unsigned long *) regs->esp) + (5));
11213 + abi_trace(ABI_TRACE_API, "semctl: args: %d %d %d %lx",
11214 + arg1, arg2, arg3, (u_long)arg4);
11217 + case U_IPC_SET: {
11218 + struct ibcs_semid_ds is, *is_p;
11220 + retval = get_user(is_p, (struct ibcs_semid_ds **)&arg4->buf);
11222 + retval = verify_area(VERIFY_WRITE, is_p, sizeof(is));
11226 + copy_from_user(&is, (char *)is_p, sizeof(is));
11227 + isem_to_lsem(&is, &ls);
11229 + lsemun.buf = &ls;
11230 + old_fs = get_fs();
11231 + set_fs (get_ds());
11232 + retval = SYS (ipc) (SEMCTL, arg1, arg2, IPC_SET, &lsemun);
11235 + lsem_to_isem(&ls, &is);
11236 + copy_to_user((char *)is_p, &is, sizeof(is));
11240 + case U_IPC_SET_L: {
11241 + struct ibcs_semid_ds_l is, *is_p;
11243 + retval = get_user(is_p, (struct ibcs_semid_ds_l **)&arg4->buf);
11245 + retval = verify_area(VERIFY_WRITE, is_p, sizeof(is));
11249 + copy_from_user(&is, (char *)is_p, sizeof(is));
11250 + isem_to_lsem_l(&is, &ls);
11252 + lsemun.buf = &ls;
11253 + old_fs = get_fs();
11254 + set_fs (get_ds());
11255 + retval = SYS (ipc) (SEMCTL, arg1, arg2, IPC_SET, &lsemun);
11258 + lsem_to_isem_l(&ls, &is);
11259 + copy_to_user((char *)is_p, &is, sizeof(is));
11264 + case U_IPC_RMID_L:
11269 + case U_GETZCNT: {
11270 + int cmd = ibcs_sem_trans(arg3);
11271 + return SYS (ipc) (SEMCTL, arg1, arg2, cmd, arg4);
11276 + int cmd = ibcs_sem_trans(arg3);
11277 + return SYS (ipc) (SEMCTL, arg1, 0, cmd, arg4);
11280 + case U_IPC_STAT: {
11281 + struct ibcs_semid_ds is, *is_p;
11283 + retval = get_user(is_p, (struct ibcs_semid_ds **)&arg4->buf);
11285 + retval = verify_area(VERIFY_WRITE, (char *)is_p, sizeof(is));
11289 + lsemun.buf = &ls;
11290 + old_fs = get_fs();
11291 + set_fs(get_ds());
11292 + retval = SYS (ipc) (SEMCTL, arg1, 0, IPC_STAT, &lsemun);
11297 + lsem_to_isem(&ls, &is);
11298 + copy_to_user((char *)is_p, &is, sizeof(is));
11302 + case U_IPC_STAT_L: {
11303 + struct ibcs_semid_ds_l is, *is_p;
11305 + retval = get_user(is_p, (struct ibcs_semid_ds_l **)&arg4->buf);
11307 + retval = verify_area(VERIFY_WRITE, (char *)is_p, sizeof(is));
11311 + lsemun.buf = &ls;
11312 + old_fs = get_fs();
11313 + set_fs(get_ds());
11314 + retval = SYS (ipc) (SEMCTL, arg1, 0, IPC_STAT, &lsemun);
11319 + lsem_to_isem_l(&ls, &is);
11320 + copy_to_user((char *)is_p, &is, sizeof(is));
11325 + printk(KERN_ERR "%d ibcs_semctl: unsupported command %d\n",
11326 + current->pid, arg3);
11331 + abi_trace(ABI_TRACE_API, "semget: args: %d %d %o",
11332 + arg1, arg2, arg3);
11333 + return SYS(ipc)(SEMGET, arg1, arg2, arg3, 0);
11336 + if (abi_traced(ABI_TRACE_API)) {
11337 + struct sembuf * tp = (struct sembuf *) arg2;
11338 + struct sembuf tmp;
11341 + __abi_trace("semop: args: %d 0x%08lx %d",
11342 + arg1, (u_long)arg2, arg3);
11344 + for (x = 0; x < arg3; x++) {
11345 + copy_from_user (&tmp, tp, sizeof(tmp));
11346 + __abi_trace("semop args: %d %d 0%o",
11353 + return SYS(ipc)(SEMOP, arg1, arg3, 0, (struct sembuf *)arg2);
11358 +EXPORT_SYMBOL(svr4_semsys);
11361 +#define U_SHMAT (0)
11362 +#define U_SHMCTL (1)
11363 +#define U_SHMDT (2)
11364 +#define U_SHMGET (3)
11367 +ishm_to_lshm(struct ibcs_shmid_ds *is, struct shmid_ds *ls)
11369 + ip_to_lp(&is->shm_perm, &ls->shm_perm);
11370 + ls->shm_segsz = is->shm_segsz;
11371 + ls->shm_lpid = is->shm_lpid;
11372 + ls->shm_cpid = is->shm_cpid;
11373 + ls->shm_nattch = is->shm_nattch;
11374 + ls->shm_atime = is->shm_atime;
11375 + ls->shm_dtime = is->shm_dtime;
11376 + ls->shm_ctime = is->shm_ctime;
11380 +lshm_to_ishm(struct shmid_ds *ls, struct ibcs_shmid_ds *is)
11382 + lp_to_ip(&ls->shm_perm, &is->shm_perm);
11383 + is->shm_segsz = ls->shm_segsz;
11384 + is->shm_lpid = ls->shm_lpid;
11385 + is->shm_cpid = ls->shm_cpid;
11386 + is->shm_nattch = ls->shm_nattch;
11387 + is->shm_atime = ls->shm_atime;
11388 + is->shm_dtime = ls->shm_dtime;
11389 + is->shm_ctime = ls->shm_ctime;
11393 +ishm_to_lshm_l(struct ibcs_shmid_ds_l *is, struct shmid_ds *ls)
11395 + ip_to_lp_l(&is->shm_perm, &ls->shm_perm);
11396 + ls->shm_segsz = is->shm_segsz;
11397 + ls->shm_lpid = is->shm_lpid;
11398 + ls->shm_cpid = is->shm_cpid;
11399 + ls->shm_nattch = is->shm_nattch;
11400 + ls->shm_atime = is->shm_atime;
11401 + ls->shm_dtime = is->shm_dtime;
11402 + ls->shm_ctime = is->shm_ctime;
11405 +static void lshm_to_ishm_l(struct shmid_ds * ls, struct ibcs_shmid_ds_l * is)
11407 + memset(is, 0, sizeof(*is));
11408 + lp_to_ip_l(&ls->shm_perm, &is->shm_perm);
11409 + is->shm_segsz = ls->shm_segsz;
11410 + is->shm_lpid = ls->shm_lpid;
11411 + is->shm_cpid = ls->shm_cpid;
11412 + is->shm_nattch = ls->shm_nattch;
11413 + is->shm_atime = ls->shm_atime;
11414 + is->shm_dtime = ls->shm_dtime;
11415 + is->shm_ctime = ls->shm_ctime;
11419 +int svr4_shmsys(struct pt_regs * regs)
11421 + int command = get_syscall_parameter (regs, 0);
11422 + int arg1, arg2, arg3;
11423 + mm_segment_t old_fs;
11427 + arg1 = arg2 = arg3 = 0;
11428 + switch (command) {
11432 + arg1 = get_syscall_parameter (regs, 1);
11433 + arg2 = get_syscall_parameter (regs, 2);
11434 + arg3 = get_syscall_parameter (regs, 3);
11437 + addr = (char *) get_syscall_parameter (regs, 1);
11440 + printk(KERN_ERR "%d iBCS: bad SHM command %d\n",
11441 + current->pid, command);
11442 + retval = -EINVAL;
11446 + switch (command) {
11449 + unsigned long raddr;
11451 + abi_trace(ABI_TRACE_API, "shmat: args: %d %x %o",
11452 + arg1, arg2, arg3);
11454 + * raddr = 0 tells sys_shmat to limit to 2G
11455 + * and we are IBCS, no raddr value to return
11458 + old_fs = get_fs();
11459 + set_fs(get_ds());
11460 + retval = SYS (ipc) (IPCCALL(1,SHMAT), arg1, arg3, &raddr, (char *) arg2);
11465 + retval = SYS (ipc) (SHMAT, arg1, arg3, 0, (char *) arg2);
11468 + abi_trace(ABI_TRACE_API, "shmat: return val is %lx", retval);
11473 + abi_trace(ABI_TRACE_API, "shmget: args: %d %x %o",
11474 + arg1, arg2, arg3);
11476 + retval = SYS(ipc)(SHMGET, arg1, arg2, arg3, 0);
11480 + abi_trace(ABI_TRACE_API, "shmdt: arg: %lx",
11482 + retval = SYS(ipc)(SHMDT, 0, 0, 0, addr);
11486 + abi_trace(ABI_TRACE_API, "shmctl: args: %d %x %o %d %x",
11487 + arg1, arg2, arg3, arg3, arg3);
11490 + retval = SYS (ipc) (SHMCTL, arg1, SHM_LOCK, 0, arg3);
11493 + case U_SHMUNLOCK:
11494 + retval = SYS (ipc) (SHMCTL, arg1, SHM_UNLOCK, 0, arg3);
11497 + case U_IPC_SET: {
11498 + struct ibcs_shmid_ds is;
11499 + struct shmid_ds ls;
11501 + retval = verify_area(VERIFY_WRITE, (char *)arg3, sizeof(is));
11505 + copy_from_user(&is, (char *)arg3, sizeof(is));
11506 + ishm_to_lshm(&is, &ls);
11508 + old_fs = get_fs();
11509 + set_fs (get_ds());
11510 + retval = SYS (ipc) (SHMCTL, arg1, IPC_SET, 0, &ls);
11515 + lshm_to_ishm(&ls, &is);
11516 + copy_to_user((char *)arg3, &is, sizeof(is));
11520 + case U_IPC_SET_L: {
11521 + struct ibcs_shmid_ds_l is;
11522 + struct shmid_ds ls;
11524 + retval = verify_area(VERIFY_WRITE, (char *)arg3, sizeof(is));
11528 + copy_from_user(&is, (char *)arg3, sizeof(is));
11529 + ishm_to_lshm_l(&is, &ls);
11531 + old_fs = get_fs();
11532 + set_fs (get_ds());
11533 + retval = SYS (ipc) (SHMCTL, arg1, IPC_SET, 0, &ls);
11538 + lshm_to_ishm_l(&ls, &is);
11539 + copy_to_user((char *)arg3, &is, sizeof(is));
11544 + case U_IPC_RMID_L:
11545 + retval = SYS (ipc) (SHMCTL, arg1, IPC_RMID, arg3);
11548 + case U_IPC_STAT: {
11549 + struct ibcs_shmid_ds is;
11550 + struct shmid_ds ls;
11552 + old_fs = get_fs();
11553 + set_fs (get_ds());
11554 + retval = SYS (ipc) (SHMCTL, arg1, IPC_STAT, 0, &ls);
11559 + lshm_to_ishm(&ls, &is);
11560 + retval = copy_to_user((char *)arg3, &is, sizeof(is)) ? -EFAULT : 0;
11564 + case U_IPC_STAT_L: {
11565 + struct ibcs_shmid_ds_l is;
11566 + struct shmid_ds ls;
11568 + old_fs = get_fs();
11569 + set_fs (get_ds());
11570 + retval = SYS (ipc) (SHMCTL, arg1, IPC_STAT, 0, &ls);
11575 + lshm_to_ishm_l(&ls, &is);
11576 + retval = copy_to_user((char *)arg3, &is, sizeof(is)) ? -EFAULT : 0;
11581 + printk(KERN_ERR "%d iBCS: ibcs_shmctl: unsupported command %d\n",
11582 + current->pid, arg2);
11584 + retval = -EINVAL;
11588 + __abi_trace("shmsys: command: %x", command);
11589 + retval = -EINVAL;
11594 + if ((retval < 0) && (retval > -255)) {
11595 + set_error (regs, iABI_errors (-retval));
11596 + abi_trace(ABI_TRACE_API, "Error %ld", get_result (regs));
11598 + clear_error (regs);
11599 + set_result (regs, retval);
11605 +EXPORT_SYMBOL(svr4_shmsys);
11608 +#define U_MSGGET (0)
11609 +#define U_MSGCTL (1)
11610 +#define U_MSGRCV (2)
11611 +#define U_MSGSND (3)
11613 +static void imsq_to_lmsq(struct ibcs_msqid_ds * im, struct msqid_ds * lm)
11615 + ip_to_lp(&im->msg_perm, &lm->msg_perm);
11616 + lm->msg_first = im->msg_first;
11617 + lm->msg_last = im->msg_last;
11618 + lm->msg_cbytes = im->msg_cbytes;
11619 + lm->msg_qnum = im->msg_qnum;
11620 + lm->msg_qbytes = im->msg_qbytes;
11621 + lm->msg_lspid = im->msg_lspid;
11622 + lm->msg_lrpid = im->msg_lrpid;
11623 + lm->msg_stime = im->msg_stime;
11624 + lm->msg_rtime = im->msg_rtime;
11625 + lm->msg_ctime = im->msg_ctime;
11629 +lmsq_to_imsq(struct msqid_ds *lm, struct ibcs_msqid_ds *im)
11631 + lp_to_ip(&lm->msg_perm, &im->msg_perm);
11632 + im->msg_first = lm->msg_first;
11633 + im->msg_last = lm->msg_last;
11634 + im->msg_cbytes = lm->msg_cbytes;
11635 + im->msg_qnum = lm->msg_qnum;
11636 + im->msg_qbytes = lm->msg_qbytes;
11637 + im->msg_lspid = lm->msg_lspid;
11638 + im->msg_lrpid = lm->msg_lrpid;
11639 + im->msg_stime = lm->msg_stime;
11640 + im->msg_rtime = lm->msg_rtime;
11641 + im->msg_ctime = lm->msg_ctime;
11645 +imsq_to_lmsq_l(struct ibcs_msqid_ds_l *im, struct msqid_ds *lm)
11647 + ip_to_lp_l(&im->msg_perm, &lm->msg_perm);
11648 + lm->msg_first = im->msg_first;
11649 + lm->msg_last = im->msg_last;
11650 + lm->msg_cbytes = im->msg_cbytes;
11651 + lm->msg_qnum = im->msg_qnum;
11652 + lm->msg_qbytes = im->msg_qbytes;
11653 + lm->msg_lspid = im->msg_lspid;
11654 + lm->msg_lrpid = im->msg_lrpid;
11655 + lm->msg_stime = im->msg_stime;
11656 + lm->msg_rtime = im->msg_rtime;
11657 + lm->msg_ctime = im->msg_ctime;
11660 +static void lmsq_to_imsq_l(struct msqid_ds * lm, struct ibcs_msqid_ds_l * im)
11662 + memset(im, 0, sizeof(*im));
11663 + lp_to_ip_l(&lm->msg_perm, &im->msg_perm);
11664 + im->msg_first = lm->msg_first;
11665 + im->msg_last = lm->msg_last;
11666 + im->msg_cbytes = lm->msg_cbytes;
11667 + im->msg_qnum = lm->msg_qnum;
11668 + im->msg_qbytes = lm->msg_qbytes;
11669 + im->msg_lspid = lm->msg_lspid;
11670 + im->msg_lrpid = lm->msg_lrpid;
11671 + im->msg_stime = lm->msg_stime;
11672 + im->msg_rtime = lm->msg_rtime;
11673 + im->msg_ctime = lm->msg_ctime;
11676 +int svr4_msgsys(struct pt_regs * regs)
11678 + int command = get_syscall_parameter (regs, 0);
11679 + int arg1, arg2, arg4, arg5;
11680 + mm_segment_t old_fs;
11684 + arg1 = get_syscall_parameter (regs, 1);
11685 + arg2 = get_syscall_parameter (regs, 2);
11686 + arg3 = (char *) get_syscall_parameter (regs, 3);
11688 + switch (command) {
11689 + /* hard one first */
11692 + case U_IPC_SET: {
11693 + struct ibcs_msqid_ds im;
11694 + struct msqid_ds lm;
11696 + retval = verify_area(VERIFY_WRITE, arg3, sizeof(im));
11700 + copy_from_user(&im, (char *) arg3, sizeof(im));
11701 + imsq_to_lmsq(&im, &lm);
11703 + old_fs = get_fs();
11704 + set_fs (get_ds());
11705 + retval = SYS (ipc) (MSGCTL, arg1, IPC_SET, 0, &lm);
11708 + lmsq_to_imsq(&lm, &im);
11709 + copy_to_user((char *)arg3, &im, sizeof(im));
11713 + case U_IPC_SET_L: {
11714 + struct ibcs_msqid_ds_l im;
11715 + struct msqid_ds lm;
11717 + retval = verify_area(VERIFY_WRITE, arg3, sizeof(im));
11721 + copy_from_user(&im, (char *) arg3, sizeof(im));
11722 + imsq_to_lmsq_l(&im, &lm);
11724 + old_fs = get_fs();
11725 + set_fs (get_ds());
11726 + retval = SYS (ipc) (MSGCTL, arg1, IPC_SET, 0, &lm);
11729 + lmsq_to_imsq_l(&lm, &im);
11730 + copy_to_user((char *)arg3, &im, sizeof(im));
11735 + case U_IPC_RMID_L:
11736 + return SYS (ipc) (MSGCTL, arg1, IPC_RMID, 0, arg3);
11738 + case U_IPC_STAT: {
11739 + struct ibcs_msqid_ds im;
11740 + struct msqid_ds lm;
11742 + retval = verify_area(VERIFY_WRITE, arg3, sizeof(im));
11746 + old_fs = get_fs();
11747 + set_fs (get_ds());
11748 + retval = SYS (ipc) (MSGCTL, arg1, IPC_STAT, 0, &lm);
11754 + lmsq_to_imsq(&lm, &im);
11755 + copy_to_user((char *)arg3, &im, sizeof(im));
11759 + case U_IPC_STAT_L: {
11760 + struct ibcs_msqid_ds_l im;
11761 + struct msqid_ds lm;
11763 + retval = verify_area(VERIFY_WRITE, arg3, sizeof(im));
11767 + old_fs = get_fs();
11768 + set_fs (get_ds());
11769 + retval = SYS (ipc) (MSGCTL, arg1, IPC_STAT, 0, &lm);
11775 + lmsq_to_imsq_l(&lm, &im);
11776 + copy_to_user((char *)arg3, &im, sizeof(im));
11781 + printk(KERN_ERR "%d ibcs_msgctl: unsupported command %d\n",
11782 + current->pid, arg2);
11786 + return SYS (ipc) (MSGGET, arg1, arg2, 0, 0);
11789 + arg4 = get_syscall_parameter (regs, 4);
11790 + retval = SYS (ipc) (MSGSND, arg1, arg3, arg4, (char *) arg2);
11791 + return ((retval > 0) ? 0 : retval);
11795 + arg4 = get_syscall_parameter (regs, 4);
11796 + arg5 = get_syscall_parameter (regs, 5);
11797 + return SYS(ipc)(IPCCALL(1,MSGRCV), arg1, arg3, arg5, arg2, arg4);
11801 + "%d Sparc/IBCS: Kludgy U_MSGRCV not implemented\n",
11804 +#else /* __sparc__ */
11805 + struct ipc_kludge *scratch;
11806 + long old_esp = regs->esp;
11808 + scratch = (struct ipc_kludge *)((regs->esp-1024-sizeof(struct ipc_kludge)) & 0xfffffffc);
11809 + regs->esp = (long)scratch;
11810 + get_user(arg4, ((unsigned long *) regs->esp) + 5);
11811 + get_user(arg5, ((unsigned long *) regs->esp) + 6);
11812 + put_user((long)arg2, &scratch->msgp);
11813 + put_user((long)arg4, &scratch->msgtyp);
11814 + retval = SYS (ipc) (MSGRCV, arg1, arg3, arg5, scratch);
11815 + regs->esp = old_esp;
11817 +#endif /* sparc */
11818 +#endif /* IPCCALL */
11822 + printk(KERN_ERR "%d ibcs_msgctl: unsupported command %d\n",
11823 + current->pid, command);
11828 +EXPORT_SYMBOL(svr4_msgsys);
11829 diff -uNr --exclude-from=dontdiff linux-2.4.3/abi/svr4/isc.c linux/abi/svr4/isc.c
11830 --- linux-2.4.3/abi/svr4/isc.c Thu Jan 1 01:00:00 1970
11831 +++ linux/abi/svr4/isc.c Mon Mar 12 16:34:48 2001
11835 + * This file contains code to enable ISC 4.0 executables (posix setostype)
11837 + * Copyright (C) 1994 Karl Kiniger (ki@kretz.co.at)
11839 + * Some changes also done to callmap.inc: readlink, symlink, lstat
11840 + * entry point numbers are differing from SYSVr4
11844 +#include <linux/config.h>
11845 +#include <linux/module.h>
11847 +#include <linux/types.h>
11848 +#include <linux/errno.h>
11849 +#include <linux/kernel.h>
11851 +#include <abi/abi.h>
11852 +#include <abi/trace.h>
11856 +isc_setostype(int arg1)
11858 + abi_trace(ABI_TRACE_API,
11859 + "sysisc: ISC_SETOSTYPE 0x%x", arg1);
11862 diff -uNr --exclude-from=dontdiff linux-2.4.3/abi/svr4/isc_funcs.c linux/abi/svr4/isc_funcs.c
11863 --- linux-2.4.3/abi/svr4/isc_funcs.c Thu Jan 1 01:00:00 1970
11864 +++ linux/abi/svr4/isc_funcs.c Fri Mar 30 15:23:46 2001
11868 + * The isc syscall dispatcher
11872 +#include <linux/module.h>
11874 +#include <asm/uaccess.h>
11876 +#include <linux/kernel.h>
11878 +#include <abi/abi.h>
11879 +#include <abi/abi4.h>
11881 +#define SC(name) (void *)__NR_##name
11883 +#define ITR(trace, name, args) ,trace,name,args
11885 +static ABI_func ISC_funcs[] = {
11886 + { 0, Ukn ITR(1, "isc_sysisc0", "") }, /* 00 */
11887 + { isc_setostype, 1 ITR(0, "isc_setostype", "d") }, /* 01 */
11888 + { SC(rename), -2 ITR(0, "isc_rename", "ss") }, /* 02 */
11889 + { abi_sigaction, 3 ITR(0, "isc_sigaction", "dxx") }, /* 03 */
11890 + { abi_sigprocmask, 3 ITR(0, "isc_sicprocmask","dxx") }, /* 04 */
11891 + { 0, 1 ITR(0, "isc_sigpending","x") }, /* 05 */
11892 + { SC(getgroups), -2 ITR(0, "isc_getgroups", "dp") }, /* 06 */
11893 + { SC(setgroups), -2 ITR(0, "isc_setgroups", "dp") }, /* 07 */
11894 + { 0, Ukn ITR(1, "pathconf", "") }, /* 08 */
11895 + { 0, Ukn ITR(1, "fpathconf", "") }, /* 09 */
11896 + { ibcs_sysconf, 1 ITR(0, "sysconf", "d") }, /* 10 */
11897 + { SC(waitpid), -3 ITR(0, "isc_waitpid", "dxx") }, /* 11 */
11898 + { SC(setsid), -ZERO ITR(0, "isc_setsid", "") }, /* 12 */
11899 + { SC(setpgid), -2 ITR(0, "isc_setpgid", "dd") }, /* 13 */
11900 + { 0, Ukn ITR(1, "isc_adduser", "") }, /* 14 */
11901 + { 0, Ukn ITR(1, "isc_setuser", "") }, /* 15 */
11902 + { 0, Ukn ITR(1, "isc_sysisc16", "") }, /* 16 */
11903 + { abi_sigsuspend, Spl ITR(0, "isc_sigsuspend","x") }, /* 17 */
11904 + { SC(symlink), -2 ITR(0, "isc_symlink", "ss") }, /* 18 */
11905 + { SC(readlink), -3 ITR(0, "isc_readlink", "spd") }, /* 19 */
11906 + { 0, Ukn ITR(1, "isc_getmajor", "") } /* 20 */
11910 +void iBCS_class_ISC(struct pt_regs *regs) {
11913 + get_user(i, ((unsigned long *)regs->esp)+1);
11915 + regs->eax = iABI_errors(-EINVAL);
11916 + regs->eflags |= 1;
11920 + abi_dispatch(regs, &ISC_funcs[i], 2);
11923 diff -uNr --exclude-from=dontdiff linux-2.4.3/abi/svr4/mmap.c linux/abi/svr4/mmap.c
11924 --- linux-2.4.3/abi/svr4/mmap.c Thu Jan 1 01:00:00 1970
11925 +++ linux/abi/svr4/mmap.c Fri Mar 30 16:14:03 2001
11928 + * mmap.c - svr4 mmap(2) emulation
11930 + * Copyright (c) 1994 Eric Youngdale
11931 + * Copyright (c) 2001 Christoph Hellwig
11934 +#include <linux/errno.h>
11935 +#include <linux/sched.h>
11936 +#include <linux/file.h>
11937 +#include <linux/module.h>
11938 +#include <linux/mm.h>
11939 +#include <linux/mman.h>
11942 +svr4_mmap(u_int addr, u_int len, int prot, int flags, int fd, u_int off)
11944 + struct file * fp = NULL;
11945 + int error = -EBADF;
11947 + if (!(flags & MAP_ANONYMOUS)) {
11953 + if (personality(PER_SVR4) && !(flags & 0x80000000) && addr) {
11956 + down_write(¤t->mm->mmap_sem);
11957 + ret = do_mmap(fp, addr, len, prot, flags | MAP_FIXED, off);
11958 + up_write(¤t->mm->mmap_sem);
11959 + error = (ret == addr ? 0 : (int)ret);
11963 + down_write(¤t->mm->mmap_sem);
11964 + error = do_mmap(fp, addr, len, prot, flags & 0x7fffffff, off);
11965 + up_write(¤t->mm->mmap_sem);
11973 +EXPORT_SYMBOL(svr4_mmap);
11974 diff -uNr --exclude-from=dontdiff linux-2.4.3/abi/svr4/open.c linux/abi/svr4/open.c
11975 --- linux-2.4.3/abi/svr4/open.c Thu Jan 1 01:00:00 1970
11976 +++ linux/abi/svr4/open.c Sun Mar 18 11:54:28 2001
11979 + * open.c - svr4 open(2), statfs(2), fcntl(2) and getdents(2) emulation
11981 + * Copyright (c) 1993 Joe Portman (baron@hebron.connected.com)
11982 + * Copyright (c) 1993, 1994 Drew Sullivan (re-worked for iBCS2)
11983 + * Copyright (c) 2000 Christoph Hellwig (rewrote lookup-related code)
11986 +#include <linux/config.h>
11987 +#include <linux/module.h>
11989 +#include <linux/vfs.h>
11990 +#include <linux/types.h>
11991 +#include <linux/utime.h>
11992 +#include <linux/errno.h>
11993 +#include <linux/fcntl.h>
11994 +#include <linux/stat.h>
11995 +#include <linux/string.h>
11996 +#include <linux/sched.h>
11997 +#include <linux/kernel.h>
11998 +#include <linux/signal.h>
11999 +#include <linux/tty.h>
12000 +#include <linux/time.h>
12001 +#include <linux/slab.h>
12002 +#include <linux/un.h>
12003 +#include <linux/file.h>
12004 +#include <asm/uaccess.h>
12007 +#include <asm/bitops.h>
12009 +#include <abi/abi.h>
12010 +#include <abi/xnx.h>
12011 +#include <abi/trace.h>
12013 +#include <linux/dirent.h>
12016 +/* ISC (at least) assumes O_CREAT if O_TRUNC is given. This is emulated
12017 + * here but is it correct for iBCS in general? Do we care?
12019 +unsigned short fl_ibcs_to_linux[] = {
12020 + 0x0001, 0x0002, 0x0800, 0x0400, 0x1000, 0x0000, 0x0000, 0x0800,
12021 + 0x0040, 0x0240, 0x0080, 0x0100, 0x0000, 0x0000, 0x0000, 0x0000
12024 +EXPORT_SYMBOL(fl_ibcs_to_linux);
12026 +unsigned short fl_linux_to_ibcs[] = {
12027 + 0x0001, 0x0002, 0x0000, 0x0000, 0x0000, 0x0000, 0x0100, 0x0400,
12028 + 0x0800, 0x0200, 0x0008, 0x0004, 0x0010, 0x0000, 0x0000, 0x0000
12032 +copy_statfs(struct ibcs_statfs *buf, struct statfs *st)
12034 + struct ibcs_statfs ibcsstat;
12036 + ibcsstat.f_type = st->f_type;
12037 + ibcsstat.f_bsize = st->f_bsize;
12038 + ibcsstat.f_frsize = 0;
12039 + ibcsstat.f_blocks = st->f_blocks;
12040 + ibcsstat.f_bfree = st->f_bfree;
12041 + ibcsstat.f_files = st->f_files;
12042 + ibcsstat.f_ffree = st->f_ffree;
12043 + memset(ibcsstat.f_fname, 0, sizeof(ibcsstat.f_fname));
12044 + memset(ibcsstat.f_fpack, 0, sizeof(ibcsstat.f_fpack));
12046 + /* Finally, copy it to the user's buffer */
12047 + return copy_to_user(buf, &ibcsstat, sizeof(struct ibcs_statfs));
12050 +int svr4_statfs(const char * path, struct ibcs_statfs * buf, int len, int fstype)
12052 + struct ibcs_statfs ibcsstat;
12054 + if (len > (int)sizeof(struct ibcs_statfs))
12058 + struct nameidata nd;
12061 + error = user_path_walk(path, &nd);
12063 + struct statfs tmp;
12064 + error = vfs_statfs(nd.dentry->d_inode->i_sb, &tmp);
12065 + if (!error && copy_statfs(buf, &tmp))
12067 + path_release(&nd);
12074 + * Linux can't stat unmounted filesystems so we
12075 + * simply lie and claim 500MB of 8GB is free. Sorry.
12077 + ibcsstat.f_bsize = 1024;
12078 + ibcsstat.f_frsize = 0;
12079 + ibcsstat.f_blocks = 8 * 1024 * 1024; /* 8GB */
12080 + ibcsstat.f_bfree = 500 * 1024; /* 100MB */
12081 + ibcsstat.f_files = 60000;
12082 + ibcsstat.f_ffree = 50000;
12083 + memset(ibcsstat.f_fname, 0, sizeof(ibcsstat.f_fname));
12084 + memset(ibcsstat.f_fpack, 0, sizeof(ibcsstat.f_fpack));
12086 + /* Finally, copy it to the user's buffer */
12087 + return copy_to_user(buf, &ibcsstat, len) ? -EFAULT : 0;
12090 +EXPORT_SYMBOL(svr4_statfs);
12092 +int svr4_fstatfs(unsigned int fd, struct ibcs_statfs * buf, int len, int fstype)
12094 + struct ibcs_statfs ibcsstat;
12096 + if (len > (int)sizeof(struct ibcs_statfs))
12100 + struct file * file;
12101 + struct statfs tmp;
12108 + error = vfs_statfs(file->f_dentry->d_inode->i_sb, &tmp);
12109 + if (!error && copy_statfs(buf, &tmp))
12118 + * Linux can't stat unmounted filesystems so we
12119 + * simply lie and claim 500MB of 8GB is free. Sorry.
12121 + ibcsstat.f_bsize = 1024;
12122 + ibcsstat.f_frsize = 0;
12123 + ibcsstat.f_blocks = 8 * 1024 * 1024; /* 8GB */
12124 + ibcsstat.f_bfree = 500 * 1024; /* 100MB */
12125 + ibcsstat.f_files = 60000;
12126 + ibcsstat.f_ffree = 50000;
12127 + memset(ibcsstat.f_fname, 0, sizeof(ibcsstat.f_fname));
12128 + memset(ibcsstat.f_fpack, 0, sizeof(ibcsstat.f_fpack));
12130 + /* Finally, copy it to the user's buffer */
12131 + return copy_to_user(buf, &ibcsstat, len) ? -EFAULT : 0;
12134 +EXPORT_SYMBOL(svr4_fstatfs);
12137 +int svr4_open(const char *fname, int flag, int mode)
12140 + return SYS(open)(fname, map_flags(flag, fl_ibcs_to_linux), mode);
12142 + int error, fd, args[3];
12143 + struct file *file;
12144 + mm_segment_t old_fs;
12146 + struct sockaddr_un addr;
12148 + fd = SYS(open)(fname, map_flags(flag, fl_ibcs_to_linux), mode);
12152 + /* Sometimes a program may open a pathname which it expects
12153 + * to be a named pipe (or STREAMS named pipe) when the
12154 + * Linux domain equivalent is a Unix domain socket. (e.g.
12155 + * UnixWare uses a STREAMS named pipe /dev/X/Nserver.0 for
12156 + * X :0 but Linux uses a Unix domain socket /tmp/.X11-unix/X0)
12157 + * It isn't enough just to make the symlink because you cannot
12158 + * open() a socket and read/write it. If we spot the error we can
12159 + * switch to socket(), connect() and things will likely work
12160 + * as expected however.
12164 + return fd; /* Huh?!? */
12165 + if (!S_ISSOCK(file->f_dentry->d_inode->i_mode)) {
12172 + args[0] = AF_UNIX;
12173 + args[1] = SOCK_STREAM;
12175 + old_fs = get_fs();
12176 + set_fs(get_ds());
12177 + fd = SYS(socketcall)(SYS_SOCKET, args);
12182 + p = getname(fname);
12185 + return PTR_ERR(p);
12187 + if (strlen(p) >= UNIX_PATH_MAX) {
12192 + addr.sun_family = AF_UNIX;
12193 + strcpy(addr.sun_path, p);
12197 + args[1] = (int)&addr;
12198 + args[2] = sizeof(struct sockaddr_un);
12199 + set_fs(get_ds());
12200 + error = SYS(socketcall)(SYS_CONNECT, args);
12211 +EXPORT_SYMBOL(svr4_open);
12214 +#define NAME_OFFSET(de) ((int) ((de)->d_name - (char *) (de)))
12215 +#define ROUND_UP(x) (((x)+sizeof(long)-1) & ~(sizeof(long)-1))
12217 +struct svr4_getdents_callback {
12218 + struct dirent * current_dir;
12219 + struct dirent * previous;
12224 +static int svr4_filldir(void * __buf, const char * name, int namlen, off_t offset,
12225 + ino_t ino, unsigned int d_type)
12227 + struct dirent * dirent;
12228 + struct svr4_getdents_callback * buf = (struct svr4_getdents_callback *) __buf;
12229 + int reclen = ROUND_UP(NAME_OFFSET(dirent) + namlen + 1);
12231 + buf->error = -EINVAL; /* only used if we fail.. */
12232 + if (reclen > buf->count)
12235 + dirent = buf->previous;
12237 + put_user(offset, &dirent->d_off);
12238 + dirent = buf->current_dir;
12239 + buf->previous = dirent;
12241 + if (current->personality & SHORT_INODE) {
12242 + /* read() on a directory only handles
12243 + * short inodes but cannot use 0 as that
12244 + * indicates an empty directory slot.
12245 + * Therefore stat() must also fold
12246 + * inode numbers avoiding 0. Which in
12247 + * turn means that getdents() must fold
12248 + * inodes avoiding 0 - if the program
12249 + * was built in a short inode environment.
12250 + * If we have short inodes in the dirent
12251 + * we also have a two byte pad so we
12252 + * can let the high word fall in the pad.
12253 + * This makes it a little more robust if
12254 + * we guessed the inode size wrong.
12256 + if (!((unsigned long)dirent->d_ino & 0xffff))
12257 + dirent->d_ino = 0xfffffffe;
12260 + put_user(ino, &dirent->d_ino);
12261 + put_user(reclen, &dirent->d_reclen);
12262 + copy_to_user(dirent->d_name, name, namlen);
12263 + put_user(0, dirent->d_name + namlen);
12264 + ((char *) dirent) += reclen;
12265 + buf->current_dir = dirent;
12266 + buf->count -= reclen;
12272 +int svr4_getdents(int fd, char *dirent, int count)
12274 + struct file * file;
12275 + struct dirent * lastdirent;
12276 + struct svr4_getdents_callback buf;
12284 + buf.current_dir = (struct dirent *) dirent;
12285 + buf.previous = NULL;
12286 + buf.count = count;
12288 + error = vfs_readdir(file, svr4_filldir, &buf);
12291 + error = buf.error;
12292 + lastdirent = buf.previous;
12293 + if (lastdirent) {
12294 + put_user(file->f_pos, &lastdirent->d_off);
12295 + error = count - buf.count;
12305 +EXPORT_SYMBOL(svr4_getdents);
12307 +struct ibcs_flock {
12308 + short l_type; /* numbers don't match */
12311 + off_t l_len; /* 0 means to end of file */
12317 +int svr4_fcntl(struct pt_regs *regs)
12319 + int arg1, arg2, arg3;
12320 + int error, retval;
12323 + error = verify_area(VERIFY_READ,
12324 + ((unsigned long *)regs->esp)+1,
12328 +#endif /* __sparc__ */
12329 + arg1 = get_syscall_parameter (regs, 0);
12330 + arg2 = get_syscall_parameter (regs, 1);
12331 + arg3 = get_syscall_parameter (regs, 2);
12334 + /* These match the Linux commands. */
12335 + case 0: /* F_DUPFD */
12336 + case 1: /* F_GETFD */
12337 + case 2: /* F_SETFD */
12338 + return SYS(fcntl)(arg1, arg2, arg3);
12340 + /* The iBCS flags don't match Linux flags. */
12341 + case 3: /* F_GETFL */
12342 + return map_flags(SYS(fcntl)(arg1, arg2, arg3),
12343 + fl_linux_to_ibcs);
12344 + case 4: /* F_SETFL */
12345 + arg3 = map_flags(arg3, fl_ibcs_to_linux);
12346 + return SYS(fcntl)(arg1, arg2, arg3);
12348 + /* The lock stucture is different. */
12349 + case 14: /* F_GETLK SVR4 */
12351 + /* fall through */
12352 + case 5: /* F_GETLK */
12353 + case 6: /* F_SETLK */
12354 + case 7: /* F_SETLKW */
12356 + struct ibcs_flock fl;
12357 + struct flock l_fl;
12358 + mm_segment_t old_fs;
12360 + error = verify_area(VERIFY_WRITE, (void *)arg3,
12364 + error = copy_from_user(&fl, (void *)arg3, sizeof(fl));
12368 + l_fl.l_type = fl.l_type - 1;
12369 + l_fl.l_whence = fl.l_whence;
12370 + l_fl.l_start = fl.l_start;
12371 + l_fl.l_len = fl.l_len;
12372 + l_fl.l_pid = fl.l_pid;
12374 + abi_trace(ABI_TRACE_API,
12375 + "lock l_type: %d l_whence: %d "
12376 + "l_start: %lu l_len: %lu "
12377 + "l_sysid: %d l_pid: %d\n",
12378 + fl.l_type, fl.l_whence,
12379 + fl.l_start, fl.l_len,
12380 + fl.l_sysid, fl.l_pid);
12382 + old_fs = get_fs();
12383 + set_fs(get_ds());
12384 + retval = SYS(fcntl)(arg1, arg2, &l_fl);
12388 + fl.l_type = l_fl.l_type + 1;
12389 + fl.l_whence = l_fl.l_whence;
12390 + fl.l_start = l_fl.l_start;
12391 + fl.l_len = l_fl.l_len;
12393 + fl.l_pid = l_fl.l_pid;
12394 + /* This should not fail... */
12395 + copy_to_user((void *)arg3, &fl, sizeof(fl));
12401 + case 10: /* F_ALLOCSP */
12402 + /* Extend allocation for specified portion of file. */
12403 + case 11: /* F_FREESP */
12404 + /* Free a portion of a file. */
12407 + /* These are intended to support the Xenix chsize() and
12408 + * rdchk() system calls. I don't know if these may be
12409 + * generated by applications or not.
12411 + case 0x6000: /* F_CHSIZE */
12412 + return SYS(ftruncate)(arg1, arg3);
12414 + case 0x6001: /* F_RDCHK */
12415 + return xnx_rdchk(arg1);
12416 +#endif /* __sparc__ */
12418 +#ifdef CONFIG_ABI_IBCS_SCO
12419 + /* This could be SCO's get highest fd open if the fd we
12420 + * are called on is -1 otherwise it could be F_CHKFL.
12422 + case 8: /* F_GETHFDO */
12424 + return find_first_zero_bit(current->files->open_fds,
12425 + current->files->max_fdset);
12426 + /* else fall through to fail */
12428 + /* The following are defined but reserved and unknown. */
12429 + case 8: /* F_CHKFL */
12432 + /* These are made from the Xenix locking() system call.
12433 + * According to available documentation these would
12434 + * never be generated by an application - only by the
12435 + * kernel Xenix support.
12437 + case 0x6300: /* F_LK_UNLCK */
12438 + case 0x7200: /* F_LK_LOCK */
12439 + case 0x6200: /* F_LK_NBLCK */
12440 + case 0x7100: /* F_LK_RLCK */
12441 + case 0x6100: /* F_LK_NBRLCK */
12444 + abi_trace(ABI_TRACE_API,
12445 + "unsupported fcntl 0x%lx, arg 0x%lx",
12446 + (u_long)arg2, (u_long)arg3);
12452 +EXPORT_SYMBOL(svr4_fcntl);
12453 diff -uNr --exclude-from=dontdiff linux-2.4.3/abi/svr4/poll.c linux/abi/svr4/poll.c
12454 --- linux-2.4.3/abi/svr4/poll.c Thu Jan 1 01:00:00 1970
12455 +++ linux/abi/svr4/poll.c Sun Mar 18 11:54:28 2001
12459 + * This file contains the procedures for the handling of poll.
12461 + * Copyright (C) 1994 Eric Youngdale
12463 + * Created for Linux based loosely upon linux select code, which
12464 + * in turn is loosely based upon Mathius Lattner's minix
12465 + * patches by Peter MacDonald. Heavily edited by Linus.
12467 + * Poll is used by SVr4 instead of select, and it has considerably
12468 + * more functionality. Parts of it are related to STREAMS, and since
12469 + * we do not have streams, we fake it. In fact, select() still exists
12470 + * under SVr4, but libc turns it into a poll() call instead.
12472 + * (note: poll is now native to Linux... -- hch)
12475 +#include <linux/config.h>
12476 +#include <linux/module.h>
12477 +#include <linux/version.h>
12479 +#include <linux/types.h>
12480 +#include <linux/time.h>
12481 +#include <linux/fs.h>
12482 +#include <linux/kernel.h>
12483 +#include <linux/sched.h>
12484 +#include <linux/string.h>
12485 +#include <linux/stat.h>
12486 +#include <linux/signal.h>
12487 +#include <linux/errno.h>
12488 +#include <linux/slab.h>
12490 +#include <asm/uaccess.h>
12491 +#include <asm/system.h>
12493 +#include <abi/abi.h>
12494 +#include <abi/tli.h>
12495 +#include <abi/svr4.h>
12496 +#include <abi/trace.h>
12498 +/* FIXME: This is just copied from linux/fs/select.c simply so we can
12499 + * add the XTI message check - and even then only if XTI is enabled
12500 + * in the module. We could probably do better. But see the following
12501 + * comment which notes the possibility of needing to do some flag
12502 + * mapping in the event vectors one day...
12505 +/* FIXME: Some of the event flags may need mapping. This list does
12506 + * not agree with the list Linux is using. The important ones do, but...
12512 +#define POLLHUP 16
12513 +#define POLLNVAL 32
12514 +#define POLLRDNORM 64
12515 +#define POLLWRNORM POLLOUT
12516 +#define POLLRDBAND 128
12517 +#define POLLWRBAND 256
12519 +#define DEFAULT_POLLMASK (POLLIN | POLLOUT | POLLRDNORM | POLLWRNORM)
12523 + * FIXME: just have the callmap go direct to Linux poll()?
12526 +svr4_poll(struct poll * ufds, size_t nfds, int timeout)
12530 + if (abi_traced(ABI_TRACE_API)) {
12533 + for (i = 0; i < nfds; i++) {
12534 + __abi_trace(" %3d 0x%04x 0x%04x",
12535 + ufds[i].fd, ufds[i].events,
12536 + ufds[i].revents);
12540 + error = SYS(poll)(ufds, nfds, timeout);
12542 + if (abi_traced(ABI_TRACE_API)) {
12545 + for (i = 0; i < nfds; i++) {
12546 + __abi_trace(" %3d 0x%04x 0x%04x",
12547 + ufds[i].fd, ufds[i].events,
12548 + ufds[i].revents);
12555 +EXPORT_SYMBOL(svr4_poll);
12556 diff -uNr --exclude-from=dontdiff linux-2.4.3/abi/svr4/ptrace.c linux/abi/svr4/ptrace.c
12557 --- linux-2.4.3/abi/svr4/ptrace.c Thu Jan 1 01:00:00 1970
12558 +++ linux/abi/svr4/ptrace.c Mon Mar 12 16:34:48 2001
12562 + * sysv ptrace(2) emulation
12564 + * Copyright (C) 1995 Mike Jagdis
12568 +#include <linux/config.h>
12569 +#include <linux/module.h>
12571 +#include <asm/uaccess.h>
12573 +#include <linux/errno.h>
12574 +#include <linux/sched.h>
12575 +#include <linux/kernel.h>
12576 +#include <linux/mm.h>
12577 +#include <linux/user.h>
12579 +#include <abi/abi.h>
12580 +#include <abi/signal.h>
12581 +#include <abi/trace.h>
12586 +#define U(X) ((unsigned long)&((struct user *)0)->X)
12588 +#ifdef CONFIG_ABI_IBCS_SCO
12589 +static unsigned long sco_to_linux_reg[NREGS] = {
12590 + U(regs.gs), U(regs.fs), U(regs.es), U(regs.ds),
12591 + U(regs.edi), U(regs.esi),
12593 + U(regs.esp /* ESP */),
12594 + U(regs.ebx), U(regs.edx), U(regs.ecx), U(regs.eax),
12595 + U(signal /* Trap */),
12596 + U(reserved /* ERR */),
12597 + U(regs.eip), U(regs.cs), U(regs.eflags),
12598 + U(regs.esp), U(regs.ss)
12602 +#ifdef CONFIG_ABI_IBCS_WYSE
12603 +static unsigned long wysev386_to_linux_reg[NREGS] = {
12604 + U(regs.es), U(regs.ds), U(regs.edi), U(regs.esi),
12605 + U(regs.ebp), U(regs.esp),
12606 + U(regs.ebx), U(regs.edx), U(regs.ecx), U(regs.eax),
12607 + U(signal /* Trap */),
12608 + U(reserved /* ERR */),
12609 + U(regs.eip), U(regs.cs),
12611 + U(regs.esp /* UESP */),
12613 + U(regs.fs), U(regs.gs)
12618 +unsigned long *reg_map[] = {
12621 + NULL, /* SVR3 is a subset of SVR4 */
12622 +#ifdef CONFIG_ABI_IBCS_SCO
12623 + sco_to_linux_reg, /* SCO SVR3 */
12627 +#ifdef CONFIG_ABI_IBCS_WYSE
12628 + wysev386_to_linux_reg, /* Wyse V/386 */
12632 + NULL, /* ISC R4 */
12638 +int svr4_ptrace(int req, int pid, unsigned long addr, unsigned long data)
12640 +#if !defined(CONFIG_ABI_IBCS_SCO) && !defined(CONFIG_ABI_IBCS_WYSE)
12643 + unsigned long res;
12645 + /* Slight variations between iBCS and Linux codes. */
12646 + if (req == PTRACE_ATTACH)
12648 + else if (req == PTRACE_DETACH)
12651 + /* Remap access to the registers. */
12652 + if (req == 3 || req == 6) {
12653 + if (addr == 0x1200 /* get offset of u_ar0 (SCO) */
12654 + || addr == 0x1292) { /* get offset of u_ar0 (Wyse V/386) */
12658 + if ((addr & 0xff00) == 0x4000) { /* Registers */
12659 + addr = (addr & 0xff) >> 2;
12661 + || (int)(addr = reg_map[current->personality & PER_MASK][addr]) == -1)
12666 + if (req == 7 && data > 0) {
12667 + if (data > NSIGNALS)
12669 + data = current->exec_domain->signal_map[data];
12672 + if (req == 1 || req == 2 || req == 3) {
12673 + mm_segment_t old_fs;
12676 + old_fs = get_fs();
12677 + set_fs(get_ds());
12678 + error = SYS(ptrace)(req, pid, addr, &res);
12684 + if ((abi_traced(ABI_TRACE_API)) && (req == 3 || req == 6)) {
12685 + static const char * const regnam[] = {
12686 + "EBX", "ECX", "EDX", "ESI", "EDI", "EBP", "EAX",
12687 + "DS", "ES", "FS", "GS", "ORIG_EAX", "EIP", "CS",
12688 + "EFL", "UESP", "SS"
12690 + __abi_trace("%ld [%s] = 0x%08lx\n",
12692 + (addr>>2) < sizeof(regnam)/sizeof(regnam[0])
12693 + ? regnam[addr>>2] : "???",
12694 + req == 3 ? res : data);
12697 + if (req == 1 || req == 2 || req == 3)
12700 + return SYS(ptrace)(req, pid, addr, data);
12701 +#endif /* !defined(CONFIG_ABI_IBCS_SCO) && !defined(CONFIG_ABI_IBCS_WYSE) */
12704 +EXPORT_SYMBOL(svr4_ptrace);
12705 diff -uNr --exclude-from=dontdiff linux-2.4.3/abi/svr4/sco_secureware.c linux/abi/svr4/sco_secureware.c
12706 --- linux-2.4.3/abi/svr4/sco_secureware.c Thu Jan 1 01:00:00 1970
12707 +++ linux/abi/svr4/sco_secureware.c Mon Mar 12 16:34:48 2001
12711 + * sco_secureware.c - secureware syscall emulation
12713 + * Copyright (C) 1994 Mike Jagdis (jaggy@purplet.demon.co.uk)
12716 + * SecureWare, Inc. provided the C2 security subsystem used on SCO Unix.
12717 + * This is not that package. This does not even attempt to emulate
12718 + * that package. This emulates just enough of the "obvious" bits to
12719 + * allow some programs to get a bit further. It is not useful to
12720 + * try to implement C2 security in an emulator. Nor is it particularly
12721 + * useful to run SCO's secure admin programs on Linux anyway...
12724 +#include <linux/errno.h>
12725 +#include <linux/kernel.h>
12726 +#include <linux/sched.h>
12728 +#include <abi/abi.h>
12729 +#include <abi/trace.h>
12733 +sw_security(int cmd, void *p1, void *p2, void *p3, void *p4, void *p5)
12736 + case 1: /* getluid */
12737 + /* We want the login user id. We don't have it
12738 + * specifically so we'll just use the real uid
12739 + * instead - it should be good enough.
12741 + return current->uid;
12743 + case 2: /* setluid */
12744 + /* Strictly we should only be able to call setluid()
12745 + * once but we can't enforce that. We have the choice
12746 + * between having it always succeed or always fail.
12747 + * Since setluid() should only ever be invoked by
12748 + * things like login processes we always fail it.
12756 + printk(KERN_ERR "iBCS: unsupported security call cmd=%d\n",
12761 diff -uNr --exclude-from=dontdiff linux-2.4.3/abi/svr4/stream.c linux/abi/svr4/stream.c
12762 --- linux-2.4.3/abi/svr4/stream.c Thu Jan 1 01:00:00 1970
12763 +++ linux/abi/svr4/stream.c Mon Mar 12 16:34:48 2001
12766 + * stream.c - SVR4 streams handling
12768 + * Copyright 1994,1995 Mike Jagdis (jaggy@purplet.demon.co.uk)
12772 +#include <linux/config.h>
12773 +#include <linux/module.h>
12775 +#include <asm/uaccess.h>
12777 +#include <linux/types.h>
12778 +#include <linux/errno.h>
12779 +#include <linux/kernel.h>
12780 +#include <linux/ptrace.h>
12781 +#include <linux/net.h>
12782 +#include <linux/mm.h>
12783 +#include <linux/socket.h>
12784 +#include <linux/file.h>
12786 +#include <abi/abi.h>
12787 +#include <abi/stream.h>
12788 +#include <abi/tli.h>
12789 +#include <abi/trace.h>
12792 +int svr4_getmsg(struct pt_regs *regs)
12795 + struct file *filep;
12796 + struct inode *ino;
12799 + fd = (int)get_syscall_parameter (regs, 0);
12800 + filep = fget(fd);
12805 + ino = filep->f_dentry->d_inode;
12806 + if (ino->i_sock) {
12807 +#if defined(CONFIG_ABI_XTI) || defined(CONFIG_ABI_SPX)
12808 + error = timod_getmsg(fd, ino, 0, regs);
12811 +#endif /* CONFIG_ABI_XTI */
12817 +EXPORT_SYMBOL(svr4_getmsg);
12820 +int svr4_putmsg(struct pt_regs *regs)
12823 + struct file *filep;
12824 + struct inode *ino;
12827 + fd = (int)get_syscall_parameter (regs, 0);
12828 + filep = fget(fd);
12833 + ino = filep->f_dentry->d_inode;
12835 + || (MAJOR(ino->i_rdev) == 30 && MINOR(ino->i_rdev) == 1)) {
12836 +#if defined(CONFIG_ABI_XTI) || defined(CONFIG_ABI_SPX)
12837 + error = timod_putmsg(fd, ino, 0, regs);
12846 +EXPORT_SYMBOL(svr4_putmsg);
12848 +#ifdef CONFIG_ABI_XTI
12849 +int svr4_getpmsg(struct pt_regs *regs)
12852 + struct file *filep;
12853 + struct inode *ino;
12856 + fd = (int)get_syscall_parameter (regs, 0);
12858 + filep = fget(fd);
12863 + ino = filep->f_dentry->d_inode;
12865 + error = timod_getmsg(fd, ino, 1, regs);
12870 +EXPORT_SYMBOL(svr4_getpmsg);
12872 +int svr4_putpmsg(struct pt_regs *regs)
12875 + struct file *filep;
12876 + struct inode *ino;
12879 + fd = (int)get_syscall_parameter (regs, 0);
12881 + filep = fget(fd);
12886 + ino = filep->f_dentry->d_inode;
12888 + || (MAJOR(ino->i_rdev) == 30 && MINOR(ino->i_rdev) == 1))
12889 + error = timod_putmsg(fd, ino, 1, regs);
12894 +EXPORT_SYMBOL(svr4_putpmsg);
12896 +#endif /* CONFIG_ABI_XTI */
12897 diff -uNr --exclude-from=dontdiff linux-2.4.3/abi/svr4/svr4.c linux/abi/svr4/svr4.c
12898 --- linux-2.4.3/abi/svr4/svr4.c Thu Jan 1 01:00:00 1970
12899 +++ linux/abi/svr4/svr4.c Sun Mar 18 11:54:28 2001
12903 + * This file contains the emulation of some simple sysv syscalls
12905 + * Copyright (C) 1995 Mike Jagdis
12909 +#include <linux/config.h>
12910 +#include <linux/module.h>
12912 +#include <asm/uaccess.h>
12914 +#include <linux/types.h>
12915 +#include <linux/errno.h>
12916 +#include <linux/sched.h>
12917 +#include <linux/kernel.h>
12918 +#include <linux/mm.h>
12919 +#include <linux/stddef.h>
12920 +#include <linux/unistd.h>
12921 +#include <linux/ptrace.h>
12922 +#include <linux/fcntl.h>
12923 +#include <linux/time.h>
12925 +#include <asm/system.h>
12926 +#include <linux/fs.h>
12927 +#include <linux/sys.h>
12928 +#include <linux/slab.h>
12930 +#include <abi/abi.h>
12931 +#include <abi/abi4.h>
12932 +#include <abi/svr4.h>
12933 +#include <abi/trace.h>
12934 +#include <abi/svr4sig.h>
12935 +#include <abi/solaris.h>
12938 + * Interactive SVR4's /bin/sh calls access(... 011) but Linux returns
12939 + * EINVAL if the access mode has any other bits than 007 set.
12943 +svr4_access(char *path, int mode)
12945 + return SYS(access)(path, mode & 007);
12950 +svr4_getgroups(int n, unsigned long *buf)
12955 + i = verify_area(VERIFY_WRITE, buf, sizeof(unsigned long) * n);
12959 + for (i = 0; i < current->ngroups && i < n; i++) {
12960 + put_user(current->groups[i], buf);
12968 +svr4_setgroups(int n, unsigned long *buf)
12972 + if (!capable(CAP_SETGID))
12976 + /* FIXME: Yuk! What if we hit a bad address? */
12977 + for (i = 0; i < n; i++, buf++) {
12978 + get_user(current->groups[i], buf);
12980 + current->ngroups = n;
12986 +svr4_waitid(int idtype, int id, struct svr4_siginfo *infop, int options)
12988 + long result, kopt;
12989 + mm_segment_t old_fs;
12992 + switch (idtype) {
12993 + case 0: /* P_PID */
12997 + case 1: /* P_PGID */
13001 + case 7: /* P_ALL */
13010 + result = verify_area(VERIFY_WRITE, infop,
13011 + sizeof(struct svr4_siginfo));
13017 + if (options & 0100) kopt |= WNOHANG;
13018 + if (options & 4) kopt |= WUNTRACED;
13020 + old_fs = get_fs();
13021 + set_fs(get_ds());
13022 + result = SYS(wait4)(pid, &status, kopt, NULL);
13028 + unsigned long op, st;
13030 + put_user(current->exec_domain->signal_map[SIGCHLD],
13031 + &infop->si_signo);
13033 + &infop->_data._proc._pid);
13035 + if ((status & 0xff) == 0) {
13036 + /* Normal exit. */
13037 + op = SVR4_CLD_EXITED;
13038 + st = status >> 8;
13039 + } else if ((status & 0xff) == 0x7f) {
13041 + st = (status & 0xff00) >> 8;
13042 + op = (st == SIGSTOP || st == SIGTSTP)
13043 + ? SVR4_CLD_STOPPED
13044 + : SVR4_CLD_CONTINUED;
13045 + st = current->exec_domain->signal_invmap[st];
13047 + st = (status & 0xff00) >> 8;
13048 + op = (status & 0200)
13049 + ? SVR4_CLD_DUMPED
13050 + : SVR4_CLD_KILLED;
13051 + st = current->exec_domain->signal_invmap[st];
13053 + put_user(op, &infop->si_code);
13054 + put_user(st, &infop->_data._proc._pdata._cld._status);
13059 +EXPORT_SYMBOL(svr4_waitid);
13062 +svr4_seteuid(int uid)
13064 + return SYS(setreuid)(-1, uid);
13068 +svr4_setegid(int gid)
13070 + return SYS(setregid)(-1, gid);
13074 +svr4_pathconf(char *path, int name)
13077 + case _PC_LINK_MAX:
13078 + /* Although Linux headers define values on a per
13079 + * filesystem basis there is no way to access
13080 + * these without hard coding fs information here
13081 + * so for now we use a bogus value.
13085 + case _PC_MAX_CANON:
13086 + return MAX_CANON;
13088 + case _PC_MAX_INPUT:
13089 + return MAX_INPUT;
13091 + case _PC_PATH_MAX:
13094 + case _PC_PIPE_BUF:
13097 + case _PC_CHOWN_RESTRICTED:
13098 + /* We should really think about this and tell
13103 + case _PC_NO_TRUNC:
13104 + /* Not sure... It could be fs dependent? */
13107 + case _PC_VDISABLE:
13110 + case _PC_NAME_MAX: {
13111 + struct statfs buf;
13114 + mm_segment_t old_fs;
13116 + p = getname(path);
13117 + error = PTR_ERR(p);
13118 + if (!IS_ERR(p)) {
13119 + old_fs = get_fs();
13120 + set_fs (get_ds());
13121 + error = SYS(statfs)(p, &buf);
13125 + return buf.f_namelen;
13134 +EXPORT_SYMBOL(svr4_pathconf);
13137 +svr4_fpathconf(int fildes, int name)
13140 + case _PC_LINK_MAX:
13141 + /* Although Linux headers define values on a per
13142 + * filesystem basis there is no way to access
13143 + * these without hard coding fs information here
13144 + * so for now we use a bogus value.
13148 + case _PC_MAX_CANON:
13149 + return MAX_CANON;
13151 + case _PC_MAX_INPUT:
13152 + return MAX_INPUT;
13154 + case _PC_PATH_MAX:
13157 + case _PC_PIPE_BUF:
13160 + case _PC_CHOWN_RESTRICTED:
13161 + /* We should really think about this and tell
13166 + case _PC_NO_TRUNC:
13167 + /* Not sure... It could be fs dependent? */
13170 + case _PC_VDISABLE:
13173 + case _PC_NAME_MAX: {
13174 + struct statfs buf;
13176 + mm_segment_t old_fs;
13178 + old_fs = get_fs();
13179 + set_fs (get_ds());
13180 + error = SYS(statfs)(fildes, &buf);
13183 + return buf.f_namelen;
13191 +EXPORT_SYMBOL(svr4_fpathconf);
13194 +svr4_sigpending(int which_routine, svr4_sigset_t *set)
13196 + /* Solaris multiplexes on this one */
13197 + /* Which routine has the actual routine that should be called */
13199 + switch (which_routine){
13200 + case 1: /* sigpending */
13201 + printk ("iBCS/Intel: sigpending not implemented\n");
13204 + case 2: /* sigfillset */
13205 + set->setbits [0] = ~0;
13206 + set->setbits [1] = 0;
13207 + set->setbits [2] = 0;
13208 + set->setbits [3] = 0;
13214 +EXPORT_SYMBOL(svr4_sigpending);
13217 +svr4_setcontext(svr4_ucontext_t *c, struct pt_regs *regs)
13219 + printk (KERN_DEBUG "Getting context\n");
13224 +svr4_getcontext(svr4_ucontext_t *c, struct pt_regs *regs)
13226 + printk (KERN_DEBUG "Setting context\n");
13231 +svr4_context(struct pt_regs *regs)
13233 + int context_fn = get_syscall_parameter (regs, 0);
13234 + struct svr4_ucontext_t *uc = (void *) get_syscall_parameter (regs, 1);
13236 + switch (context_fn){
13237 + case 0: /* getcontext */
13238 + return svr4_getcontext (uc, regs);
13240 + case 1: /* setcontext */
13241 + return svr4_setcontext (uc, regs);
13246 +EXPORT_SYMBOL(svr4_context);
13247 diff -uNr --exclude-from=dontdiff linux-2.4.3/abi/svr4/sysconf.c linux/abi/svr4/sysconf.c
13248 --- linux-2.4.3/abi/svr4/sysconf.c Thu Jan 1 01:00:00 1970
13249 +++ linux/abi/svr4/sysconf.c Mon Mar 12 16:34:48 2001
13252 + * sysconf.c - sysv sysconf(2) and sysconfig(2) emulation
13254 + * Copyright (C) 1994 Mike Jagdis (jaggy@purplet.demon.co.uk)
13257 +#include <linux/module.h>
13258 +#include <linux/errno.h>
13259 +#include <linux/sched.h>
13260 +#include <linux/kernel.h>
13261 +#include <linux/mm.h>
13262 +#include <linux/stddef.h>
13263 +#include <linux/limits.h>
13264 +#include <linux/unistd.h>
13265 +#include <linux/ptrace.h>
13266 +#include <linux/fcntl.h>
13267 +#include <linux/smp.h>
13268 +#include <linux/swap.h>
13269 +#include <linux/fs.h>
13270 +#include <linux/sys.h>
13271 +#include <asm/uaccess.h>
13272 +#include <asm/system.h>
13274 +#include <abi/abi.h>
13275 +#include <abi/svr4.h>
13276 +#include <abi/trace.h>
13279 +/* The sysconf() call is supposed to give applications access to various
13280 + * kernel parameters. According to SCO's man page this a POSIX mandated
13281 + * function. Perhaps it should be moved across as a native Linux call?
13283 + * N.B. SCO only has sysconf in the Xenix group. Therefore this is based
13284 + * on the Xenix spec. Is SVR4 the same? Wyse Unix V.3.2.1A doesn't have
13285 + * sysconf documented at all.
13287 + * N.B. 0-7 are required (by who?). Other values may be defined for
13288 + * various systems but there appears no guarantee that they match across
13289 + * platforms. Thus, unless we can identify what system the executable
13290 + * was compiled for, we probably prefer to have extensions fail. Hell,
13291 + * nothing important is going to use this obscure stuff anyway...
13293 +#define _SC_ARG_MAX 0
13294 +#define _SC_CHILD_MAX 1
13295 +#define _SC_CLK_TCK 2
13296 +#define _SC_NGROUPS_MAX 3
13297 +#define _SC_OPEN_MAX 4
13298 +#define _SC_JOB_CONTROL 5
13299 +#define _SC_SAVED_IDS 6
13300 +#define _SC_VERSION 7
13302 +#define _SC_PAGESIZE 11
13303 +#define _SCO_SC_PAGESIZE 34
13305 +extern int max_threads;
13308 +/* This is an SVR4 system call that is undocumented except for some
13309 + * hints in a header file. It appears to be a forerunner to the
13310 + * POSIX sysconf() call.
13312 +int svr4_sysconfig(int name)
13315 + case _CONFIG_NGROUPS:
13316 + /* From limits.h */
13317 + return (NGROUPS_MAX);
13319 + case _CONFIG_CHILD_MAX:
13320 + /* From limits.h */
13321 + return (CHILD_MAX);
13323 + case _CONFIG_OPEN_FILES:
13324 + /* From limits.h */
13325 + return (OPEN_MAX);
13327 + case _CONFIG_POSIX_VER:
13328 + /* The version of the POSIX standard we conform
13329 + * to. SCO defines _POSIX_VERSION as 198808L
13330 + * sys/unistd.h. What are we? We are 199009L.
13332 + return (199009L);
13334 + case _CONFIG_PAGESIZE:
13335 + return (PAGE_SIZE);
13337 + case _CONFIG_CLK_TCK:
13340 + case _CONFIG_XOPEN_VER:
13343 + case _CONFIG_NACLS_MAX:
13346 + case _CONFIG_NPROC:
13347 + return max_threads;
13349 + case _CONFIG_NENGINE:
13350 + case _CONFIG_NENGINE_ONLN:
13351 + return (smp_num_cpus);
13353 + case _CONFIG_TOTAL_MEMORY:
13354 + return (max_mapnr << (PAGE_SHIFT-10));
13356 + case _CONFIG_USEABLE_MEMORY:
13357 + case _CONFIG_GENERAL_MEMORY:
13358 + return ((unsigned long) (nr_free_pages()) << (PAGE_SHIFT-10));
13360 + case _CONFIG_DEDICATED_MEMORY:
13363 + case _CONFIG_NCGS_CONF:
13364 + case _CONFIG_NCGS_ONLN:
13365 + case _CONFIG_MAX_ENG_PER_CG:
13366 + return 1; /* no NUMA-Q support on Linux yet */
13368 + case _CONFIG_CACHE_LINE:
13369 + return 32; /* XXX is there a more accurate way? */
13371 + case _CONFIG_KERNEL_VM:
13374 + case _CONFIG_ARG_MAX:
13375 + /* From limits.h */
13376 + return (ARG_MAX);
13379 + abi_trace(ABI_TRACE_API, "unsupported sysconfig call %d", name);
13384 +int ibcs_sysconf(int name)
13387 + case _SC_ARG_MAX:
13388 + /* From limits.h */
13389 + return (ARG_MAX);
13391 + case _SC_CHILD_MAX:
13392 + /* From limits.h */
13393 + return (CHILD_MAX);
13395 + case _SC_CLK_TCK:
13398 + case _SC_NGROUPS_MAX:
13399 + /* From limits.h */
13400 + return (NGROUPS_MAX);
13402 + case _SC_OPEN_MAX:
13403 + /* From limits.h */
13404 + return (OPEN_MAX);
13406 + case _SC_JOB_CONTROL:
13409 + case _SC_SAVED_IDS:
13412 + case _SC_PAGESIZE:
13413 + case _SCO_SC_PAGESIZE:
13414 + return PAGE_SIZE;
13416 + case _SC_VERSION:
13417 + /* The version of the POSIX standard we conform
13418 + * to. SCO defines _POSIX_VERSION as 198808L
13419 + * sys/unistd.h. What are we?
13421 + return (198808L);
13424 + abi_trace(ABI_TRACE_API, "unsupported sysconf call %d", name);
13428 +EXPORT_SYMBOL(svr4_sysconfig);
13429 diff -uNr --exclude-from=dontdiff linux-2.4.3/abi/svr4/sysfs.c linux/abi/svr4/sysfs.c
13430 --- linux-2.4.3/abi/svr4/sysfs.c Thu Jan 1 01:00:00 1970
13431 +++ linux/abi/svr4/sysfs.c Mon Mar 12 16:34:48 2001
13434 + * sysfs.c - sysfs(2) emulation
13436 + * Copyright (C) 1994 Mike Jagdis (jaggy@purplet.demon.co.uk)
13439 +#include <linux/module.h>
13440 +#include <asm/uaccess.h>
13441 +#include <abi/abi.h>
13442 +#include <abi/trace.h>
13445 + * The kernel sysfs() code is almost all we need but, apparently,
13446 + * the SCO (at least) sysfs() will also accept a "magic number"
13447 + * as an index argument and will return the name of the relevant
13448 + * file system. Since Linux doesn't have any concept of fs magic
13449 + * numbers outside the file system code themselves there is no
13450 + * clean way to do it in the kernel. There isn't a clean way to
13451 + * to it here either but it needs to be done somehow :-(.
13454 +#define GETFSIND 1
13455 +#define GETFSTYP 2
13456 +#define GETNFSTYP 3
13460 +svr4_sysfs(int cmd, int arg1, int arg2)
13462 + if (cmd == GETFSIND)
13463 + return SYS(sysfs)(cmd, (char *)arg1);
13465 + if (cmd == GETNFSTYP)
13466 + return SYS(sysfs)(cmd);
13468 + if (cmd == GETFSTYP) {
13469 + char *buf = (char *)arg2;
13472 + if (arg1 & 0x80000000)
13473 + arg1 &= 0x0000ffff;
13474 + if (arg1 >= 0 && arg1 < SYS(sysfs)(GETNFSTYP))
13475 + return SYS(sysfs)(cmd, arg1-1, arg2);
13478 + * Kludge alert! Hardcoded known magic numbers!
13481 + case 0xef53: case 0xffffef53:
13482 + case 0xef51: case 0xffffef51:
13484 + * Some SCO programs (i.e. Informix Dynamic
13485 + * Server are using this to detect "real"
13486 + * filesystems by checking type names :-(.
13489 + if (personality(PER_SCOSVR3))
13490 + error = copy_to_user(buf, "HTFS", 5);
13492 + error = copy_to_user(buf, "ext2", 5);
13495 + error = copy_to_user(buf, "ext", 4);
13497 + case 0x9660: case 0xffff9660:
13498 + error = copy_to_user(buf, "iso9660", 8);
13501 + error = copy_to_user(buf, "msdos", 6);
13504 + error = copy_to_user(buf, "nfs", 4);
13506 + case 0x9fa0: case 0xffff9fa0:
13507 + error = copy_to_user(buf, "proc", 5);
13510 + case 0xe849: case 0xffffe849:
13511 + error = copy_to_user(buf, "hpfs", 5);
13513 + case 0x137f: /* original */
13514 + case 0x138f: /* original + 30 char names */
13515 + case 0x2468: /* V2 */
13516 + case 0x2478: /* V2 + 30 char names */
13517 + error = copy_to_user(buf, "minix", 6);
13520 + error = copy_to_user(buf, "ncpfs", 6);
13523 + error = copy_to_user(buf, "smbfs", 6);
13526 + error = copy_to_user(buf, "ufs", 4);
13528 + case 0x012fd16d: case 0xffffd16d:
13529 + error = copy_to_user(buf, "xiafs", 6);
13531 + case 0x012ff7b3+1: case 0xfffff7b3+1:
13532 + error = copy_to_user(buf, "xenix", 6);
13534 + case 0x012ff7b3+2: case 0xfffff7b3+2:
13535 + case 0x012ff7b3+3: case 0xfffff7b3+3:
13536 + error = copy_to_user(buf, "sysv", 5);
13538 + case 0x012ff7b3+4: case 0xfffff7b3+4:
13539 + error = copy_to_user(buf, "coherent", 9);
13542 + error = copy_to_user(buf, "", 1);
13548 + abi_trace(ABI_TRACE_API, "unsupported sysfs call %d", cmd);
13551 +EXPORT_SYMBOL(svr4_sysfs);
13552 diff -uNr --exclude-from=dontdiff linux-2.4.3/abi/svr4/sysi86.c linux/abi/svr4/sysi86.c
13553 --- linux-2.4.3/abi/svr4/sysi86.c Thu Jan 1 01:00:00 1970
13554 +++ linux/abi/svr4/sysi86.c Mon Mar 12 16:34:48 2001
13557 + * sysi86.c - ix86 spcific sysv syscalls
13559 + * Copyright 1994,1995 Mike Jagdis <jaggy@purplet.demon.co.uk>
13562 +#include <linux/module.h>
13563 +#include <linux/errno.h>
13564 +#include <linux/sched.h>
13565 +#include <linux/kernel.h>
13566 +#include <linux/mm.h>
13567 +#include <linux/stddef.h>
13568 +#include <linux/unistd.h>
13569 +#include <linux/ptrace.h>
13570 +#include <linux/fcntl.h>
13571 +#include <linux/fs.h>
13572 +#include <linux/sys.h>
13574 +#include <asm/uaccess.h>
13575 +#include <asm/system.h>
13577 +#include <abi/abi.h>
13578 +#include <abi/trace.h>
13581 +/* The sysi86() call is used for machine specific functions. Only the
13582 + * most basic are implemented here.
13584 +#define SI86SWPI 1 /* General swap functions. */
13585 +#define SI86SYM 2 /* Get symbol table */
13586 +#define SI86CONF 4 /* Get configuration table */
13587 +#define SI86BOOT 5 /* Get timestamp and name of program
13590 +#define SI86DMM 7 /* Double-map data segment for
13591 + * read/write/execute support
13593 +#define SI86AUTO 9 /* Was an auto-config boot done? */
13594 +#define SI86EDT 10 /* Copy contents of EDT to user */
13595 +#define SI86SWAP 12 /* Declare swap space */
13596 +#define SI86FPHW 40 /* what (if any?) floating-point hardware */
13597 +# define FP_NO 0 /* No fp at all */
13598 +# define FP_SW 1 /* using emulator */
13599 +# define FP_HW 2 /* using hardware */
13600 +# define FP_287 2 /* using a 287 */
13601 +# define FP_387 3 /* using a 387 */
13602 +#define GRNON 52 /* set green light to solid on state */
13603 +#define GRNFLASH 53 /* start green light flashing */
13604 +#define STIME 54 /* set internal time */
13605 +#define SETNAME 56 /* rename the system */
13606 +#define RNVR 58 /* read NVRAM */
13607 +#define WNVR 59 /* write NVRAM */
13608 +#define RTODC 60 /* read time of day clock */
13609 +#define CHKSER 61 /* check soft serial number */
13610 +#define SI86NVPRT 62 /* print an xtra_nvr structure */
13611 +#define SANUPD 63 /* sanity update of kernel buffers */
13612 +#define SI86KSTR 64 /* make a copy of a kernel string */
13613 +#define SI86MEM 65 /* return the memory size of system */
13614 +#define SI86TODEMON 66 /* Transfer control to firmware. */
13615 +#define SI86CCDEMON 67 /* Control character access to demon. */
13616 +#define SI86CACHE 68 /* Turn cache on and off. */
13617 +#define SI86DELMEM 69 /* Delete available memory for testing. */
13618 +#define SI86ADDMEM 70 /* Add back deleted memory. */
13619 +/* 71 through 74 reserved for VPIX */
13620 +#define SI86V86 71 /* V86 system calls (see v86.h) */
13621 +#define SI86SLTIME 72 /* Set local time correction */
13622 +#define SI86DSCR 75 /* Set a segment or gate descriptor */
13623 +#define RDUBLK 76 /* Read U Block */
13624 +/* #ifdef MERGE386 */
13625 +/* NFA entry point */
13626 +#define SI86NFA 77 /* make nfa_sys system call */
13627 +#define SI86VM86 81
13628 +#define SI86VMENABLE 82
13629 +/* #endif MERGE386 */
13630 +#define SI86VM86 81
13631 +#define SI86VMENABLE 82
13632 +#define SI86LIMUSER 91 /* liscense interface */
13633 +#define SI86RDID 92 /* ROM BIOS Machid ID */
13634 +#define SI86RDBOOT 93 /* Bootable Non-SCSI Hard Disk */
13635 +/* Merged Product defines */
13636 +#define SI86SHFIL 100 /* map a file into addr space of a proc */
13637 +#define SI86PCHRGN 101 /* make globally visible change to a region */
13638 +#define SI86BADVISE 102 /* badvise subcommand - see below for */
13639 + /* badvise subfunction definitions */
13640 +#define SI86SHRGN 103 /* enable/disable XENIX small model shared */
13641 + /* data context switching */
13642 +#define SI86CHIDT 104 /* set user level int 0xf0, ... 0xff handlers */
13643 +#define SI86EMULRDA 105 /* remove special emulator read access */
13644 +#define SI86GETPIPE 106 /* return the pipe filesystem */
13645 +#define SI86SETPIPE 107 /* set the pipe filesystem */
13646 +#define SI86SETPIPE_NM 108 /* set the pipe filesystem -non mountable */
13647 +#define SI86GETNPIPE 109 /* get # of pipe filesystems */
13648 +#define SI86GETPIPE_ALL 110 /* get data on all of pipe filesystems */
13649 +#define SI86POPPIPE 111 /* pop pipe file system off stack */
13650 +#define SI86APM 112 /* get APM information passed by boot(HW) */
13651 +#define SI86TIMECHG 113 /* get time before/after last timechange */
13652 +#define SI86GETFEATURES 114 /* get os features vector */
13654 +/* The SI86BADVISE command is used to set Xenix behaviour. */
13655 +#define SI86B_SET 0x0100 /* Set badvise bits */
13656 +#define SI86B_GET 0x0200 /* Get badvise bits */
13657 +#define SI86B_LOCK 0x0001 /* XENIX advisory locking bit */
13658 +#define SI86B_PRE_SV 0x0008 /* follow pre-System V x.out behavior */
13659 +#define SI86B_XOUT 0x0010 /* follow XENIX x.out behavior */
13660 +#define SI86B_XSDSWTCH 0x0080 /* XENIX small model shared data */
13661 + /* context switching enabled */
13665 + * The SI86DSCR subcommand of the sysi86() system call
13666 + * sets a segment or gate descriptor in the kernel.
13667 + * The following descriptor types are accepted:
13668 + * - executable and data segments in the LDT at DPL 3
13669 + * - a call gate in the GDT at DPL 3 that points to a segment in the LDT
13670 + * The request structure declared below is used to pass the values
13671 + * to be placed in the descriptor. A pointer to the structure is
13672 + * passed as the second argument of the system call.
13673 + * If acc1 is zero, the descriptor is cleared.
13676 +/* request structure passed by user */
13678 + unsigned int sel; /* descriptor selector */
13679 + unsigned int bo; /* segment base or gate offset */
13680 + unsigned int ls; /* segment limit or gate selector */
13681 + unsigned int acc1; /* access byte 5 */
13682 + unsigned int acc2; /* access bits in byte 6 or gate count */
13687 +int svr4_sysi86(struct pt_regs * regs)
13691 + error = get_user(cmd, ((unsigned long *) regs->esp) + 1);
13697 + unsigned long *np;
13699 + /* If we remove the 'static' from the definition
13700 + * of fpu_error in linux/init/main.c we can tell
13701 + * whether we are using hardware or software at
13702 + * least. For now let's lie... (actually SCO
13703 + * Unix 3.4 gives me -1...)
13705 + get_user((unsigned long) np, ((unsigned long *) regs->esp) + 2);
13706 + error = verify_area(VERIFY_WRITE, np, sizeof(int));
13709 + put_user(FP_387, np);
13714 + /* Set the system time. The argument is a long,
13715 + * sys_stime() expects a pointer to a long...
13717 + return SYS(stime)(((unsigned long *) regs->esp) + 2);
13721 + /* The name is required to be string of no more
13722 + * than 7 characters. We don't get passed the
13723 + * length so we are depending upon the current
13724 + * implementation of sys_sethostname() here.
13728 + error = get_user((unsigned long) cp, ((unsigned long *) regs->esp) + 2);
13731 + return SYS(sethostname)(cp, 7);
13735 + /* Returns the size of physical memory.
13737 + struct sysinfo i;
13740 + return i.totalram;
13743 +#if defined(CONFIG_ABI_IBCS_SCO)
13744 + case SI86GETFEATURES: {
13748 + if (!personality(PER_SCOSVR3)) {
13749 + current->personality &= ~PER_MASK;
13750 + current->personality |= PER_SCOSVR3;
13754 + error = get_user((unsigned long) vec, ((unsigned long *) regs->esp) + 2);
13756 + error = get_user(len, ((unsigned long *) regs->esp) + 3);
13759 + /* No, I don't know what these feature flags actually
13760 + * _mean_. This vector just matches SCO OS 5.0.0.
13762 + used = len > 12 ? 12 : len;
13763 + return copy_to_user(vec, "\001\001\001\001\001\001\001\001\002\001\001\001", used) ? -EFAULT : used;
13772 + unsigned long ssdptr;
13774 + error = get_user(ssdptr, ((unsigned long *)regs->esp) + 2);
13777 + error = copy_from_user(&buf, (void *)ssdptr, sizeof(struct ssd));
13781 + printk("SI86DSCR(%x,%x,%x,%x,%x)\n",buf.sel,buf.bo,buf.ls,buf.acc1,buf.acc2);
13786 + abi_trace(ABI_TRACE_API, "unsupported sysi86 call %d", cmd);
13790 +EXPORT_SYMBOL(svr4_sysi86);
13791 diff -uNr --exclude-from=dontdiff linux-2.4.3/abi/svr4/sysinfo.c linux/abi/svr4/sysinfo.c
13792 --- linux-2.4.3/abi/svr4/sysinfo.c Thu Jan 1 01:00:00 1970
13793 +++ linux/abi/svr4/sysinfo.c Mon Mar 12 16:34:48 2001
13797 + * sysv sysinfo(2) syscall
13799 + * Copyright (C) 1995 Eric Youngdale
13803 +#include <linux/config.h>
13804 +#include <linux/module.h>
13805 +#include <linux/version.h>
13806 +#include <linux/compile.h>
13808 +#include <asm/uaccess.h>
13810 +#include <linux/mm.h>
13811 +#include <linux/errno.h>
13812 +#include <linux/sched.h>
13813 +#include <abi/abi.h>
13814 +#include <linux/utsname.h>
13815 +#include <abi/trace.h>
13818 +#define __O_SI_SYSNAME 1 /* return name of operating system */
13819 +#define __O_SI_HOSTNAME 2 /* return name of node */
13820 +#define SI_RELEASE 3 /* return release of operating system */
13821 +#define SI_VERSION 4 /* return version field of utsname */
13822 +#define __O_SI_MACHINE 5 /* return kind of machine */
13823 +#define __O_SI_ARCHITECTURE 6 /* return instruction set arch */
13824 +#define SI_HW_SERIAL 7 /* return hardware serial number */
13825 +#define __O_SI_HW_PROVIDER 8 /* return hardware manufacturer */
13826 +#define SI_SRPC_DOMAIN 9 /* return secure RPC domain */
13827 +#define SI_INITTAB_NAME 10 /* return name of inittab file used */
13828 +#define SI_ARCHITECTURE 100 /* return instruction set arch */
13829 +#define SI_BUSTYPES 101 /* return list of bus types */
13830 +#define SI_HOSTNAME 102 /* return fully-qualified node name */
13831 +#define SI_HW_PROVIDER 103 /* return hardware manufacturer */
13832 +#define SI_KERNEL_STAMP 104 /* return kernel generation timestamp */
13833 +#define SI_MACHINE 105 /* return kind of machine */
13834 +#define SI_OS_BASE 106 /* return base operating system */
13835 +#define SI_OS_PROVIDER 107 /* return operating system provider */
13836 +#define SI_SYSNAME 108 /* return name of operating system */
13837 +#define SI_USER_LIMIT 109 /* return maximum number of users */
13841 +int svr4_sysinfo(int cmd, char * buf, long count)
13843 + char * return_string;
13844 + static unsigned int serial_number = 0;
13849 + return_string = NULL;
13852 + case __O_SI_SYSNAME:
13854 + return_string = system_utsname.sysname;
13856 + case __O_SI_HOSTNAME:
13857 + case SI_HOSTNAME:
13858 + return_string = system_utsname.nodename;
13861 + return_string = "2";
13864 + return_string = system_utsname.release;
13867 + case __O_SI_MACHINE:
13868 + return_string = system_utsname.machine;
13870 + case __O_SI_ARCHITECTURE:
13871 + case SI_ARCHITECTURE:
13872 + return_string = "IA32"; /* XXX: this seems wrong, the name ia32 is very new ... -- ch */
13874 + case SI_BUSTYPES:
13875 + return_string = "PCI ISA";
13877 + case __O_SI_HW_PROVIDER:
13878 + case SI_HW_PROVIDER:
13879 + return_string = "Generic AT";
13881 + case SI_KERNEL_STAMP:
13882 + return_string = UTS_VERSION;
13884 + case SI_INITTAB_NAME:
13885 + return_string = "/etc/inittab";
13887 + case SI_HW_SERIAL:
13888 + if(serial_number == 0)
13889 + serial_number = 0xdeadbeef;
13890 + sprintf(buffer,"%8.8x", serial_number);
13891 + return_string = buffer;
13894 + return_string = "Linux";
13896 + case SI_OS_PROVIDER:
13897 + return_string = "LBT"; /* someone's initials ? */
13899 + case SI_SRPC_DOMAIN:
13900 + return_string = system_utsname.domainname;
13902 + case SI_USER_LIMIT:
13903 + /* have you seen a Linux box with more than 500000 users? */
13904 + return_string = "500000";
13907 + abi_trace(ABI_TRACE_API,
13908 + "unsupported sysinfo call %d", cmd);
13912 + if (!return_string)
13915 + down_read(&uts_sem);
13916 + slen = (count < strlen(return_string) + 1 ? count : strlen(return_string) + 1);
13917 + error = copy_to_user(buf, return_string, slen);
13918 + up_read(&uts_sem);
13920 + return error ? -EFAULT : slen;
13923 +EXPORT_SYMBOL(svr4_sysinfo);
13924 diff -uNr --exclude-from=dontdiff linux-2.4.3/abi/svr4/syslocal.c linux/abi/svr4/syslocal.c
13925 --- linux-2.4.3/abi/svr4/syslocal.c Thu Jan 1 01:00:00 1970
13926 +++ linux/abi/svr4/syslocal.c Mon Mar 12 16:34:48 2001
13929 + * syslocal.c - wyse syslocal(2) emulation
13931 + * Copyright (C) 1994 Mike Jagdis (jaggy@purplet.demon.co.uk)
13934 +#include <linux/module.h>
13935 +#include <linux/errno.h>
13936 +#include <asm/uaccess.h>
13938 +#include <abi/abi.h>
13939 +#include <abi/trace.h>
13943 + * The syslocal() call is used for machine specific functions. For
13944 + * instance on a Wyse 9000 it give information and control of the
13945 + * available processors.
13947 +#ifdef CONFIG_ABI_IBCS_WYSE
13948 +# define SL_ONLINE 0 /* Turn processor online */
13949 +# define SL_OFFLINE 1 /* Turn processor offline */
13950 +# define SL_QUERY 2 /* Query processor status */
13951 +# define SL_NENG 3 /* Return No. of processors configured */
13952 +# define SL_AFFINITY 4 /* processor binding */
13953 +# define SL_CMC_STAT 7 /* gather CMC performance counters info */
13954 +# define SL_KACC 8 /* make kernel data readable by user */
13955 +# define SL_MACHTYPE 9 /* return machine type (MP/AT) */
13956 +# define SL_BOOTNAME 10 /* return name of booted kernel */
13957 +# define SL_BOOTDEV 11 /* return type of booted device */
13958 +# define SL_UQUERY 12 /* query user status */
13960 +# define SL_MACH_MP 0
13961 +# define SL_MACH_AT 1
13962 +# define SL_MACH_EISA 2
13963 +# define SL_MACH_EMP 3
13968 +svr4_syslocal(struct pt_regs * regs)
13972 + cmd = get_syscall_parameter (regs, 0);
13974 +#ifdef CONFIG_ABI_IBCS_WYSE
13982 + case SL_MACHTYPE:
13983 + return (EISA_bus ? SL_MACH_EISA : SL_MACH_AT);
13987 + abi_trace(ABI_TRACE_API, "unsupported syslocal call %d", cmd);
13990 +EXPORT_SYMBOL(svr4_syslocal);
13991 diff -uNr --exclude-from=dontdiff linux-2.4.3/abi/svr4/timod.c linux/abi/svr4/timod.c
13992 --- linux-2.4.3/abi/svr4/timod.c Thu Jan 1 01:00:00 1970
13993 +++ linux/abi/svr4/timod.c Fri Mar 30 15:23:46 2001
13997 + * Copyright 1995, 1996 Mike Jagdis (jaggy@purplet.demon.co.uk)
14001 +#include <linux/config.h>
14003 +#ifdef CONFIG_ABI_XTI
14004 +#include <linux/module.h>
14005 +#include <linux/version.h>
14007 +#include <asm/uaccess.h>
14009 +#include <linux/types.h>
14010 +#include <linux/errno.h>
14011 +#include <linux/fs.h>
14012 +#include <linux/ptrace.h>
14013 +#include <linux/sched.h>
14014 +#include <linux/kernel.h>
14015 +#include <linux/slab.h>
14016 +#include <linux/mm.h>
14017 +#include <linux/fcntl.h>
14018 +#include <linux/socket.h>
14019 +#include <linux/in.h>
14020 +#include <linux/un.h>
14021 +#include <linux/file.h>
14022 +#include <linux/poll.h>
14024 +#include <net/sock.h>
14026 +#include <abi/abi.h>
14027 +#include <abi/stream.h>
14028 +#include <abi/tli.h>
14029 +#include <abi/trace.h>
14032 +static __inline__ struct socket *
14033 +socki_lookup(struct inode * inode)
14035 + return &(inode->u.socket_i);
14040 + * This is because TLI and XTI options buffers are incompatible and there
14041 + * is no clear way to detect which format we are dealing with here.
14042 + * Existing systems appear to have TLI options management implemented
14043 + * but return TNOTSUPPORT for XTI requests.
14045 +#if defined(CONFIG_ABI_XTI_OPTMGMT) && defined(CONFIG_ABI_TLI_OPTMGMT)
14046 +# error "unable to support _both_ TLI and XTI option management"
14054 + "T_CONN_REQ", "T_CONN_RES", "T_DISCON_REQ", "T_DATA_REQ",
14055 + "T_EXDATA_REQ", "T_INFO_REQ", "T_BIND_REQ", "T_UNBIND_REQ",
14056 + "T_UNITDATA_REQ", "T_OPTMGMT_REQ", "T_ORDREL_REQ",
14057 + "T_CONN_IND", "T_CONN_CON", "T_DISCON_IND", "T_DATA_IND",
14058 + "T_EXDATA_IND", "T_INFO_ACK", "T_BIND_ACK", "T_ERROR_ACK",
14059 + "T_OK_ACK", "T_UNITDATA_IND", "T_UDERROR_IND",
14060 + "T_OPTMGMT_ACK", "T_ORDREL_IND"
14063 + if (n < 0 || n >= sizeof(tab)/sizeof(tab[0]))
14064 + return "<unknown>";
14069 +#define timod_mkctl(len) kmalloc(sizeof(struct T_primsg)-sizeof(long)+len, \
14074 +timod_socket_wakeup(struct file * fp)
14076 + struct socket * sock;
14078 + sock = socki_lookup(fp->f_dentry->d_inode);
14079 + wake_up_interruptible(&sock->wait);
14081 + read_lock(&sock->sk->callback_lock);
14082 + if (sock->fasync_list && !test_bit(SOCK_ASYNC_WAITDATA, &sock->flags))
14083 + __kill_fasync(sock->fasync_list, SIGIO, POLL_IN);
14084 + read_unlock(&sock->sk->callback_lock);
14089 +timod_ok(int fd, int prim)
14091 + struct file * fp = fcheck(fd);
14092 + struct T_primsg * it;
14093 + struct T_ok_ack * ok;
14095 + abi_trace(ABI_TRACE_STREAMS, "%u ok ack prim=%d", fd, prim);
14097 + if (!(it = timod_mkctl(sizeof(struct T_ok_ack))))
14100 + ok = (struct T_ok_ack *)&it->type;
14101 + ok->PRIM_type = T_OK_ACK;
14102 + ok->CORRECT_prim = prim;
14104 + it->pri = MSG_HIPRI;
14105 + it->length = sizeof(struct T_ok_ack);
14106 + it->next = Priv(fp)->pfirst;
14108 + Priv(fp)->pfirst = it;
14109 + if (!Priv(fp)->plast)
14110 + Priv(fp)->plast = it;
14111 + timod_socket_wakeup(fp);
14115 +timod_error(int fd, int prim, int terr, int uerr)
14117 + struct file * fp = fcheck(fd);
14118 + struct T_primsg * it;
14119 + struct T_error_ack * err;
14121 + abi_trace(ABI_TRACE_STREAMS, "%u error prim=%d, TLI=%d, UNIX=%d",
14122 + fd, prim, terr, uerr);
14124 + if (!(it = timod_mkctl(sizeof(struct T_error_ack))))
14127 + err = (struct T_error_ack *)&it->type;
14128 + err->PRIM_type = T_ERROR_ACK;
14129 + err->ERROR_prim = prim;
14130 + err->TLI_error = terr;
14131 + err->UNIX_error = iABI_errors(uerr);
14133 + it->pri = MSG_HIPRI;
14134 + it->length = sizeof(struct T_error_ack);
14135 + it->next = Priv(fp)->pfirst;
14137 + Priv(fp)->pfirst = it;
14138 + if (!Priv(fp)->plast)
14139 + Priv(fp)->plast = it;
14140 + timod_socket_wakeup(fp);
14144 +#if defined(CONFIG_ABI_XTI_OPTMGMT) || defined(CONFIG_ABI_TLI_OPTMGMT)
14146 + * XXX: this function is a _horrible_ mess.
14149 +timod_optmgmt(int fd, struct pt_regs * regs, int flag,
14150 + char * opt_buf, int opt_len, int do_ret)
14152 + struct file * fp = fcheck(fd);
14153 + char *ret_buf, *ret_base;
14154 + u_long old_esp, *tsp;
14155 + int is_tli, error, failed;
14156 + int ret_len, ret_space;
14158 + if (opt_buf && opt_len > 0) {
14159 + error = verify_area(VERIFY_READ, opt_buf, opt_len);
14166 + * We should be able to detect the difference between
14167 + * TLI and XTI requests at run time?
14169 + is_tli = CONFIG_ABI_TLI_OPTMGMT;
14171 + if (!do_ret && (!opt_buf || opt_len <= 0))
14175 + * Grab some space on the user stack to work with. We need 6 longs
14176 + * to build an argument frame for [gs]etsockopt calls. We also
14177 + * need space to build the return buffer. This will be at least
14178 + * as big as the given options buffer but the given options
14179 + * buffer may not include space for option values so we allow two
14180 + * longs for each option multiple of the option header size
14181 + * and hope that big options will not exhaust our space and
14182 + * trash the stack.
14184 + ret_space = 1024 + opt_len
14185 + + 2*sizeof(long)*(opt_len / (is_tli ? sizeof(struct opthdr) : sizeof(struct t_opthdr)));
14186 + ret_buf = ret_base = (char *)(regs->esp - ret_space);
14189 + old_esp = regs->esp;
14190 + regs->esp -= ret_space + 6*sizeof(long);
14191 + tsp = (unsigned long *)(regs->esp);
14192 + error = verify_area(VERIFY_WRITE, tsp, 6*sizeof(long));
14194 + regs->esp = old_esp;
14200 +#ifndef CONFIG_ABI_TLI_OPTMGMT
14202 + printk(KERN_WARNING
14203 + "%d iBCS: TLI optmgmt requested but not supported\n",
14208 + while (opt_len >= sizeof(struct opthdr)) {
14209 + struct opthdr opt;
14211 + abi_trace(ABI_TRACE_STREAMS, "TLI optmgmt opt_len=%d, "
14212 + "ret_buf=0x%08lx, ret_len=%d, ret_space=%d",
14213 + opt_len, (unsigned long)ret_buf,
14214 + ret_len, ret_space);
14216 + copy_from_user(&opt, opt_buf, sizeof(struct opthdr));
14218 + /* Idiot check... */
14219 + if (opt.len > opt_len) {
14220 + failed = TBADOPT;
14224 + if (abi_traced(ABI_TRACE_STREAMS)) {
14226 + get_user(v, (unsigned long *)(opt_buf+sizeof(struct opthdr)));
14227 + __abi_trace("TLI optmgmt fd=%d, level=%ld, "
14228 + "name=%ld, value=%ld",
14229 + fd, opt.level, opt.name, v);
14232 + /* Check writable space in the return buffer. */
14233 + error = verify_area(VERIFY_WRITE, ret_buf, sizeof(struct opthdr));
14235 + failed = TSYSERR;
14240 + * T_NEGOTIATE means try and set it.
14241 + * T_DEFAULT means get the default value.
14242 + * (return the current for now)
14243 + * T_CHECK means get the current value.
14246 + if (flag == T_NEGOTIATE) {
14247 + put_user(fd, tsp);
14248 + put_user(opt.level, tsp+1);
14249 + put_user(opt.name, tsp+2);
14250 + put_user((int)(opt_buf+sizeof(struct opthdr)), tsp+3);
14251 + put_user(opt.len, tsp+4);
14252 + error = abi_do_setsockopt(tsp);
14255 + abi_trace(ABI_TRACE_STREAMS,
14256 + "setsockopt failed: %d", error);
14257 + failed = TBADOPT;
14264 + put_user(fd, tsp);
14265 + put_user(opt.level, tsp+1);
14266 + put_user(opt.name, tsp+2);
14267 + put_user((int)(ret_buf+sizeof(struct opthdr)), tsp+3);
14268 + put_user((int)(tsp+5), tsp+4);
14269 + put_user(ret_space, tsp+5);
14270 + error = abi_do_getsockopt(tsp);
14273 + abi_trace(ABI_TRACE_STREAMS,
14274 + "getsockopt failed: %d", error);
14275 + failed = TBADOPT;
14279 + get_user(len, tsp+5);
14280 + copy_to_user(ret_buf, &opt, sizeof(opt));
14282 + &((struct opthdr *)opt_buf)->len);
14283 + ret_space -= sizeof(struct opthdr) + len;
14284 + ret_len += sizeof(struct opthdr) + len;
14285 + ret_buf += sizeof(struct opthdr) + len;
14288 + opt_len -= sizeof(struct opthdr) + opt.len;
14289 + opt_buf += sizeof(struct opthdr) + opt.len;
14291 +#endif /* CONFIG_ABI_TLI_OPTMGMT */
14292 +#ifndef CONFIG_ABI_XTI_OPTMGMT
14294 + printk(KERN_WARNING
14295 + "%d iBCS: XTI optmgmt requested but not supported\n",
14299 + else while (opt_len >= sizeof(struct t_opthdr)) {
14300 + struct t_opthdr opt;
14302 + copy_from_user(&opt, opt_buf, sizeof(struct t_opthdr));
14303 + if (opt.len > opt_len) {
14308 + if (abi_traced(ABI_TRACE_STREAMS)) {
14310 + get_user(v, (unsigned long *)(opt_buf+sizeof(struct t_opthdr)));
14311 + __abi_trace("XTI optmgmt fd=%d, level=%ld, "
14312 + "name=%ld, value=%ld",
14313 + fd, opt.level, opt.name, v);
14316 + /* Check writable space in the return buffer. */
14317 + if (verify_area(VERIFY_WRITE, ret_buf, sizeof(struct t_opthdr))) {
14323 + * T_NEGOTIATE means try and set it.
14324 + * T_CHECK means see if we could set it.
14325 + * (so we just set it for now)
14326 + * T_DEFAULT means get the default value.
14327 + * (return the current for now)
14328 + * T_CURRENT means get the current value (SCO xti.h has
14329 + * no T_CURRENT???).
14332 + if (flag == T_NEGOTIATE || flag == T_CHECK) {
14333 + put_user(fd, tsp);
14334 + put_user(opt.level, tsp+1);
14335 + put_user(opt.name, tsp+2);
14336 + put_user((int)(opt_buf+sizeof(struct t_opthdr)), tsp+3);
14337 + put_user(opt.len-sizeof(struct t_opthdr), tsp+4);
14338 + error = abi_do_setsockopt(tsp);
14341 + put_user(fd, tsp);
14342 + put_user(opt.level, tsp+1);
14343 + put_user(opt.name, tsp+2);
14344 + put_user((int)(ret_buf+sizeof(struct t_opthdr)), tsp+3);
14345 + put_user((int)(tsp+5), tsp+4);
14346 + put_user(ret_space, tsp+5);
14347 + error = abi_do_getsockopt(tsp);
14350 + get_user(len, tsp+5);
14351 + /* FIXME: opt.status should be set... */
14352 + copy_to_user(ret_buf, &opt, sizeof(opt));
14353 + put_user(len+sizeof(struct t_opthdr),
14354 + &((struct t_opthdr *)opt_buf)->len);
14355 + ret_space -= sizeof(struct t_opthdr) + len;
14356 + ret_len += sizeof(struct t_opthdr) + len;
14357 + ret_buf += sizeof(struct t_opthdr) + len;
14362 + opt_len -= opt.len;
14363 + opt_buf += opt.len;
14365 +#endif /* CONFIG_ABI_XTI_OPTMGMT */
14368 + /* If there is left over data the supplied options buffer was
14369 + * formatted incorrectly. But we might have done some work so
14370 + * we must fall through and return an acknowledgement I think.
14373 + regs->esp = old_esp;
14379 + struct T_primsg *it;
14382 + timod_error(fd, T_OPTMGMT_REQ, failed, -error);
14383 + regs->esp = old_esp;
14387 + abi_trace(ABI_TRACE_STREAMS,
14388 + "optmgmt returns %d bytes, failed=%d",
14389 + ret_len, failed);
14391 + /* Convert the return buffer in the user stack to a
14393 + * message and queue it.
14395 + it = timod_mkctl(sizeof(struct T_optmgmt_ack) + ret_len);
14397 + struct T_optmgmt_ack *ack
14398 + = (struct T_optmgmt_ack *)&it->type;
14399 + ack->PRIM_type = T_OPTMGMT_ACK;
14400 + ack->OPT_length = ret_len;
14401 + ack->OPT_offset = sizeof(struct T_optmgmt_ack);
14402 + ack->MGMT_flags = (failed ? T_FAILURE : flag);
14403 + copy_from_user(((char *)ack)+sizeof(struct T_optmgmt_ack),
14404 + ret_base, ret_len);
14405 + it->pri = MSG_HIPRI;
14406 + it->length = sizeof(struct T_optmgmt_ack) + ret_len;
14407 + it->next = Priv(fp)->pfirst;
14408 + Priv(fp)->pfirst = it;
14409 + if (!Priv(fp)->plast)
14410 + Priv(fp)->plast = it;
14411 + timod_socket_wakeup(fp);
14415 + regs->esp = old_esp;
14419 +#else /* no CONFIG_ABI_XTI_OPTMGMT or CONFIG_ABI_TLI_OPTMGMT */
14422 +timod_optmgmt(int fd, struct pt_regs * regs, int flag,
14423 + char * opt_buf, int opt_len, int do_ret)
14428 +#endif /* CONFIG_ABI_XTI_OPTMGMT or CONFIG_ABI_TLI_OPTMGMT */
14430 +#define T_PRIV(fp) Priv(fp)
14433 +timod_update_socket(int fd, struct file * fp, struct pt_regs * regs)
14435 + struct socket * sock;
14436 + struct T_private * priv;
14437 + struct T_primsg * it;
14438 + struct T_conn_ind * ind;
14439 + u_long old_esp, * tsp, alen;
14440 + u_short oldflags;
14443 + sock = socki_lookup(fp->f_dentry->d_inode);
14444 + priv = T_PRIV(fp);
14447 + * If this a SOCK_STREAM and is in the TS_WRES_CIND state
14448 + * we are supposed to be looking for an incoming connection.
14450 + if (sock->type != SOCK_STREAM || priv->state != TS_WRES_CIND)
14453 + old_esp = regs->esp;
14454 + regs->esp -= 1024;
14455 + tsp = (unsigned long *)regs->esp;
14456 + error = verify_area(VERIFY_WRITE, tsp,
14457 + 3*sizeof(long)+sizeof(struct sockaddr));
14459 + regs->esp = old_esp;
14463 + put_user(fd, tsp);
14464 + put_user((unsigned long)(tsp+4), tsp+1);
14465 + put_user((unsigned long)(tsp+3), tsp+2);
14466 + put_user(sizeof(struct sockaddr), tsp+3);
14469 + * We don't want to block in the accept(). Any
14470 + * blocking necessary must be handled earlier.
14472 + oldflags = fp->f_flags;
14473 + fp->f_flags |= O_NONBLOCK;
14474 + error = SYS(socketcall)(SYS_ACCEPT, tsp);
14475 + fp->f_flags = oldflags;
14480 + /* The new fd needs to be fixed up
14481 + * with the iBCS file functions and a
14482 + * timod state block.
14484 + inherit_socksys_funcs(error, TS_DATA_XFER);
14486 + /* Generate a T_CONN_IND and queue it. */
14487 + get_user(alen, tsp+3);
14488 + it = timod_mkctl(sizeof(struct T_conn_ind) + alen);
14490 + /* Oops, just drop the connection I guess. */
14491 + SYS(close)(error);
14495 + ind = (struct T_conn_ind *)&it->type;
14496 + ind->PRIM_type = T_CONN_IND;
14497 + ind->SRC_length = alen;
14498 + ind->SRC_offset = sizeof(struct T_conn_ind);
14499 + ind->OPT_length = ind->OPT_offset = 0;
14500 + ind->SEQ_number = error;
14502 + copy_from_user(((char *)ind)+sizeof(struct T_conn_ind), tsp+4, alen);
14504 + it->pri = MSG_HIPRI;
14506 + it->length = sizeof(struct T_conn_ind) + alen;
14507 + it->next = Priv(fp)->pfirst;
14508 + Priv(fp)->pfirst = it;
14509 + if (!Priv(fp)->plast)
14510 + Priv(fp)->plast = it;
14511 + timod_socket_wakeup(fp);
14514 + regs->esp = old_esp;
14521 +do_getmsg(int fd, struct pt_regs *regs,
14522 + char *ctl_buf, int ctl_maxlen, int *ctl_len,
14523 + char *dat_buf, int dat_maxlen, int *dat_len,
14528 + unsigned long *tsp;
14529 + unsigned short oldflags;
14530 + struct T_unitdata_ind udi;
14531 + struct file *filep;
14534 + * It may not be obvious but we are always holding an fget(fd)
14535 + * at this point so we can use fcheck(fd) rather than fget...fput.
14537 + filep = fcheck(fd);
14539 + if (!Priv(filep) && Priv(filep)->magic != XTI_MAGIC) {
14540 + printk("putmsg on non-STREAMS fd %d by %s\n",fd, current->comm);
14544 + abi_trace(ABI_TRACE_STREAMS,
14545 + "getmsg %d, 0x%lx[%d], 0x%lx[%d], %x",
14546 + fd, (u_long)ctl_buf, ctl_maxlen,
14547 + (u_long)dat_buf, dat_maxlen, *flags_p);
14550 + * We need some user space to build syscall argument vectors
14551 + * later. Set it up now and page it in if necessary. This will
14552 + * avoid (most?) potential blocking after the select().
14554 + old_esp = regs->esp;
14555 + regs->esp -= 1024;
14556 + tsp = (unsigned long *)regs->esp;
14557 + error = verify_area(VERIFY_WRITE, tsp, 6*sizeof(long));
14558 + regs->esp = old_esp;
14563 + * If the TEP is not non-blocking we must test for
14564 + * something to do. We don't necessarily know what order
14565 + * events will be happening on the socket so we have to
14566 + * watch for evrything at once.
14567 + * N.B. If we weren't asked for data we should only be looking
14568 + * for connection requests. There are socket type issues to
14571 + if (!(filep->f_flags & O_NONBLOCK)) {
14572 + poll_table wait_table, *wait;
14573 + unsigned long mask = (POLLIN | POLLRDNORM | POLLHUP | POLLERR);
14575 + if (*flags_p == MSG_HIPRI)
14578 + poll_initwait(&wait_table);
14579 + wait = &wait_table;
14582 + * N.B. We need to be sure to recheck after a schedule()
14583 + * so that when we proceed it is because there is
14584 + * something to do and nothing else can get there
14587 + while (!(filep->f_op->poll(filep, wait) & mask)
14588 + && !signal_pending(current)) {
14589 + current->state = TASK_INTERRUPTIBLE;
14594 + current->state = TASK_RUNNING;
14595 + poll_freewait(&wait_table);
14597 + if (signal_pending(current))
14601 + if (ctl_maxlen >= 0 && !Priv(filep)->pfirst)
14602 + timod_update_socket(fd, filep, regs);
14605 + * If we were asked for a control part and there is an outstanding
14606 + * message queued as a result of some other operation we'll
14609 + if (ctl_maxlen >= 0 && Priv(filep)->pfirst) {
14610 + int l = ctl_maxlen <= Priv(filep)->pfirst->length
14611 + ? ctl_maxlen : Priv(filep)->pfirst->length;
14612 + error = verify_area(VERIFY_WRITE, ctl_buf, l);
14616 + abi_trace(ABI_TRACE_STREAMS,
14617 + "priority message %ld %s",
14618 + Priv(filep)->pfirst->type,
14619 + xti_prim(Priv(filep)->pfirst->type));
14621 + copy_to_user(ctl_buf, ((char *)&Priv(filep)->pfirst->type)
14622 + + Priv(filep)->offset, l);
14623 + put_user(l, ctl_len);
14624 + if (dat_maxlen >= 0)
14625 + put_user(0, dat_len);
14626 + *flags_p = Priv(filep)->pfirst->pri;
14627 + Priv(filep)->pfirst->length -= l;
14629 + if (abi_traced(ABI_TRACE_STREAMS) && ctl_buf && l > 0) {
14632 + for (i = 0; i < l && i < 64; i += 4) {
14635 + get_user(v, (u_long *)(ctl_buf + i));
14636 + __abi_trace("ctl: 0x%08lx", v);
14639 + __abi_trace("ctl: ...");
14642 + if (Priv(filep)->pfirst->length) {
14643 + Priv(filep)->offset += l;
14645 + abi_trace(ABI_TRACE_STREAMS,
14646 + "MORECTL %d bytes",
14647 + Priv(filep)->pfirst->length);
14650 + struct T_primsg *it = Priv(filep)->pfirst;
14651 + Priv(filep)->pfirst = it->next;
14652 + if (!Priv(filep)->pfirst)
14653 + Priv(filep)->plast = NULL;
14655 + Priv(filep)->offset = 0;
14662 + /* If we weren't asked for data there is nothing more to do. */
14663 + if (dat_maxlen <= 0) {
14664 + if (dat_maxlen == 0)
14665 + put_user(0, dat_len);
14666 + if (ctl_maxlen >= 0)
14667 + put_user(0, ctl_len);
14671 + /* If the select() slept we may have had our temp space paged
14672 + * out. The re-verify_area is only really needed for pre-486
14673 + * chips which don't handle write faults from kernel mode.
14675 + regs->esp = (unsigned long)tsp;
14676 + error = verify_area(VERIFY_WRITE, tsp, 6*sizeof(long));
14678 + regs->esp = old_esp;
14681 + put_user(fd, tsp);
14682 + put_user((unsigned long)dat_buf, tsp+1);
14683 + put_user((dat_maxlen < 0 ? 0 : dat_maxlen), tsp+2);
14684 + put_user(0, tsp+3);
14685 + if (ctl_maxlen > (int)sizeof(udi) && Priv(filep)->state == TS_IDLE) {
14686 + put_user((unsigned long)ctl_buf+sizeof(udi), tsp+4);
14687 + put_user(ctl_maxlen-sizeof(udi), ctl_len);
14688 + put_user((int)ctl_len, tsp+5);
14690 + put_user(0, tsp+4);
14691 + put_user(0, ctl_len);
14692 + put_user((int)ctl_len, tsp+5);
14695 + /* We don't want to block in the recvfrom(). Any blocking is
14696 + * handled by the select stuff above.
14698 + oldflags = filep->f_flags;
14699 + filep->f_flags |= O_NONBLOCK;
14700 + error = SYS(socketcall)(SYS_RECVFROM, tsp);
14701 + filep->f_flags = oldflags;
14703 + regs->esp = old_esp;
14707 + && ctl_maxlen > (int)sizeof(udi)
14708 + && Priv(filep)->state == TS_IDLE) {
14709 + udi.PRIM_type = T_UNITDATA_IND;
14710 + get_user(udi.SRC_length, ctl_len);
14711 + udi.SRC_offset = sizeof(udi);
14712 + udi.OPT_length = udi.OPT_offset = 0;
14713 + copy_to_user(ctl_buf, &udi, (int)sizeof(udi));
14714 + put_user(sizeof(udi)+udi.SRC_length, ctl_len);
14716 + if (abi_traced(ABI_TRACE_STREAMS) &&
14717 + ctl_buf && udi.SRC_length > 0) {
14718 + char * buf = ctl_buf + sizeof(udi);
14721 + for (i = 0; i < udi.SRC_length &&
14722 + i < 64; i += 4) {
14725 + get_user(v, (u_long *)(buf+i));
14726 + __abi_trace("dat: 0x%08lx", v);
14728 + if (i != udi.SRC_length)
14729 + __abi_trace("dat: ...");
14733 + put_user(0, ctl_len);
14735 + put_user(error, dat_len);
14742 +do_putmsg(int fd, struct pt_regs *regs, char *ctl_buf, int ctl_len,
14743 + char *dat_buf, int dat_len, int flags)
14745 + struct file *filep;
14746 + int error, terror;
14747 + unsigned long cmd;
14749 + /* It may not be obvious but we are always holding an fget(fd)
14750 + * at this point so we can use fcheck(fd) rather than fget...fput.
14752 + filep = fcheck(fd);
14754 + if (!Priv(filep) && Priv(filep)->magic != XTI_MAGIC) {
14755 + printk("putmsg on non-STREAMS fd %d by %s\n",fd, current->comm);
14759 + if (abi_traced(ABI_TRACE_STREAMS)) {
14761 + __abi_trace("putmsg %d, 0x%lx[%d], 0x%lx[%d], %x",
14762 + fd, (u_long)ctl_buf, ctl_len,
14763 + (u_long)dat_buf, dat_len, flags);
14765 + get_user(v, ctl_buf);
14766 + __abi_trace("putmsg prim: %ld %s", v, xti_prim(v));
14768 + if (ctl_buf && ctl_len > 0) {
14771 + for (i = 0; i < ctl_len && i < 64; i += 4) {
14774 + get_user(v, (u_long *)(ctl_buf + i));
14775 + __abi_trace("ctl: 0x%08lx", v);
14777 + if (i != ctl_len)
14778 + __abi_trace("ctl: ...");
14781 + if (dat_buf && dat_len > 0) {
14784 + for (i = 0; i < dat_len && i < 64; i += 4) {
14787 + get_user(v, (u_long *)(dat_buf + i));
14788 + __abi_trace("dat: 0x%08lx", v);
14790 + if (i != dat_len)
14791 + __abi_trace("dat: ...");
14795 + error = get_user(cmd, (unsigned long *)ctl_buf);
14800 + case T_BIND_REQ: {
14801 + struct T_bind_req req;
14803 + unsigned long *tsp;
14805 + abi_trace(ABI_TRACE_STREAMS, "%u bind req", fd);
14807 + error = verify_area(VERIFY_READ, ctl_buf, sizeof(req));
14811 + if (Priv(filep)->state != TS_UNBND) {
14812 + timod_error(fd, T_BIND_REQ, TOUTSTATE, 0);
14816 + old_esp = regs->esp;
14817 + regs->esp -= 1024;
14818 + tsp = (unsigned long *)(regs->esp);
14819 + error = verify_area(VERIFY_WRITE, tsp, 3*sizeof(long));
14821 + timod_error(fd, T_BIND_REQ, TSYSERR, -error);
14822 + regs->esp = old_esp;
14826 + copy_from_user(&req, ctl_buf, sizeof(req));
14827 + if (req.ADDR_offset && req.ADDR_length) {
14828 + struct sockaddr_in *sin;
14829 + unsigned short family;
14831 +#if 1 /* Wheee... Kludge time... */
14832 + sin = (struct sockaddr_in *)(ctl_buf
14833 + + req.ADDR_offset);
14834 + get_user(family, &sin->sin_family);
14836 + /* Sybase seems to have set up the address
14837 + * struct with sa->sa_family = htons(AF_?)
14838 + * which is bollocks. I have no idea why it
14839 + * apparently works on SCO?!?
14841 + if (family && !(family & 0x00ff))
14842 + put_user(ntohs(family), &sin->sin_family);
14845 + put_user(fd, tsp);
14846 + put_user((unsigned long)ctl_buf
14847 + + req.ADDR_offset, tsp+1);
14848 + /* For TLI/XTI the length may be the 8 *used*
14849 + * bytes, for (IP?) sockets it must be the 16
14850 + * *total* bytes in a sockaddr_in.
14852 + put_user(req.ADDR_length == 8
14853 + ? 16 : req.ADDR_length,
14855 + error = SYS(socketcall)(SYS_BIND, tsp);
14858 + if (req.CONIND_number) {
14860 + abi_trace(ABI_TRACE_STREAMS,
14861 + "%u listen backlog=%lu",
14862 + fd, req.CONIND_number);
14864 + put_user(fd, tsp);
14865 + put_user(req.CONIND_number, tsp+1);
14866 + SYS(socketcall)(SYS_LISTEN, tsp);
14867 + Priv(filep)->state = TS_WRES_CIND;
14869 + Priv(filep)->state = TS_IDLE;
14876 + regs->esp = old_esp;
14879 + struct T_primsg *it;
14880 + it = timod_mkctl(ctl_len);
14882 + struct T_bind_ack *ack = (struct T_bind_ack *)&it->type;
14883 + copy_from_user(ack, ctl_buf, ctl_len);
14884 + ack->PRIM_type = T_BIND_ACK;
14885 + it->pri = MSG_HIPRI;
14886 + it->length = ctl_len;
14888 + timod_ok(fd, T_BIND_REQ);
14889 + Priv(filep)->plast->next = it;
14890 + Priv(filep)->plast = it;
14896 + terror = TOUTSTATE;
14903 + case -EADDRNOTAVAIL:
14904 + case -EADDRINUSE:
14905 + terror = TNOADDR;
14909 + terror = TSYSERR;
14912 + timod_error(fd, T_BIND_REQ, terror, -error);
14915 + case T_CONN_RES: {
14916 + struct T_conn_res *res = (struct T_conn_res *)ctl_buf;
14917 + unsigned int conn_fd;
14919 + error = get_user(conn_fd, &res->SEQ_number);
14923 + abi_trace(ABI_TRACE_STREAMS,
14924 + "%u accept: conn fd=%u, use fd=%u\n",
14925 + fd, conn_fd, flags);
14927 + if (conn_fd != flags) {
14928 + error = SYS(dup2)(conn_fd, flags);
14929 + SYS(close)(conn_fd);
14933 + timod_ok(fd, T_CONN_RES);
14936 + case T_CONN_REQ: {
14937 + struct T_conn_req req;
14939 + unsigned short oldflags;
14940 + unsigned long *tsp;
14941 + struct T_primsg *it;
14942 + struct sockaddr_in *sin;
14943 + unsigned short family;
14945 + abi_trace(ABI_TRACE_STREAMS, "%u connect req", fd);
14947 + error = verify_area(VERIFY_READ, ctl_buf, sizeof(req));
14951 + if (Priv(filep)->state != TS_UNBND
14952 + && Priv(filep)->state != TS_IDLE) {
14953 + timod_error(fd, T_CONN_REQ, TOUTSTATE, 0);
14957 + old_esp = regs->esp;
14958 + regs->esp -= 1024;
14959 + tsp = (unsigned long *)(regs->esp);
14960 + error = verify_area(VERIFY_WRITE, tsp, 3*sizeof(long));
14962 + timod_error(fd, T_CONN_REQ, TSYSERR, -error);
14963 + regs->esp = old_esp;
14966 + copy_from_user(&req, ctl_buf, sizeof(req));
14967 + put_user(fd, tsp);
14968 + put_user((unsigned long)ctl_buf + req.DEST_offset, tsp+1);
14969 + /* For TLI/XTI the length may be the 8 *used*
14970 + * bytes, for (IP?) sockets it must be the 16
14971 + * *total* bytes in a sockaddr_in.
14973 + put_user(req.DEST_length == 8
14974 + ? 16 : req.DEST_length,
14977 +#if 1 /* Wheee... Kludge time... */
14978 + sin = (struct sockaddr_in *)(ctl_buf
14979 + + req.DEST_offset);
14980 + get_user(family, &sin->sin_family);
14982 + /* Sybase seems to have set up the address
14983 + * struct with sa->sa_family = htons(AF_?)
14984 + * which is bollocks. I have no idea why it
14985 + * apparently works on SCO?!?
14987 + if (family && !(family & 0x00ff)) {
14988 + family = ntohs(family);
14989 + put_user(family, &sin->sin_family);
14992 + /* Sheesh... ISC telnet seems to give the port
14993 + * number low byte first as I expected but the
14994 + * X programs seem to be giving high byte first.
14995 + * One is broken of course but clearly both
14996 + * should work. No, I don't understand this
14997 + * either but I can at least try...
14998 + * A better solution would be for you to change
14999 + * the definition of xserver0 in ISC's /etc/services
15000 + * but then it wouldn't work out of the box...
15002 + if (personality(PER_SVR4) && family == AF_INET) {
15003 + get_user(family, &sin->sin_port);
15004 + if (family == 0x1770)
15005 + put_user(htons(family),
15009 + /* FIXME: We should honour non-blocking mode
15010 + * here but that means that the select probe
15011 + * needs to know that if select returns ok and
15012 + * we are in T_OUTCON we have a connection
15013 + * completion. This isn't so bad but the real
15014 + * problem is that the connection acknowledgement
15015 + * is supposed to contain the destination
15018 + oldflags = filep->f_flags;
15019 + filep->f_flags &= ~O_NONBLOCK;
15020 + error = SYS(socketcall)(SYS_CONNECT, tsp);
15021 + filep->f_flags = oldflags;
15022 + regs->esp = old_esp;
15025 + struct T_conn_con *con;
15027 + it = timod_mkctl(ctl_len);
15030 + it->length = ctl_len;
15031 + con = (struct T_conn_con *)&it->type;
15032 + copy_from_user(con, ctl_buf, ctl_len);
15033 + con->PRIM_type = T_CONN_CON;
15034 + Priv(filep)->state = TS_DATA_XFER;
15036 + struct T_discon_ind *dis;
15038 + abi_trace(ABI_TRACE_STREAMS,
15039 + "%u connect failed (errno=%d)",
15042 + it = timod_mkctl(sizeof(struct T_discon_ind));
15045 + it->length = sizeof(struct T_discon_ind);
15046 + dis = (struct T_discon_ind *)&it->type;
15047 + dis->PRIM_type = T_DISCON_IND;
15048 + dis->DISCON_reason = iABI_errors(-error);
15049 + dis->SEQ_number = 0;
15051 + timod_ok(fd, T_CONN_REQ);
15054 + Priv(filep)->plast->next = it;
15055 + Priv(filep)->plast = it;
15059 + case T_DISCON_REQ: {
15060 + struct T_discon_req *req;
15062 + req = (struct T_discon_req *)ctl_buf;
15063 + error = get_user(fd, &req->SEQ_number);
15067 + abi_trace(ABI_TRACE_STREAMS, "disconnect %u", fd);
15068 + /* Fall through... */
15070 + case T_ORDREL_REQ: {
15075 + case T_DATA_REQ: {
15077 + unsigned long *tsp;
15079 + abi_trace(ABI_TRACE_STREAMS, "%u data req", fd);
15081 + if (Priv(filep)->state != TS_DATA_XFER) {
15085 + old_esp = regs->esp;
15086 + regs->esp -= 1024;
15087 + tsp = (unsigned long *)(regs->esp);
15088 + error = verify_area(VERIFY_WRITE, tsp, 6*sizeof(long));
15090 + regs->esp = old_esp;
15093 + put_user(fd, tsp);
15094 + put_user((unsigned long)dat_buf, tsp+1);
15095 + put_user(dat_len, tsp+2);
15096 + put_user(0, tsp+3);
15097 + error = SYS(socketcall)(SYS_SEND, tsp);
15098 + regs->esp = old_esp;
15102 + case T_UNITDATA_REQ: {
15103 + struct T_unitdata_req req;
15105 + unsigned long *tsp;
15108 + abi_trace(ABI_TRACE_STREAMS, "%u unitdata req", fd);
15110 + error = verify_area(VERIFY_READ, ctl_buf, sizeof(req));
15114 + if (Priv(filep)->state != TS_IDLE
15115 + && Priv(filep)->state != TS_DATA_XFER) {
15116 + timod_error(fd, T_UNITDATA_REQ, TOUTSTATE, 0);
15120 + old_esp = regs->esp;
15121 + regs->esp -= 1024;
15122 + tsp = (unsigned long *)(regs->esp);
15123 + error = verify_area(VERIFY_WRITE, tsp, 6*sizeof(long));
15125 + timod_error(fd, T_UNITDATA_REQ, TSYSERR, -error);
15126 + regs->esp = old_esp;
15129 + put_user(fd, tsp);
15130 + put_user((unsigned long)dat_buf, tsp+1);
15131 + put_user(dat_len, tsp+2);
15132 + put_user(0, tsp+3);
15133 + copy_from_user(&req, ctl_buf, sizeof(req));
15134 + if (req.DEST_length > 0) {
15135 + put_user((unsigned long)(ctl_buf+req.DEST_offset), tsp+4);
15136 + put_user(req.DEST_length, tsp+5);
15137 + error = SYS(socketcall)(SYS_SENDTO, tsp);
15138 + regs->esp = old_esp;
15141 + error = SYS(socketcall)(SYS_SEND, tsp);
15142 + regs->esp = old_esp;
15146 + case T_UNBIND_REQ:
15147 + Priv(filep)->state = TS_UNBND;
15148 + timod_ok(fd, T_UNBIND_REQ);
15151 + case T_OPTMGMT_REQ: {
15152 + struct T_optmgmt_req req;
15154 + abi_trace(ABI_TRACE_STREAMS, "%u optmgmt req", fd);
15156 + error = verify_area(VERIFY_READ, ctl_buf, sizeof(req));
15159 + copy_from_user(&req, ctl_buf, sizeof(req));
15161 + return timod_optmgmt(fd, regs, req.MGMT_flags,
15162 + req.OPT_offset > 0
15163 + ? ctl_buf+req.OPT_offset
15169 + if (!abi_traced(ABI_TRACE_STREAMS))
15172 + if (ctl_buf && ctl_len > 0) {
15175 + for (i = 0; i < ctl_len && i < 32; i += 4) {
15178 + get_user(v, (u_long *)(ctl_buf + i));
15179 + __abi_trace("ctl: 0x%08lx\n", v);
15181 + if (i != ctl_len)
15182 + __abi_trace("ctl: ...\n");
15184 + if (dat_buf && dat_len > 0) {
15186 + for (i = 0; i < dat_len && i < 32; i += 4) {
15189 + get_user(v, (u_long *)(dat_buf + i));
15190 + __abi_trace("dat: 0x%08lx\n", v);
15192 + if (i != dat_len)
15193 + __abi_trace("dat: ...\n");
15201 +timod_ioctl(struct pt_regs *regs,
15202 + int fd, unsigned int func, void *arg, int len, int *len_p)
15204 + struct file *filep;
15205 + struct inode *ino;
15208 + filep = fget(fd);
15212 + error = verify_area(VERIFY_WRITE, len_p, sizeof(int));
15215 + return (-error << 8) | TSYSERR;
15218 + ino = filep->f_dentry->d_inode;
15220 + /* SCO/SVR3 starts at 100, ISC/SVR4 starts at 140. */
15221 + switch (func >= 140 ? func-140 : func-100) {
15222 + case 0: /* TI_GETINFO */
15224 + struct T_info_ack it;
15227 + abi_trace(ABI_TRACE_STREAMS, "%u getinfo", fd);
15229 + /* The pre-SVR4 T_info_ack structure didn't have
15230 + * the PROVIDER_flag on the end.
15232 + error = verify_area(VERIFY_WRITE, arg,
15234 + ? sizeof(struct T_info_ack)
15235 + : sizeof(struct T_info_ack)-sizeof(long));
15238 + return (-error << 8) | TSYSERR;
15241 + __get_user(v, &((struct T_info_req *)arg)->PRIM_type);
15242 + if (v != T_INFO_REQ) {
15244 + return (EINVAL << 8) | TSYSERR;
15247 + it.PRIM_type = T_INFO_ACK;
15248 + it.CURRENT_state = Priv(filep)->state;
15249 + it.CDATA_size = -2;
15250 + it.DDATA_size = -2;
15251 + it.OPT_size = -1;
15252 + it.TIDU_size = 16384;
15253 + switch ((MINOR(ino->i_rdev)>>4) & 0x0f) {
15255 + it.ADDR_size = sizeof(struct sockaddr_un);
15258 + it.ADDR_size = sizeof(struct sockaddr_in);
15261 + /* Uh... dunno... play safe(?) */
15262 + it.ADDR_size = 1024;
15265 + switch (ino->u.socket_i.type) {
15266 + case SOCK_STREAM:
15267 + it.ETSDU_size = 1;
15268 + it.TSDU_size = 0;
15269 + it.SERV_type = 2;
15272 + it.ETSDU_size = -2;
15273 + it.TSDU_size = 16384;
15274 + it.SERV_type = 3;
15280 + /* The pre-SVR4 T_info_ack structure didn't have
15281 + * the PROVIDER_flag on the end.
15283 + if (func == 140) {
15284 + it.PROVIDER_flag = 0;
15285 + copy_to_user(arg, &it, sizeof(it));
15286 + put_user(sizeof(it), len_p);
15289 + copy_to_user(arg, &it, sizeof(it)-sizeof(long));
15290 + put_user(sizeof(it)-sizeof(long), len_p);
15294 + case 2: /* TI_BIND */
15299 + abi_trace(ABI_TRACE_STREAMS, "%u bind", fd);
15301 + error = do_putmsg(fd, regs, arg, len,
15305 + return (-error << 8) | TSYSERR;
15308 + /* Get the response. This should be either
15309 + * T_OK_ACK or T_ERROR_ACK.
15312 + error = do_getmsg(fd, regs,
15318 + return (-error << 8) | TSYSERR;
15321 + get_user(prim, (unsigned long *)arg);
15322 + if (prim == T_ERROR_ACK) {
15323 + unsigned long a, b;
15325 + get_user(a, ((unsigned long *)arg)+3);
15326 + get_user(b, ((unsigned long *)arg)+2);
15327 + return (a << 8) | b;
15329 + if (prim != T_OK_ACK) {
15334 + /* Get the response to the bind request. */
15336 + error = do_getmsg(fd, regs,
15342 + return (-error << 8) | TSYSERR;
15347 + case 3: /* TI_UNBIND */
15348 + if (Priv(filep)->state != TS_IDLE) {
15350 + return TOUTSTATE;
15352 + Priv(filep)->state = TS_UNBND;
15356 + case 1: { /* TI_OPTMGMT */
15357 +#if defined(CONFIG_ABI_XTI_OPTMGMT) || defined(CONFIG_ABI_TLI_OPTMGMT)
15361 + abi_trace(ABI_TRACE_STREAMS, "%u optmgmt", fd);
15363 + error = do_putmsg(fd, regs, arg, len,
15367 + return (-error << 8) | TSYSERR;
15370 + /* Get the response to the optmgmt request. */
15372 + error = do_getmsg(fd, regs,
15377 + /* If there is excess data in the response
15378 + * our buffer is too small which implies
15379 + * the application is broken. SO_LINGER
15380 + * is a common fault. Because it works
15381 + * on other systems we attempt to recover
15382 + * by discarding the excess.
15384 + struct T_primsg *it = Priv(filep)->pfirst;
15385 + Priv(filep)->pfirst = it->next;
15386 + if (!Priv(filep)->pfirst)
15387 + Priv(filep)->plast = NULL;
15389 + Priv(filep)->offset = 0;
15391 + abi_trace(ABI_TRACE_STREAMS,
15392 + "excess discarded");
15398 + return (-error << 8) | TSYSERR;
15400 + __get_user(prim, (unsigned long *)arg);
15401 + if (prim == T_ERROR_ACK) {
15402 + unsigned long a, b;
15403 + __get_user(a, ((unsigned long *)arg)+3);
15404 + __get_user(b, ((unsigned long *)arg)+2);
15405 + return (a << 8) | b;
15409 +#else /* no CONFIG_ABI_XTI_OPTMGMT or CONFIG_ABI_TLI_OPTMGMT */
15411 + return TNOTSUPPORT;
15412 +#endif /* CONFIG_ABI_XTI_OPTMGMT or CONFIG_ABI_TLI_OPTMGMT */
15415 + case 4: /* TI_GETMYNAME */
15416 + case 5: /* TI_SETPEERNAME */
15417 + case 6: /* TI_GETMYNAME */
15418 + case 7: /* TI_SETPEERNAME */
15421 + abi_trace(ABI_TRACE_STREAMS,
15422 + "STREAMS timod op %d not supported", func);
15425 + return TNOTSUPPORT;
15429 +int svr4_ioctl_sockmod(int fd, unsigned int func, void *arg)
15431 + struct file *filep;
15432 + struct inode *ino;
15435 + filep = fget(fd);
15438 + ino = filep->f_dentry->d_inode;
15440 + if (MAJOR(ino->i_rdev) == SOCKSYS_MAJOR) {
15441 + error = abi_socksys_fd_init(fd, 0, NULL, NULL);
15445 + filep = fget(fd);
15448 + ino = filep->f_dentry->d_inode;
15453 + case 110: { /* SI_GETUDATA -- Solaris */
15455 + int tidusize, addrsize, optsize, etsdusize;
15456 + int servtype, so_state, so_options;
15459 + /* Socket parameters */
15460 + int family, type, protocol;
15463 + abi_trace(ABI_TRACE_STREAMS, "%u new_getudata", fd);
15465 + error = verify_area(VERIFY_WRITE, it, sizeof(*it));
15468 + return (-error << 8) | TSYSERR;
15471 + __put_user(16384, &it->tidusize);
15472 + __put_user(sizeof(struct sockaddr), &it->addrsize);
15473 + __put_user(-1, &it->optsize);
15474 + __put_user(0, &it->so_state);
15475 + __put_user(0, &it->so_options);
15476 + __put_user(16384, &it->tsdusize);
15478 + switch (ino->u.socket_i.type) {
15479 + case SOCK_STREAM:
15480 + __put_user(1, &it->etsdusize);
15481 + __put_user(2, &it->servtype);
15484 + __put_user(-2, &it->etsdusize);
15485 + __put_user(3, &it->servtype);
15488 + __put_user (ino->u.socket_i.ops->family, &it->family);
15489 + __put_user (ino->u.socket_i.type, &it->type);
15490 + __put_user (ino->u.socket_i.ops->family, &it->protocol);
15496 + case 101: { /* SI_GETUDATA */
15498 + int tidusize, addrsize, optsize, etsdusize;
15499 + int servtype, so_state, so_options;
15505 + abi_trace(ABI_TRACE_STREAMS, "%u getudata", fd);
15507 + error = verify_area(VERIFY_WRITE, it, sizeof(*it));
15510 + return (-error << 8) | TSYSERR;
15513 + __put_user(16384, &it->tidusize);
15514 + __put_user(sizeof(struct sockaddr), &it->addrsize);
15515 + __put_user(-1, &it->optsize);
15516 + __put_user(0, &it->so_state);
15517 + __put_user(0, &it->so_options);
15520 + __put_user(16384, &it->tsdusize);
15522 + switch (ino->u.socket_i.type) {
15523 + case SOCK_STREAM:
15524 + __put_user(1, &it->etsdusize);
15525 + __put_user(2, &it->servtype);
15528 + __put_user(-2, &it->etsdusize);
15529 + __put_user(3, &it->servtype);
15536 + case 102: /* SI_SHUTDOWN */
15537 + case 103: /* SI_LISTEN */
15538 + case 104: /* SI_SETMYNAME */
15539 + case 105: /* SI_SETPEERNAME */
15540 + case 106: /* SI_GETINTRANSIT */
15541 + case 107: /* SI_TCL_LINK */
15542 + case 108: /* SI_TCL_UNLINK */
15545 + abi_trace(ABI_TRACE_STREAMS,
15546 + "STREAMS sockmod op %d not supported", func);
15549 + return TNOTSUPPORT;
15551 +EXPORT_SYMBOL(svr4_ioctl_sockmod);
15552 +#endif /* CONFIG_ABI_XTI */
15555 +#if defined(CONFIG_ABI_XTI) || defined(CONFIG_ABI_IBCS_SPX)
15557 +int timod_getmsg(int fd, struct inode *ino, int is_pmsg, struct pt_regs *regs)
15559 + struct strbuf *ctlptr, *datptr;
15560 + int *flags_p, flags, *band_p;
15562 + struct strbuf ctl, dat;
15563 + struct file *filep;
15565 + ctlptr = (struct strbuf *) get_syscall_parameter (regs, 1);
15566 + datptr = (struct strbuf *) get_syscall_parameter (regs, 2);
15568 + flags_p = (int *) get_syscall_parameter (regs, 3);
15570 + band_p = (int *) get_syscall_parameter (regs, 3);
15571 + flags_p = (int *) get_syscall_parameter (regs, 4);
15572 + error = verify_area(VERIFY_WRITE, band_p, sizeof(int));
15577 + error = verify_area(VERIFY_WRITE, flags_p, sizeof(int));
15582 + error = verify_area(VERIFY_WRITE, ctlptr, sizeof(ctl));
15585 + __copy_from_user(&ctl, ctlptr, sizeof(ctl));
15586 + __put_user(-1, &ctlptr->len);
15592 + error = verify_area(VERIFY_WRITE, datptr, sizeof(dat));
15595 + __copy_from_user(&dat, datptr, sizeof(dat));
15596 + __put_user(-1, &datptr->len);
15601 + error = verify_area(VERIFY_WRITE, flags_p, sizeof(int));
15604 + __get_user(flags, flags_p);
15606 +#ifdef CONFIG_ABI_IBCS_SPX
15607 + if (MAJOR(ino->i_rdev) == SOCKSYS_MAJOR && MINOR(ino->i_rdev) == 1) {
15608 + abi_trace(ABI_TRACE_STREAMS,
15609 + "%d getmsg offers descriptor %d", fd, fd);
15610 + __put_user((u_long)fd, (u_long *)ctl.buf);
15611 + __put_user(4, &ctlptr->len);
15614 +#endif /* CONFIG_ABI_IBCS_SPX */
15616 +#ifdef CONFIG_ABI_XTI
15617 + if (flags != 0 && flags != MSG_HIPRI && flags != MSG_ANY
15618 + && flags != MSG_BAND) {
15619 + abi_trace(ABI_TRACE_STREAMS,
15620 + "%d getmsg flags value bad (%d)", fd, flags);
15624 + filep = fget(fd);
15625 + error = do_getmsg(fd, regs,
15626 + ctl.buf, ctl.maxlen, &ctlptr->len,
15627 + dat.buf, dat.maxlen, &datptr->len,
15631 + put_user(flags, flags_p);
15633 +#else /* CONFIG_ABI_XTI */
15635 +#endif /* CONFIG_ABI_XTI */
15639 +int timod_putmsg(int fd, struct inode *ino, int is_pmsg, struct pt_regs *regs)
15641 + struct strbuf *ctlptr, *datptr;
15642 + int flags, error, band;
15643 + struct strbuf ctl, dat;
15645 + ctlptr = (struct strbuf *)get_syscall_parameter (regs, 1);
15646 + datptr = (struct strbuf *)get_syscall_parameter (regs, 2);
15648 + flags = (int)get_syscall_parameter (regs, 3);
15650 + band = (int)get_syscall_parameter (regs, 3);
15651 + flags = (int)get_syscall_parameter (regs, 4);
15655 + error = copy_from_user(&ctl, ctlptr, sizeof(ctl));
15658 + if (ctl.len < 0 && flags)
15666 + error = copy_from_user(&dat, datptr, sizeof(dat));
15674 +#ifdef CONFIG_ABI_IBCS_SPX
15675 + if (MAJOR(ino->i_rdev) == SOCKSYS_MAJOR && MINOR(ino->i_rdev) == 1) {
15676 + unsigned int newfd;
15678 + if (ctl.len != 4)
15681 + get_user(newfd, (unsigned int *)ctl.buf);
15682 + abi_trace(ABI_TRACE_STREAMS,
15683 + "%d putmsg dups descriptor %d", fd, newfd);
15684 + error = SYS(dup2)(newfd, fd);
15690 +#endif /* CONFIG_ABI_IBCS_SPX */
15692 +#ifdef CONFIG_ABI_XTI
15693 + return do_putmsg(fd, regs, ctl.buf, ctl.len,
15694 + dat.buf, dat.len, flags);
15695 +#else /* CONFIG_ABI_XTI */
15697 +#endif /* CONFIG_ABI_XTI */
15700 +int stream_fdinsert(struct pt_regs *regs, int fd, struct strfdinsert *arg)
15702 + struct strfdinsert sfd;
15705 + error = copy_from_user(&sfd, arg, sizeof(sfd));
15709 + abi_trace(ABI_TRACE_STREAMS,
15710 + "%u fdinsert: flags=%ld, fildes=%u, offset=%d",
15711 + fd, sfd.flags, sfd.fildes, sfd.offset);
15713 + return do_putmsg(fd, regs, sfd.ctlbuf.buf, sfd.ctlbuf.len,
15714 + sfd.datbuf.buf, sfd.datbuf.len, sfd.fildes);
15717 +#endif /* defined(CONFIG_ABI_XTI) || defined(CONFIG_ABI_IBCS_SPX) */
15718 diff -uNr --exclude-from=dontdiff linux-2.4.3/abi/svr4/ulimit.c linux/abi/svr4/ulimit.c
15719 --- linux-2.4.3/abi/svr4/ulimit.c Thu Jan 1 01:00:00 1970
15720 +++ linux/abi/svr4/ulimit.c Sun Mar 18 11:54:28 2001
15724 + * Copyright (C) 1993 Joe Portman (baron@hebron.connected.com)
15725 + * First stab at ulimit
15727 + * April 9 1994, corrected file size passed to/from setrlimit/getrlimit
15728 + * -- Graham Adams (gadams@ddrive.demon.co.uk)
15732 +#include <linux/module.h>
15733 +#include <linux/errno.h>
15734 +#include <linux/sched.h>
15735 +#include <linux/kernel.h>
15736 +#include <linux/unistd.h>
15737 +#include <linux/fs.h>
15738 +#include <linux/resource.h>
15739 +#include <asm/uaccess.h>
15741 +#include <abi/abi.h>
15742 +#include <abi/trace.h>
15745 + * Arguments to ulimit - it's one of the stupid multipled calls...
15747 +#define U_GETFSIZE (1) /* get max file size in blocks */
15748 +#define U_SETFSIZE (2) /* set max file size in blocks */
15749 +#define U_GETMEMLIM (3) /* get process size limit */
15750 +#define U_GETMAXOPEN (4) /* get max open files for this process */
15751 +#define U_GTXTOFF (64) /* get text offset */
15754 + * Define nominal block size parameters.
15756 +#define ULIM_BLOCKSIZE_BITS 9 /* block size = 512 */
15757 +#define ULIM_MAX_BLOCKSIZE (INT_MAX >> ULIM_BLOCKSIZE_BITS)
15761 +svr4_ulimit (int cmd, int val)
15765 + return (current->rlim[RLIMIT_FSIZE].rlim_cur) >> ULIM_BLOCKSIZE_BITS;
15768 + if ((val > ULIM_MAX_BLOCKSIZE) || (val < 0))
15770 + val <<= ULIM_BLOCKSIZE_BITS;
15771 + if (val > current->rlim[RLIMIT_FSIZE].rlim_max) {
15772 + if (!capable(CAP_SYS_RESOURCE))
15774 + current->rlim[RLIMIT_FSIZE].rlim_max = val;
15776 + current->rlim[RLIMIT_FSIZE].rlim_cur = val;
15779 + case U_GETMEMLIM:
15780 + return current->rlim[RLIMIT_DATA].rlim_cur;
15782 + case U_GETMAXOPEN:
15783 + return current->rlim[RLIMIT_NOFILE].rlim_cur;
15786 + abi_trace(ABI_TRACE_API, "unsupported ulimit call %d", cmd);
15790 +EXPORT_SYMBOL(svr4_ulimit);
15794 + * getrlimit/setrlimit args.
15796 +#define U_RLIMIT_CPU 0
15797 +#define U_RLIMIT_FSIZE 1
15798 +#define U_RLIMIT_DATA 2
15799 +#define U_RLIMIT_STACK 3
15800 +#define U_RLIMIT_CORE 4
15801 +#define U_RLIMIT_NOFILE 5
15802 +#define U_RLIMIT_AS 6
15806 +svr4_getrlimit(int cmd, void *val)
15809 + case U_RLIMIT_CPU:
15810 + cmd = RLIMIT_CPU;
15812 + case U_RLIMIT_FSIZE:
15813 + cmd = RLIMIT_FSIZE;
15815 + case U_RLIMIT_DATA:
15816 + cmd = RLIMIT_DATA;
15818 + case U_RLIMIT_STACK:
15819 + cmd = RLIMIT_STACK;
15821 + case U_RLIMIT_CORE:
15822 + cmd = RLIMIT_CORE;
15824 + case U_RLIMIT_NOFILE:
15825 + cmd = RLIMIT_NOFILE;
15827 + case U_RLIMIT_AS:
15834 + return SYS(getrlimit)(cmd, val);
15836 +EXPORT_SYMBOL(svr4_getrlimit);
15839 +svr4_setrlimit(int cmd, void *val)
15842 + case U_RLIMIT_CPU:
15843 + cmd = RLIMIT_CPU;
15845 + case U_RLIMIT_FSIZE:
15846 + cmd = RLIMIT_FSIZE;
15848 + case U_RLIMIT_DATA:
15849 + cmd = RLIMIT_DATA;
15851 + case U_RLIMIT_STACK:
15852 + cmd = RLIMIT_STACK;
15854 + case U_RLIMIT_CORE:
15855 + cmd = RLIMIT_CORE;
15857 + case U_RLIMIT_NOFILE:
15858 + cmd = RLIMIT_NOFILE;
15860 + case U_RLIMIT_AS:
15867 + return SYS(getrlimit)(cmd, val);
15869 +EXPORT_SYMBOL(svr4_setrlimit);
15870 diff -uNr --exclude-from=dontdiff linux-2.4.3/abi/svr4/utsname.c linux/abi/svr4/utsname.c
15871 --- linux-2.4.3/abi/svr4/utsname.c Thu Jan 1 01:00:00 1970
15872 +++ linux/abi/svr4/utsname.c Mon Mar 12 16:34:48 2001
15876 + * svr4 utsname emuation
15878 + * Copyright (C) 1994 Mike Jagdis (jaggy@purplet.demon.co.uk)
15880 + * The SVR4 utsname support is based on the code originally in svr4.c
15883 + * Copyright (C) 1994 Eric Youngdale.
15886 +#include <linux/module.h>
15887 +#include <linux/version.h>
15889 +#include <asm/uaccess.h>
15891 +#include <linux/mm.h>
15892 +#include <linux/sched.h>
15893 +#include <linux/personality.h>
15894 +#include <linux/utsname.h>
15896 +#include <abi/abi.h>
15898 +char sco_serial[10] = "public";
15900 +struct sco_utsname {
15902 + char nodename[9];
15903 + char release[16];
15904 + char kernelid[20];
15907 + char sysserial[10];
15908 + unsigned short sysorigin;
15909 + unsigned short sysoem;
15910 + char numusers[9];
15911 + unsigned short numcpu;
15914 +struct v7_utsname {
15916 + char nodename[9];
15922 +#define SVR4_NMLN 257
15923 +struct svr4_utsname {
15924 + char sysname[SVR4_NMLN];
15925 + char nodename[SVR4_NMLN];
15926 + char release[SVR4_NMLN];
15927 + char version[SVR4_NMLN];
15928 + char machine[SVR4_NMLN];
15932 +#define set_utsfield(to, from, dotchop) \
15935 + int i, len = (sizeof(to) > sizeof(from) ? sizeof(from) : sizeof(to)); \
15936 + __copy_to_user(to, from, len); \
15938 + for (p=from,i=0; *p && *p != '.' && --len; p++,i++); \
15941 + __put_user('\0', to+i); \
15946 +sco_utsname(unsigned long addr)
15949 + struct sco_utsname *it = (struct sco_utsname *)addr;
15951 + /* This shouldn't be invoked by anything that isn't running
15952 + * in the SCO personality. I can envisage a program that uses
15953 + * this to test if it is running on SCO or not. It probably
15954 + * won't happen but let's make sure it doesn't anyway...
15956 + if (!personality(PER_SCOSVR3))
15959 + down_read(&uts_sem);
15960 + error = verify_area(VERIFY_WRITE, it, sizeof (struct sco_utsname));
15963 + set_utsfield(it->sysname, system_utsname.nodename, 1);
15965 + set_utsfield(it->sysname, "SCO_SV", 0);
15967 + set_utsfield(it->nodename, system_utsname.nodename, 1);
15969 + set_utsfield(it->release, system_utsname.release, 0);
15971 + set_utsfield(it->release, "3.2v5.0.0\0", 0);
15973 + set_utsfield(it->kernelid, system_utsname.version, 0);
15974 + set_utsfield(it->machine, system_utsname.machine, 0);
15976 + set_utsfield(it->bustype, "EISA", 0);
15978 + set_utsfield(it->bustype, "ISA", 0);
15980 + set_utsfield(it->sysserial, sco_serial, 0);
15981 + __put_user(0xffff, &it->sysorigin);
15982 + __put_user(0xffff, &it->sysoem);
15983 + set_utsfield(it->numusers, "unlim", 0);
15984 + __put_user(1, &it->numcpu);
15986 + up_read(&uts_sem);
15992 +int v7_utsname(unsigned long addr)
15995 + struct v7_utsname *it = (struct v7_utsname *)addr;
15997 + down_read(&uts_sem);
15998 + error = verify_area(VERIFY_WRITE, it, sizeof (struct v7_utsname));
16000 + set_utsfield(it->sysname, system_utsname.nodename, 1);
16001 + set_utsfield(it->nodename, system_utsname.nodename, 1);
16002 + set_utsfield(it->release, system_utsname.release, 0);
16003 + set_utsfield(it->version, system_utsname.version, 0);
16004 + set_utsfield(it->machine, system_utsname.machine, 0);
16006 + up_read(&uts_sem);
16011 +EXPORT_SYMBOL(v7_utsname);
16013 +int abi_utsname(unsigned long addr)
16016 + struct svr4_utsname *it = (struct svr4_utsname *)addr;
16018 + down_read(&uts_sem);
16019 + error = verify_area(VERIFY_WRITE, it, sizeof (struct svr4_utsname));
16021 + set_utsfield(it->sysname, system_utsname.sysname, 0);
16022 + set_utsfield(it->nodename, system_utsname.nodename, 0);
16023 + set_utsfield(it->release, system_utsname.release, 0);
16024 + set_utsfield(it->version, system_utsname.version, 0);
16025 + set_utsfield(it->machine, system_utsname.machine, 0);
16027 + up_read(&uts_sem);
16032 +EXPORT_SYMBOL(abi_utsname);
16033 diff -uNr --exclude-from=dontdiff linux-2.4.3/abi/svr4/vtkbd.c linux/abi/svr4/vtkbd.c
16034 --- linux-2.4.3/abi/svr4/vtkbd.c Thu Jan 1 01:00:00 1970
16035 +++ linux/abi/svr4/vtkbd.c Mon Mar 12 16:34:48 2001
16039 + * This provides internal emulation support for the SCO <sys/vtkd.h> on
16040 + * the multiscreen console. More or less, this involves translating the
16041 + * input ioctl()'s into a similar Linux ioctl()'s.
16043 + * Not emulated SCO multiscreen functions:
16046 + * Not emulated SCO keyboard functions:
16047 + * KIOCDOSMODE set DOSMODE
16048 + * KIOCNONDOSMODE unset DOSMODE
16049 + * KDDISPINFO get display start and size
16050 + * KDGKBSTATE get state of keyboard shift keys
16052 + * Written by Scott Michel, scottm@intime.com
16053 + * (c) 1994 Scott Michel as part of the Linux iBCS-2 emulator project.
16057 +#include <linux/module.h>
16059 +#include <asm/uaccess.h>
16061 +#include <linux/errno.h>
16062 +#include <linux/fs.h>
16063 +#include <linux/sched.h>
16064 +#include <linux/kernel.h>
16065 +#include <linux/vt.h>
16066 +#include <linux/kd.h>
16068 +#include <abi/abi.h>
16069 +#include <abi/trace.h>
16072 + int in_ioctl; /* only lower 8 bits */
16073 + int out_ioctl; /* Linux version */
16076 + { 1, KDDISPTYPE },
16078 + { 2, KDMAPDISP },
16079 + { 3, KDUNMAPDISP },
16080 + { 6, KDGKBMODE },
16081 + { 7, KDSKBMODE },
16083 + { 9, KDGETMODE },
16084 + { 10, KDSETMODE },
16087 + { 60, KDENABIO },
16088 + { 61, KDDISABIO },
16090 + { 62, KIOCINFO },
16092 + { 63, KIOCSOUND },
16093 + { 64, KDGKBTYPE },
16094 + { 65, KDGETLED },
16095 + { 66, KDSETLED },
16098 +/*--------------------------------------------------------------------------
16099 + * ibcs_ioctl_vtkd()
16100 + *------------------------------------------------------------------------*/
16103 +ibcs_ioctl_vtkd(int fd, int todo, void *arg)
16105 + int gen = (todo >> 8) & 0xff, spec = todo & 0xff;
16108 + if (gen == 'v') {
16109 + /* Could make this translation process table based, but, why
16110 + waste the valuable kernel space? */
16112 + newf = (spec == 1 ? VT_OPENQRY :
16113 + (spec == 2 ? VT_SETMODE :
16114 + (spec == 3 ? VT_GETMODE :
16115 + (spec == 4 ? VT_RELDISP :
16116 + (spec == 5 ? VT_ACTIVATE : -1)))));
16118 + return SYS(ioctl)(fd, newf, arg);
16119 + } else if (gen == 'K') {
16120 + register unsigned int i;
16122 + for (i = 0; i < sizeof(trantab) / sizeof(trantab[0]); ++i) {
16123 + if (spec == trantab[i].in_ioctl)
16124 + return SYS(ioctl)(fd, trantab[i].out_ioctl, arg);
16128 + printk(KERN_ERR "iBCS: vtkd ioctl 0x%02x unsupported\n", todo);
16131 diff -uNr --exclude-from=dontdiff linux-2.4.3/abi/svr4/wyse_nfs.c linux/abi/svr4/wyse_nfs.c
16132 --- linux-2.4.3/abi/svr4/wyse_nfs.c Thu Jan 1 01:00:00 1970
16133 +++ linux/abi/svr4/wyse_nfs.c Fri Mar 30 15:23:46 2001
16137 +#include <linux/kernel.h>
16138 +#include <linux/config.h>
16139 +#include <abi/abi.h>
16141 +#define SC(name) (void *)__NR_##name
16142 +#define ITR(trace, name, args) ,trace,name,args
16144 +static ABI_func WYSENFS_funcs[] = {
16145 + { 0, Ukn ITR(1, "nfs_svc", "") }, /* 0 */
16146 + { 0, Ukn ITR(1, "async_daemon", "") }, /* 1 */
16147 + { 0, Ukn ITR(1, "nfs_getfh", "") }, /* 2 */
16148 + { 0, Ukn ITR(1, "nfsmount", "") } /* 3 */
16152 +void iBCS_class_WYSENFS(struct pt_regs *regs) {
16155 + i = regs->eax >> 8;
16157 + regs->eax = iABI_errors(-EINVAL);
16158 + regs->eflags |= 1;
16162 + abi_dispatch(regs, &WYSENFS_funcs[i],1);
16165 diff -uNr --exclude-from=dontdiff linux-2.4.3/abi/svr4/wyse_tcp.c linux/abi/svr4/wyse_tcp.c
16166 --- linux-2.4.3/abi/svr4/wyse_tcp.c Thu Jan 1 01:00:00 1970
16167 +++ linux/abi/svr4/wyse_tcp.c Fri Mar 30 15:23:46 2001
16171 +#include <linux/kernel.h>
16172 +#include <linux/config.h>
16173 +#include <abi/abi.h>
16175 +#define SC(name) (void *)__NR_##name
16177 +#define ITR(trace, name, args) ,trace,name,args
16179 +static ABI_func WYSETCP_funcs[] = {
16180 +#ifdef __TRACE_SELECT__
16181 + { abi_select, 5 ITR(0, "select", "dxxxx")},/* 0 */
16183 + { SC(_newselect), -5 ITR(0, "select", "dxxxx")},/* 0 */
16185 + { abi_socket, Spl ITR(0, "socket", "ddd") }, /* 1 */
16186 + { abi_connect, Spl ITR(0, "connect", "dxd") }, /* 2 */
16187 + { abi_accept, Spl ITR(0, "accept", "dxx") }, /* 3 */
16188 + { abi_send, Spl ITR(0, "send", "dxdd")}, /* 4 */
16189 + { abi_recv, Spl ITR(0, "recv", "dxdd")}, /* 5 */
16190 + { abi_bind, Spl ITR(0, "bind", "dxd") }, /* 6 */
16191 + { abi_setsockopt, Spl ITR(0, "setsockopt", "") }, /* 7 */
16192 + { abi_listen, Spl ITR(0, "listen", "dd") }, /* 8 */
16193 + { 0, 3 ITR(1, "recvmsg", "dxd") }, /* 9 */
16194 + { 0, 3 ITR(1, "sendmsg", "dxd") }, /* 10 */
16195 + { abi_getsockopt, Spl ITR(0, "getsockopt", "dddxx")}, /* 11 */
16196 + { abi_recvfrom, Spl ITR(0, "recvfrom", "dxddxd")},/* 12 */
16197 + { abi_sendto, Spl ITR(0, "sendto", "dxddxd")},/* 13 */
16198 + { abi_shutdown, Spl ITR(0, "shutdown", "dd") }, /* 14 */
16199 + { abi_socketpair, Spl ITR(0, "socketpair", "dddx")}, /* 15 */
16200 + { 0, Ukn ITR(1, "trace", "") }, /* 16 */
16201 + { abi_getpeername, Spl ITR(0, "getpeername", "dxx") }, /* 17 */
16202 + { abi_getsockname, Spl ITR(0, "getsockname", "") }, /* 18 */
16203 + { abi_wait3, 1 ITR(0, "wait3", "x") }, /* 19 */
16207 +void iBCS_class_WYSETCP(struct pt_regs *regs) {
16210 + i = regs->eax >> 8;
16212 + regs->eax = iABI_errors(-EINVAL);
16213 + regs->eflags |= 1;
16217 + abi_dispatch(regs, &WYSETCP_funcs[i], 1);
16220 diff -uNr --exclude-from=dontdiff linux-2.4.3/abi/svr4/xnx.c linux/abi/svr4/xnx.c
16221 --- linux-2.4.3/abi/svr4/xnx.c Thu Jan 1 01:00:00 1970
16222 +++ linux/abi/svr4/xnx.c Mon Mar 12 16:34:48 2001
16226 + * This file contains an emulation of Xenix syscalls that are used by SCO binaries
16228 + * Copyright (C) 1993,1994 Drew Sullivan
16229 + * Copyright (C) 1994,1995-1996 Mike Jagdis
16233 +#include <linux/module.h>
16235 +#include <asm/uaccess.h>
16237 +#include <linux/errno.h>
16238 +#include <linux/sched.h>
16239 +#include <linux/kernel.h>
16240 +#include <linux/mm.h>
16241 +#include <linux/stddef.h>
16242 +#include <linux/unistd.h>
16243 +#include <linux/ptrace.h>
16244 +#include <linux/fcntl.h>
16245 +#include <linux/time.h>
16246 +#include <linux/signal.h>
16247 +#include <linux/slab.h>
16249 +#include <asm/system.h>
16250 +#include <linux/fs.h>
16251 +#include <linux/sys.h>
16252 +#include <linux/termios.h>
16253 +#include <linux/limits.h>
16254 +#include <linux/vfs.h>
16256 +#include <abi/abi.h>
16257 +#include <abi/trace.h>
16258 +#include <abi/xnx.h>
16261 +#define XF_UNLCK 0
16262 +#define XF_WRLCK 1
16263 +#define XF_RDLCK 3
16266 +struct ibcs_flock {
16276 +/* locking() requires mandatory locking. Processes that attempt to
16277 + * read or write a region locked with locking() are required to block.
16278 + * You need to build a kernel with mandatory locking support and set
16279 + * the permissions on the required file to setgid, no group execute.
16281 +int xnx_locking(int fd, int mode, unsigned long size)
16284 + mm_segment_t old_fs;
16287 + if ((mode < 0 || mode > 7) && mode != 20) {
16288 + abi_trace(ABI_TRACE_API,
16289 + "unsupported locking() mode=0x%x", mode);
16293 + /* Modes 5, 6 & 7 are very like the fcntl mechanism but
16294 + * we can't just punt to that because the type values are
16297 + if (mode > 4 && mode < 8) {
16298 + struct ibcs_flock *ifl = (struct ibcs_flock *)size;
16301 + error = verify_area(VERIFY_READ, ifl, sizeof(*ifl));
16305 + get_user(t, &ifl->l_type);
16307 + case XF_UNLCK: t = F_UNLCK; break;
16308 + case XF_WRLCK: t = F_WRLCK; break;
16309 + case XF_RDLCK: t = F_RDLCK; break;
16310 + default: return -EINVAL;
16312 + put_user(t, &ifl->l_type);
16314 + error = SYS(fcntl)(fd, mode, ifl);
16316 + get_user(t, &ifl->l_type);
16318 + case F_UNLCK: t = XF_UNLCK; break;
16319 + case F_WRLCK: t = XF_WRLCK; break;
16320 + case F_RDLCK: t = XF_RDLCK; break;
16322 + put_user(t, &ifl->l_type);
16324 + get_user(t, &ifl->l_sysid);
16325 + put_user(t, &ifl->l_pid);
16326 + put_user(0, &ifl->l_sysid);
16330 + fl.l_type = (mode == 0 ? F_UNLCK
16331 + : ((mode <= 2 || mode == 20) ? F_WRLCK
16337 + old_fs = get_fs();
16338 + set_fs (get_ds());
16339 + error = SYS(fcntl)(fd,
16340 + mode == 5 ? F_GETLK
16341 + : (!(mode % 2) ? F_SETLK : F_SETLKW),
16348 +int xnx_creatsem(char *sem_name, int mode) {
16352 +int xnx_opensem(char *sem_name) {
16356 +int xnx_sigsem(int sem_num) {
16360 +int xnx_waitsem(int sem_num) {
16364 +int xnx_nbwaitsem(int sem_num) {
16368 +/* Check if input is available */
16369 +int xnx_rdchk(int fd) {
16370 + int error, nbytes;
16371 + mm_segment_t old_fs;
16373 + old_fs = get_fs();
16374 + set_fs (get_ds());
16375 + error = SYS(ioctl)(fd, FIONREAD, &nbytes);
16378 + if (error < 0) return error;
16379 + return nbytes ? 1 : 0;
16382 +/* Linux has a stub sys_ftime. Perhaps this should be there? On the other
16383 + * hand it's an old call that probably shouldn't be used by most modern
16384 + * applications so perhaps it's better here where it needn't bloat the
16387 +int xnx_ftime(struct timeb * tp) {
16388 + struct timeval tv;
16389 + struct timezone tz;
16391 + mm_segment_t old_fs;
16393 + error = verify_area(VERIFY_WRITE, tp, sizeof(struct timeb));
16397 + old_fs = get_fs();
16398 + set_fs (get_ds());
16399 + error = SYS(gettimeofday)(&tv, &tz);
16404 + put_user(tv.tv_sec, &tp->time);
16405 + put_user((unsigned short)(tv.tv_usec/1000), &tp->millitm);
16406 + put_user((short)tz.tz_minuteswest, &tp->timezone);
16407 + put_user((short)tz.tz_dsttime, &tp->dstflag);
16412 +/* go to sleep for period milliseconds */
16413 +int xnx_nap(long period)
16415 + __sighandler_t old_handler;
16416 + struct itimerval it;
16417 + struct timeval tv1, tv2;
16418 + struct timezone tz;
16419 + mm_segment_t old_fs;
16424 + it.it_interval.tv_sec = 0;
16425 + it.it_interval.tv_usec = 0;
16426 + it.it_value.tv_sec = 0;
16427 + it.it_value.tv_usec = period * 1000;
16428 + old_fs = get_fs();
16429 + set_fs (get_ds());
16430 + SYS(gettimeofday)(&tv1, &tz);
16431 + spin_lock_irq(¤t->sig[SIGALRM-1].siglock);
16432 + old_handler = current->sig->action[SIGALRM-1].sa.sa_handler;
16433 + current->sig->action[SIGALRM-1].sa.sa_handler = SIG_DFL;
16434 + spin_unlock_irq(¤t->sig[SIGALRM-1].siglock);
16435 + SYS(setitimer)(ITIMER_REAL, &it, NULL);
16437 + spin_lock_irq(¤t->sig[SIGALRM-1].siglock);
16438 + current->sig->action[SIGALRM-1].sa.sa_handler = old_handler;
16439 + spin_unlock_irq(¤t->sig[SIGALRM-1].siglock);
16440 + SYS(gettimeofday)(&tv2, &tz);
16443 + deactivate_signal(current, SIGALRM);
16445 + return (signal_pending(current)
16447 + : ((tv2.tv_sec - tv1.tv_sec) * 1000000
16448 + + (tv2.tv_usec - tv1.tv_usec)) / 1000);
16451 +int xnx_sdget(char *path, int flags, long size, int mode) {
16455 +int xnx_sdfree(char* addr) {
16459 +int xnx_sdenter(char *addr, int flags) {
16463 +int xnx_sdleave(char *addr) {
16467 +int xnx_sdgetv(char *addr) {
16471 +int xnx_sdwaitv(char *addr, int vnum) {
16475 +/* This allows processes to be allowed to exceed available swap. The man
16476 + * page isn't too clear - it seems to suggest Xenix supports physical
16477 + * memory > swap but this doesn't make sense to me? It almost certainly
16478 + * isn't useful for Linux to actually do anything with this - just lie.
16480 +int xnx_proctl(int pid, int command, char *arg) {
16482 +#define PRNORMEX 2
16486 +int xnx_execseg(excode_t oldaddr, unsigned size) {
16491 +int xnx_unexecseg(excode_t addr) {
16495 +/* eaccess() checks access to the given path using the effective
16496 + * uid/gid rather than the real uid/gid.
16498 +int xnx_eaccess(char *path, int mode) {
16499 + unsigned short ouid, ogid;
16502 + ouid = current->uid;
16503 + ogid = current->gid;
16504 + current->uid = current->euid;
16505 + current->gid = current->egid;
16507 + err = SYS(access)(path, mode);
16509 + current->uid = ouid;
16510 + current->gid = ogid;
16515 +/* This allows running adb without executing any programs, but disassembly
16516 + * will work fine with that lie.
16518 +int xnx_paccess(int pid, int cmd, int offset, int count, char *ptr) {
16522 +int xnx_sigpending(unsigned long *set) {
16527 +#define _PC_LINK_MAX 0
16528 +#define _PC_MAX_CANON 1
16529 +#define _PC_MAX_INPUT 2
16530 +#define _PC_NAME_MAX 3
16531 +#define _PC_PATH_MAX 4
16532 +#define _PC_PIPE_BUF 5
16533 +#define _PC_CHOWN_RESTRICTED 6
16534 +#define _PC_NO_TRUNC 7
16535 +#define _PC_VDISABLE 8
16538 +xnx_pathconf(char *path, int name)
16541 + case _PC_LINK_MAX:
16542 + /* Although Linux headers define values on a per
16543 + * filesystem basis there is no way to access
16544 + * these without hard coding fs information here
16545 + * so for now we use a bogus value.
16549 + case _PC_MAX_CANON:
16550 + return MAX_CANON;
16552 + case _PC_MAX_INPUT:
16553 + return MAX_INPUT;
16555 + case _PC_PATH_MAX:
16558 + case _PC_PIPE_BUF:
16561 + case _PC_CHOWN_RESTRICTED:
16562 + /* We should really think about this and tell
16567 + case _PC_NO_TRUNC:
16568 + /* Not sure... It could be fs dependent? */
16571 + case _PC_VDISABLE:
16574 + case _PC_NAME_MAX: {
16575 + struct statfs buf;
16578 + mm_segment_t old_fs;
16580 + p = getname(path);
16581 + error = PTR_ERR(p);
16582 + if (!IS_ERR(p)) {
16583 + old_fs = get_fs();
16584 + set_fs (get_ds());
16585 + error = SYS(statfs)(p, &buf);
16589 + return buf.f_namelen;
16599 +xnx_fpathconf(int fildes, int name)
16602 + case _PC_LINK_MAX:
16603 + /* Although Linux headers define values on a per
16604 + * filesystem basis there is no way to access
16605 + * these without hard coding fs information here
16606 + * so for now we use a bogus value.
16610 + case _PC_MAX_CANON:
16611 + return MAX_CANON;
16613 + case _PC_MAX_INPUT:
16614 + return MAX_INPUT;
16616 + case _PC_PATH_MAX:
16619 + case _PC_PIPE_BUF:
16622 + case _PC_CHOWN_RESTRICTED:
16623 + /* We should really think about this and tell
16628 + case _PC_NO_TRUNC:
16629 + /* Not sure... It could be fs dependent? */
16632 + case _PC_VDISABLE:
16635 + case _PC_NAME_MAX: {
16636 + struct statfs buf;
16638 + mm_segment_t old_fs;
16640 + old_fs = get_fs();
16641 + set_fs (get_ds());
16642 + error = SYS(statfs)(fildes, &buf);
16645 + return buf.f_namelen;
16652 diff -uNr --exclude-from=dontdiff linux-2.4.3/abi/svr4/xnx_funcs.c linux/abi/svr4/xnx_funcs.c
16653 --- linux-2.4.3/abi/svr4/xnx_funcs.c Thu Jan 1 01:00:00 1970
16654 +++ linux/abi/svr4/xnx_funcs.c Fri Mar 30 15:23:46 2001
16658 +#include <linux/config.h>
16659 +#include <linux/module.h>
16661 +#include <asm/uaccess.h>
16663 +#include <linux/kernel.h>
16665 +#include <abi/signal.h>
16666 +#include <abi/abi.h>
16667 +#include <abi/xnx.h>
16668 +#include <abi/abi4.h>
16670 +#define SC(name) (void *)__NR_##name
16671 +#define ITR(trace, name, args) ,trace,name,args
16674 + * Translate the signal number to the corresponding item for Linux.
16676 +static inline int abi_mapsig(int sig)
16678 + if ((unsigned int) sig >= NSIGNALS)
16680 + return current->exec_domain->signal_map[sig];
16684 +asmlinkage int sco_sigaction(int sco_signum, const struct sco_sigaction * action,
16685 + struct sco_sigaction * oldaction)
16687 + struct sco_sigaction new_sa, old_sa;
16688 + int error, signo;
16689 + mm_segment_t old_fs;
16690 + struct sigaction nsa, osa;
16692 + signo = abi_mapsig(sco_signum);
16697 + error = verify_area(VERIFY_WRITE, oldaction,
16698 + sizeof(struct sco_sigaction));
16704 + error = copy_from_user(&new_sa, action,
16705 + sizeof(struct sco_sigaction));
16708 + nsa.sa_restorer = NULL;
16709 + nsa.sa_handler = new_sa.sa_handler;
16710 + nsa.sa_mask = map_sigvec_to_kernel(new_sa.sa_mask,
16711 + current->exec_domain->signal_map);
16712 + nsa.sa_flags = SA_NOMASK;
16713 + if (new_sa.sa_flags & SCO_SA_NOCLDSTOP)
16714 + nsa.sa_flags |= SA_NOCLDSTOP;
16717 + old_fs = get_fs();
16718 + set_fs(get_ds());
16719 + error = SYS(rt_sigaction)(signo,
16720 + action ? &nsa : NULL,
16721 + oldaction ? &osa : NULL,
16722 + sizeof(sigset_t));
16725 + if (!error && oldaction) {
16726 + old_sa.sa_handler = osa.sa_handler;
16727 + old_sa.sa_mask = map_sigvec_from_kernel(osa.sa_mask,
16728 + current->exec_domain->signal_invmap);
16729 + old_sa.sa_flags = 0;
16730 + if(osa.sa_flags & SA_NOCLDSTOP)
16731 + old_sa.sa_flags |= SCO_SA_NOCLDSTOP;
16732 + /* This should never fail... */
16733 + copy_to_user(oldaction, &old_sa, sizeof(struct sco_sigaction));
16738 +static ABI_func XNX_funcs[] = {
16739 + { 0, Ukn ITR(1, "syscall", "") }, /* 0 */
16740 + { xnx_locking, 3 ITR(0, "locking", "ddd") }, /* 1 */
16741 + { xnx_creatsem, 2 ITR(1, "creatsem", "sd") }, /* 2 */
16742 + { xnx_opensem, 1 ITR(1, "opensem", "s") }, /* 3 */
16743 + { xnx_sigsem, 1 ITR(1, "sigsem", "d") }, /* 4 */
16744 + { xnx_waitsem, 1 ITR(1, "waitsem", "d") }, /* 5 */
16745 + { xnx_nbwaitsem, 1 ITR(1, "nbwaitsem", "d") }, /* 6 */
16746 + { xnx_rdchk, 1 ITR(0, "rdchk", "d") }, /* 7 */
16747 + { 0, Ukn ITR(1, "stkgro", "") }, /* 8 */
16748 + { 0, Ukn ITR(1, "?", "") }, /* 9 */
16749 + { SC(ftruncate), -2 ITR(0, "chsize", "dd") }, /* 10 */
16750 + { xnx_ftime, 1 ITR(0, "ftime", "x") }, /* 11 */
16751 + { xnx_nap, 1 ITR(0, "nap", "d") }, /* 12 */
16752 + { xnx_sdget, 4 ITR(1, "sdget", "sddd") }, /* 13 */
16753 + { xnx_sdfree, 1 ITR(1, "sdfree", "x") }, /* 14 */
16754 + { xnx_sdenter, 2 ITR(1, "sdenter", "xd") }, /* 15 */
16755 + { xnx_sdleave, 1 ITR(1, "sdleave", "x") }, /* 16 */
16756 + { xnx_sdgetv, 1 ITR(1, "sdgetv", "x") }, /* 17 */
16757 + { xnx_sdwaitv, 2 ITR(1, "sdwaitv", "xd") }, /* 18 */
16758 + { 0, Ukn ITR(1, "brkctl", "") }, /* 19 */
16759 + { 0, Ukn ITR(1, "?", "") }, /* 20 */
16760 + { 0, 2 ITR(0, "sco-getcwd?", "dx") }, /* 21 */
16761 + { 0, Ukn ITR(1, "?", "") }, /* 22 */
16762 + { 0, Ukn ITR(1, "?", "") }, /* 23 */
16763 + { 0, Ukn ITR(1, "?", "") }, /* 24 */
16764 + { 0, Ukn ITR(1, "?", "") }, /* 25 */
16765 + { 0, Ukn ITR(1, "?", "") }, /* 26 */
16766 + { 0, Ukn ITR(1, "?", "") }, /* 27 */
16767 + { 0, Ukn ITR(1, "?", "") }, /* 28 */
16768 + { 0, Ukn ITR(1, "?", "") }, /* 29 */
16769 + { 0, Ukn ITR(1, "?", "") }, /* 30 */
16770 + { 0, Ukn ITR(1, "?", "") }, /* 31 */
16771 + { xnx_proctl, 3 ITR(0, "proctl", "ddx") }, /* 32 */
16772 + { xnx_execseg, 2 ITR(1, "execseg", "xd") }, /* 33 */
16773 + { xnx_unexecseg, 1 ITR(1, "unexecseg", "x") }, /* 34 */
16774 + { 0, Ukn ITR(1, "?", "") }, /* 35 */
16775 +#ifdef __TRACE_SELECT__
16776 + { abi_select, 5 ITR(0, "select", "dxxxx")}, /* 36 */
16778 + { SC(_newselect), -5 ITR(0, "select", "dxxxx")}, /* 36 */
16780 + { xnx_eaccess, 2 ITR(0, "eaccess", "so") }, /* 37 */
16781 + { xnx_paccess, 5 ITR(1, "paccess", "dddds")},/* 38 */
16782 + { sco_sigaction, 3 ITR(0, "sigaction", "dxx") }, /* 39 */
16783 + { abi_sigprocmask, 3 ITR(0, "sigprocmask", "dxx") }, /* 40 */
16784 + { xnx_sigpending, 1 ITR(1, "sigpending", "x") }, /* 41 */
16785 + { abi_sigsuspend, Spl ITR(0, "sigsuspend", "x") }, /* 42 */
16786 + { SC(getgroups), -2 ITR(0, "getgroups", "dx") }, /* 43 */
16787 + { SC(setgroups), -2 ITR(0, "setgroups", "dx") }, /* 44 */
16788 + { ibcs_sysconf, 1 ITR(0, "sysconf", "d") }, /* 45 */
16789 + { xnx_pathconf, 2 ITR(0, "pathconf", "sd") }, /* 46 */
16790 + { xnx_fpathconf, 2 ITR(0, "fpathconf", "dd") }, /* 47 */
16791 + { SC(rename), -2 ITR(0, "rename", "ss") }, /* 48 */
16792 + { 0, Ukn ITR(1, "?", "") }, /* 49 */
16793 + { sco_utsname, 1 ITR(0, "sco_utsname", "x") }, /* 50 */
16794 + { 0, Ukn ITR(1, "?", "") }, /* 51 */
16795 + { 0, Ukn ITR(1, "?", "") }, /* 52 */
16796 + { 0, Ukn ITR(1, "?", "") }, /* 53 */
16797 + { 0, Ukn ITR(1, "?", "") }, /* 54 */
16798 + { SC(getitimer), -2 ITR(0, "getitimer", "dx") }, /* 55 */
16799 + { SC(setitimer), -3 ITR(0, "setitimer", "dxx") } /* 56 */
16803 +void iBCS_class_XNX(struct pt_regs *regs)
16807 + i = regs->eax >> 8;
16809 + regs->eax = iABI_errors(-EINVAL);
16810 + regs->eflags |= 1;
16814 + abi_dispatch(regs, &XNX_funcs[i], 1);
16818 +EXPORT_SYMBOL(iBCS_class_XNX);
16819 diff -uNr --exclude-from=dontdiff linux-2.4.3/abi/svr4/xstat.c linux/abi/svr4/xstat.c
16820 --- linux-2.4.3/abi/svr4/xstat.c Thu Jan 1 01:00:00 1970
16821 +++ linux/abi/svr4/xstat.c Mon Mar 12 16:34:48 2001
16824 + * xstat.c - xstat(2) related code for sysv emulation
16826 + * Copyright (C) 1991, 1992 Linus Torvalds
16828 + * Hacked by Eric Youngdale for iBCS (1993, 1994).
16829 + * Added to by Drew Sullivan, modified by EY for xstat (used by SVr4).
16830 + * Modified by Christoph Hellwig for Kernel 2.4
16833 +#include <linux/config.h>
16834 +#include <linux/module.h>
16836 +#include <asm/uaccess.h>
16838 +#include <linux/kernel.h>
16839 +#include <linux/fs.h>
16840 +#include <linux/errno.h>
16841 +#include <linux/mm.h>
16842 +#include <linux/sched.h>
16843 +#include <linux/sys.h>
16844 +#include <linux/file.h>
16846 +#include <abi/abi.h>
16847 +#include <abi/abi4.h>
16848 +#include <abi/trace.h>
16849 +#include <abi/lfs.h>
16852 + * The xstat interface is used by SVr4, and is effectively an extension
16853 + * to stat. The general idea is that stat has some limitations (chiefly
16854 + * 16 bit inode numbers), and the solution in SVr4 was to add an entirely
16855 + * new syscall. The /usr/include/sys/stat.h header file defines stat as xstat
16856 + * so that the new interface is used. The one advantage of xstat is that
16857 + * we pass a version number so that it is possible to tell exactly what
16858 + * the application is expecting, and it is easy to do the right thing.
16859 + * There is usually an inline wrapper function in /usr/include/sys/stat.h
16860 + * to perform this conversion.
16863 +#define R3_MKNOD_VERSION 1 /* SVr3 */
16864 +#define R4_MKNOD_VERSION 2 /* SVr4 */
16865 +#define R3_STAT_VERSION 1 /* SVr3 */
16866 +#define R4_STAT_VERSION 2 /* SVr4 */
16867 +#define UW7_XSTAT64_VERSION 4 /* UW7 xstat64 */
16868 +#define SCO_STAT_VERSION 51 /* SCO OS5 */
16870 +/* Various functions to provide compatibility between the linux
16871 + syscalls and the ABI ABI compliant calls */
16873 +/* Convert a linux dev number into the SVr4 equivalent. */
16874 +#define R4_DEV(DEV) ((DEV & 0xff) | ((DEV & 0xff00) << 10))
16877 +struct sco_xstat {
16880 + unsigned long st_ino;
16881 + unsigned short st_mode;
16883 + unsigned short st_uid;
16884 + unsigned short st_gid;
16894 + char st_fstype[16];
16896 + long st_sco_flags;
16902 + * st_blocks and st_blksize are approximated with a simple algorithm if
16903 + * they aren't supported directly by the filesystem. The minix and msdos
16904 + * filesystems don't keep track of blocks, so they would either have to
16905 + * be counted explicitly (by delving into the file itself), or by using
16906 + * this simple algorithm to get a reasonable (although not 100% accurate)
16909 + * Use minix fs values for the number of direct and indirect blocks. The
16910 + * count is now exact for the minix fs except that it counts zero blocks.
16911 + * Everything is in BLOCK_SIZE'd units until the assignment to
16912 + * tmp.st_blksize.
16915 +set_blocks(struct inode *inode, long *st_blksize, long *st_blocks)
16917 + long blocks, indirect;
16920 +#define I_B (BLOCK_SIZE / sizeof(unsigned short))
16922 + if (!inode->i_blksize) {
16923 + blocks = (inode->i_size + BLOCK_SIZE - 1) / BLOCK_SIZE;
16924 + if (blocks > D_B) {
16925 + indirect = (blocks - D_B + I_B - 1) / I_B;
16926 + blocks += indirect;
16927 + if (indirect > 1) {
16928 + indirect = (indirect - 1 + I_B - 1) / I_B;
16929 + blocks += indirect;
16930 + if (indirect > 1)
16934 + *st_blocks = (BLOCK_SIZE / 512) * blocks;
16935 + *st_blksize = BLOCK_SIZE;
16937 + *st_blocks = inode->i_blocks;
16938 + *st_blksize = inode->i_blksize;
16944 +cp_sco_xstat(struct inode * inode, struct sco_xstat * statbuf)
16946 + struct sco_xstat tmp = {0, };
16949 + * If we thought we were in a short inode environment we are
16950 + * probably already too late - getdents() will have likely
16951 + * already assumed short inodes and "fixed" anything with
16952 + * a zero low word (because it must match stat() which must
16953 + * match read() on a directory). We will just have to go
16956 + if ((current->personality & SHORT_INODE)
16957 + && !((unsigned long)tmp.st_ino & 0xffff))
16958 + tmp.st_ino = 0xfffffffe;
16960 + tmp.st_ino = inode->i_ino;
16961 + tmp.st_dev = inode->i_dev;
16962 + tmp.st_mode = inode->i_mode;
16963 + tmp.st_nlink = inode->i_nlink;
16964 + tmp.st_uid = inode->i_uid;
16965 + tmp.st_gid = inode->i_gid;
16966 + tmp.st_rdev = inode->i_rdev;
16967 + tmp.st_size = inode->i_size;
16968 + tmp.st_atime = inode->i_atime;
16969 + tmp.st_mtime = inode->i_mtime;
16970 + tmp.st_ctime = inode->i_ctime;
16971 + set_blocks(inode, &tmp.st_blksize, &tmp.st_blocks);
16972 + strcpy(tmp.st_fstype, "ext2");
16973 + tmp.st_sco_flags = 0; /* 1 if remote */
16974 + return copy_to_user(statbuf, &tmp, sizeof(tmp)) ? -EFAULT : 0;
16979 +cp_svr4_xstat(struct inode * inode, struct svr4_xstat * statbuf)
16981 + struct svr4_xstat tmp = {0, };
16983 + tmp.st_dev = R4_DEV(inode->i_dev);
16984 + tmp.st_ino = inode->i_ino;
16985 + tmp.st_mode = inode->i_mode;
16986 + tmp.st_nlink = inode->i_nlink;
16987 + tmp.st_uid = inode->i_uid;
16988 + tmp.st_gid = inode->i_gid;
16989 + tmp.st_rdev = R4_DEV(inode->i_rdev);
16990 + tmp.st_size = inode->i_size;
16991 + tmp.st_atim.tv_sec = inode->i_atime;
16992 + tmp.st_mtim.tv_sec = inode->i_mtime;
16993 + tmp.st_ctim.tv_sec = inode->i_ctime;
16994 + set_blocks(inode, &tmp.st_blksize, &tmp.st_blocks);
16995 + strcpy(tmp.st_fstype, "ext2");
16996 + return copy_to_user(statbuf, &tmp, sizeof(tmp)) ? -EFAULT : 0;
17000 +cp_uw7_stat64(struct inode * inode, struct uw7_stat64 * statbuf)
17002 + struct uw7_stat64 tmp = {0, };
17004 + tmp.st_dev = inode->i_dev;
17005 + tmp.st_ino = (unsigned long long)inode->i_ino;
17006 + tmp.st_mode = (unsigned long)inode->i_mode;
17007 + tmp.st_nlink = inode->i_nlink;
17008 + tmp.st_uid = inode->i_uid;
17009 + tmp.st_gid = inode->i_gid;
17010 + tmp.st_rdev = inode->i_rdev; /* XXX check this! */
17011 + tmp.st_size = (long long)inode->i_size;
17012 + tmp.st_atime.tv_sec = inode->i_atime;
17013 + tmp.st_atime.tv_usec = 0L;
17014 + tmp.st_mtime.tv_sec = inode->i_mtime;
17015 + tmp.st_mtime.tv_usec = 0L;
17016 + tmp.st_ctime.tv_sec = inode->i_ctime;
17017 + tmp.st_ctime.tv_usec = 0L;
17018 + set_blocks(inode, &tmp.st_blksize, (long *)&tmp.st_blocks);
17019 + strcpy(tmp.st_fstype, "ext2");
17020 + tmp.st_aclcnt = 0;
17021 + tmp.st_level = 0;
17022 + tmp.st_flags = 0;
17023 + tmp.st_cmwlevel = 0;
17025 + return copy_to_user(statbuf, &tmp, sizeof(tmp)) ? -EFAULT : 0;
17028 +int svr4_xstat(int vers, char * filename, void * buf)
17030 + struct nameidata nd;
17033 + if (vers == R3_STAT_VERSION)
17034 + return abi_stat(filename, (struct ibcs_stat *)buf);
17036 + error = user_path_walk(filename, &nd);
17040 + error = do_revalidate(nd.dentry);
17043 + case R4_STAT_VERSION:
17044 + error = cp_svr4_xstat(nd.dentry->d_inode, buf);
17047 + case SCO_STAT_VERSION:
17048 + error = cp_sco_xstat(nd.dentry->d_inode, buf);
17051 + case UW7_XSTAT64_VERSION:
17052 + error = cp_uw7_stat64(nd.dentry->d_inode, buf);
17057 + abi_trace(ABI_TRACE_API,
17058 + "xstat version %d not supported",
17063 + path_release(&nd);
17067 +EXPORT_SYMBOL(svr4_xstat);
17069 +int svr4_lxstat(int vers, char * filename, void * buf)
17071 + struct nameidata nd;
17074 + if (vers == R3_STAT_VERSION)
17075 + return abi_lstat(filename, (struct ibcs_stat *)buf);
17077 + error = user_path_walk_link(filename, &nd);
17081 + error = do_revalidate(nd.dentry);
17084 + case R4_STAT_VERSION:
17085 + error = cp_svr4_xstat(nd.dentry->d_inode, buf);
17088 + case SCO_STAT_VERSION:
17089 + error = cp_sco_xstat(nd.dentry->d_inode, buf);
17092 + case UW7_XSTAT64_VERSION:
17093 + error = cp_uw7_stat64(nd.dentry->d_inode, buf);
17098 + abi_trace(ABI_TRACE_API,
17099 + "xstat version %d not supported",
17104 + path_release(&nd);
17108 +EXPORT_SYMBOL(svr4_lxstat);
17110 +int svr4_fxstat(int vers, int fd, void *buf)
17113 + int error = -EBADF;
17115 + if (vers == R3_STAT_VERSION)
17116 + return abi_fstat(fd, (struct ibcs_stat *)buf);
17120 + struct dentry * dentry = f->f_dentry;
17122 + error = do_revalidate(dentry);
17125 + case R4_STAT_VERSION:
17126 + error = cp_svr4_xstat(dentry->d_inode, buf);
17129 + case SCO_STAT_VERSION:
17130 + error = cp_sco_xstat(dentry->d_inode, buf);
17133 + case UW7_XSTAT64_VERSION:
17134 + error = cp_uw7_stat64(dentry->d_inode, buf);
17138 + abi_trace(ABI_TRACE_API,
17139 + "fxstat version %d not supported", vers);
17148 +EXPORT_SYMBOL(svr4_fxstat);
17150 +int svr4_xmknod(int vers, const char * path, mode_t mode, dev_t dev)
17152 + unsigned int major, minor;
17155 + case R3_MKNOD_VERSION:
17156 + return abi_mknod(path, mode, dev);
17158 + case R4_MKNOD_VERSION:
17159 + minor = dev & 0x3ffff;
17160 + major = dev >> 18;
17161 + if (minor > 0xff || major > 0xff)
17163 + return abi_mknod(path, mode, ((major << 8) | minor));
17166 + abi_trace(ABI_TRACE_API,
17167 + "xmknod version %d not supported", vers);
17171 +EXPORT_SYMBOL(svr4_xmknod);
17174 + * The following code implements the statvfs function used by SVr4.
17178 +cp_abi_statvfs(struct dentry *dentry,
17179 + struct statfs *src, struct abi_statvfs *statbuf)
17181 + struct inode *inode = dentry->d_inode;
17182 + struct abi_statvfs tmp = {0, };
17184 + tmp.f_blocks = src->f_blocks;
17186 + tmp.f_bsize = src->f_bsize;
17187 + tmp.f_frsize = 0;
17188 + tmp.f_blocks = src->f_blocks;;
17189 + tmp.f_bfree = src->f_bfree;
17190 + tmp.f_bavail = src->f_bavail;
17191 + tmp.f_files = src->f_files;
17192 + tmp.f_free = src->f_ffree;
17193 + tmp.f_sid = inode->i_sb->s_dev;
17195 + /* Get the name of the filesystem */
17196 + strcpy(tmp.f_basetype, inode->i_sb->s_type->name);
17199 + if (IS_RDONLY(inode)) tmp.f_flag |= 1;
17200 + if (IS_NOSUID(inode)) tmp.f_flag |= 2;
17202 + tmp.f_namemax = src->f_namelen;
17204 + return copy_to_user(statbuf, &tmp, sizeof(tmp)) ? -EFAULT : 0;
17209 +cp_sco_statvfs(struct dentry *dentry,
17210 + struct statfs *src, struct sco_statvfs *statbuf)
17212 + struct inode *inode = dentry->d_inode;
17213 + struct sco_statvfs tmp = {0, };
17215 + tmp.f_blocks = src->f_blocks;
17217 + tmp.f_bsize = src->f_bsize;
17218 + tmp.f_frsize = src->f_bsize;
17219 + tmp.f_blocks = src->f_blocks;;
17220 + tmp.f_bfree = src->f_bfree;
17221 + tmp.f_bavail = src->f_bavail;
17222 + tmp.f_files = src->f_files;
17223 + tmp.f_free = src->f_ffree;
17224 + tmp.f_favail = src->f_ffree; /* SCO addition in the middle! */
17225 + tmp.f_sid = inode->i_sb->s_dev;
17227 + /* Get the name of the filesystem. Sadly, some code
17228 + * "in the wild" actually checks the name against a
17229 + * hard coded list to see if it is a "real" fs or not.
17230 + * I believe Informix Dynamic Server for SCO is one such.
17233 + if (personality(PER_SCOSVR3)
17234 + && !strncmp(inode->i_sb->s_type->name, "ext2", 4)) {
17235 + strcpy(tmp.f_basetype, "HTFS");
17237 + strcpy(tmp.f_basetype, inode->i_sb->s_type->name);
17241 + if (IS_RDONLY(inode)) tmp.f_flag |= 1;
17242 + if (IS_NOSUID(inode)) tmp.f_flag |= 2;
17244 + tmp.f_namemax = src->f_namelen;
17246 + return copy_to_user(statbuf, &tmp, sizeof(tmp)) ? -EFAULT : 0;
17249 +int abi_statvfs(char * filename, void * stat)
17251 + struct nameidata nd;
17254 + error = user_path_walk(filename, &nd);
17256 + struct statfs tmp;
17257 + error = vfs_statfs(nd.dentry->d_inode->i_sb, &tmp);
17259 + if (personality(PER_SCOSVR3))
17260 + error = cp_sco_statvfs(nd.dentry, &tmp, stat);
17262 + error = cp_abi_statvfs(nd.dentry, &tmp, stat);
17264 + path_release(&nd);
17269 +EXPORT_SYMBOL(abi_statvfs);
17272 +int abi_fstatvfs(int fd, void *stat)
17274 + struct file * file;
17275 + struct statfs tmp;
17282 + error = vfs_statfs(file->f_dentry->d_inode->i_sb, &tmp);
17284 + if (personality(PER_SCOSVR3))
17285 + error = cp_sco_statvfs(file->f_dentry, &tmp, stat);
17287 + error = cp_abi_statvfs(file->f_dentry, &tmp, stat);
17293 diff -uNr --exclude-from=dontdiff linux-2.4.3/abi/uw7/Makefile linux/abi/uw7/Makefile
17294 --- linux-2.4.3/abi/uw7/Makefile Thu Jan 1 01:00:00 1970
17295 +++ linux/abi/uw7/Makefile Fri Mar 30 18:25:34 2001
17298 +# Makefile for the kernel ABI code for UnixWare 7.x emulation
17301 +O_TARGET := dummy.o
17303 +list-multi := abi-uw7.o
17304 +abi-uw7-objs := funcs.o kernel.o ioctl.o context.o mac.o access.o \
17307 +obj-$(CONFIG_ABI_UW7) += abi-uw7.o
17310 +include $(TOPDIR)/Rules.make
17312 +abi-uw7.o: $(abi-uw7-objs)
17313 + $(LD) -r -o $@ $(abi-uw7-objs)
17314 diff -uNr --exclude-from=dontdiff linux-2.4.3/abi/uw7/access.c linux/abi/uw7/access.c
17315 --- linux-2.4.3/abi/uw7/access.c Thu Jan 1 01:00:00 1970
17316 +++ linux/abi/uw7/access.c Sun Mar 18 17:35:58 2001
17319 + * abi/uw7/access.c - support for UnixWare access(2) system call.
17321 + * We handle the non-POSIX EFF_ONLY_OK/EX_OK flags.
17322 + * This software is under GPL.
17325 +#include <linux/errno.h>
17326 +#include <linux/sched.h>
17327 +#include <asm/uaccess.h>
17329 +#include <abi/abi.h>
17330 +#include <abi/uw7.h>
17335 +#define DBG(x...) printk(x)
17340 +#define UW7_R_OK 004
17341 +#define UW7_W_OK 002
17342 +#define UW7_X_OK 001
17343 +#define UW7_F_OK 000
17344 +#define UW7_EFF_ONLY_OK 010
17345 +#define UW7_EX_OK 020
17347 +#define UW7_MODE_MSK (UW7_R_OK|UW7_W_OK|UW7_X_OK|UW7_F_OK|UW7_EFF_ONLY_OK|UW7_EX_OK)
17349 +int uw7_access(char * filename, int mode)
17351 + struct nameidata nd;
17354 + DBG(KERN_ERR "UW7[%d]: access(%p,%o)\n", current->pid, filename, mode);
17356 + if (mode & ~UW7_MODE_MSK)
17359 + if (mode & UW7_EX_OK) {
17360 + error = user_path_walk(filename, &nd);
17362 + error = do_revalidate(nd.dentry);
17364 + path_release(&nd);
17367 + if (!S_ISREG(nd.dentry->d_inode->i_mode)) {
17368 + path_release(&nd);
17371 + path_release(&nd);
17373 + mode &= ~UW7_EX_OK;
17374 + mode |= UW7_X_OK;
17376 + if (mode & UW7_EFF_ONLY_OK) {
17377 + uid_t old_uid = current->uid, old_gid = current->gid;
17379 + current->uid = current->euid;
17380 + current->gid = current->egid;
17381 + mode &= ~UW7_EFF_ONLY_OK;
17382 + error = SYS(access)(filename, mode);
17383 + current->uid = old_uid;
17384 + current->gid = old_gid;
17386 + error = SYS(access)(filename, mode);
17390 diff -uNr --exclude-from=dontdiff linux-2.4.3/abi/uw7/context.c linux/abi/uw7/context.c
17391 --- linux-2.4.3/abi/uw7/context.c Thu Jan 1 01:00:00 1970
17392 +++ linux/abi/uw7/context.c Mon Mar 12 16:34:48 2001
17395 + * abi/uw7/context.c
17397 + * This software is under GPL
17401 +#include <linux/ptrace.h>
17402 +#include <linux/errno.h>
17404 +#include <asm/uaccess.h>
17406 +#include <abi/abi.h>
17407 +#include <abi/uw7.h>
17408 +#include <abi/uw7_context.h>
17411 +uw7_sigaltstack(const uw7_stack_t *uw7_ss, uw7_stack_t *uw7_oss)
17413 + stack_t ss, oss, *ssp = NULL, *ossp = NULL;
17415 + mm_segment_t old_fs;
17418 + error = verify_area(VERIFY_READ, uw7_ss, sizeof(uw7_stack_t));
17421 + __get_user(ss.ss_sp, &uw7_ss->ss_sp);
17422 + __get_user(ss.ss_size, &uw7_ss->ss_size);
17423 + __get_user(ss.ss_flags, &uw7_ss->ss_flags);
17428 + error = verify_area(VERIFY_WRITE, uw7_oss, sizeof(uw7_stack_t));
17431 + __get_user(oss.ss_sp, &uw7_oss->ss_sp);
17432 + __get_user(oss.ss_size, &uw7_oss->ss_size);
17433 + __get_user(oss.ss_flags, &uw7_oss->ss_flags);
17437 + old_fs = get_fs();
17438 + set_fs(get_ds());
17439 + error = SYS(sigaltstack)(ssp, ossp);
17443 + __put_user(ossp->ss_sp, &uw7_oss->ss_sp);
17444 + __put_user(ossp->ss_size, &uw7_oss->ss_size);
17445 + __put_user(ossp->ss_flags, &uw7_oss->ss_flags);
17451 +getcontext(uw7_context_t * uc, struct pt_regs * regs)
17453 + uw7_context_t tmp = { 0 };
17455 + return copy_to_user(uc, &tmp, sizeof(uw7_context_t)) ? -EFAULT : 0;
17459 +getxcontext(uw7_context_t * uc, struct pt_regs * regs)
17465 +setcontext(uw7_context_t * uc, struct pt_regs * regs)
17467 + if (!uc) /* SVR4 says setcontext(NULL) => exit(0) */
17473 +uw7_context(struct pt_regs * regs)
17475 + int fcn = get_syscall_parameter(regs, 0);
17476 + uw7_context_t * uc = (uw7_context_t *) get_syscall_parameter(regs, 1);
17479 + case UW7_GETCONTEXT:
17480 + return getcontext(uc, regs);
17482 + case UW7_GETXCONTEXT:
17483 + return getxcontext(uc, regs);
17485 + case UW7_SETCONTEXT:
17486 + return setcontext(uc, regs);
17490 diff -uNr --exclude-from=dontdiff linux-2.4.3/abi/uw7/funcs.c linux/abi/uw7/funcs.c
17491 --- linux-2.4.3/abi/uw7/funcs.c Thu Jan 1 01:00:00 1970
17492 +++ linux/abi/uw7/funcs.c Fri Mar 30 18:28:41 2001
17495 + * abi/uw7/funcs.c - UnixWare 7.x system call dispatch table.
17497 + * This software is under GPL
17500 +#include <linux/module.h>
17501 +#include <linux/init.h>
17502 +#include <linux/kernel.h>
17504 +#include <abi/abi.h>
17505 +#include <abi/abi4.h>
17506 +#include <abi/svr4.h>
17507 +#include <abi/uw7.h>
17508 +#include <abi/uw7_context.h>
17511 +MODULE_DESCRIPTION("SCO UnixWare 7.x emulator");
17514 +extern void iBCS_class_XNX(struct pt_regs *regs);
17516 +ABI_func uw7_funcs[] = {
17517 + { abi_syscall, Fast ITR(0, "syscall", "") }, /* 0 */
17518 + { SC(exit), -1 ITR(0, "exit", "d") }, /* 1 */
17519 + { abi_fork, Spl ITR(0, "fork", "") }, /* 2 */
17520 + { abi_read, 3 ITR(0, "read", "dpd") }, /* 3 */
17521 + { SC(write), -3 ITR(0, "write", "dpd") }, /* 4 */
17522 + { svr4_open, 3 ITR(0, "open", "soo") }, /* 5 */
17523 + { SC(close), -1 ITR(0, "close", "d") }, /* 6 */
17524 + { abi_wait, Spl ITR(0, "wait", "xxx") }, /* 7 */
17525 + { SC(creat), -2 ITR(0, "creat", "so") }, /* 8 */
17526 + { SC(link), -2 ITR(0, "link", "ss") }, /* 9 */
17527 + { SC(unlink), -1 ITR(0, "unlink", "s") }, /* 10 */
17528 + { abi_exec, Spl ITR(0, "exec", "sxx") }, /* 11 */
17529 + { SC(chdir), -1 ITR(0, "chdir", "s") }, /* 12 */
17530 + { abi_time, 0 ITR(0, "time", "") }, /* 13 */
17531 + { abi_mknod, 3 ITR(0, "mknod", "soo") }, /* 14 */
17532 + { SC(chmod), -2 ITR(0, "chmod", "so") }, /* 15 */
17533 + { SC(chown), -3 ITR(0, "chown", "sdd") }, /* 16 */
17534 + { abi_brk, 1 ITR(0, "brk/break", "x") }, /* 17 */
17535 + { abi_stat, 2 ITR(0, "stat", "sp") }, /* 18 */
17536 + { abi_lseek, 3 ITR(0, "seek/lseek", "ddd") }, /* 19 */
17537 + { abi_getpid, Spl ITR(0, "getpid", "") }, /* 20 */
17538 + { 0, Ukn ITR(1, "mount", "") }, /* 21 */
17539 + { SC(umount), -1 ITR(0, "umount", "s") }, /* 22 */
17540 + { SC(setuid), -1 ITR(0, "setuid", "d") }, /* 23 */
17541 + { abi_getuid, Spl ITR(0, "getuid", "") }, /* 24 */
17542 + { SC(stime), -1 ITR(0, "stime", "d") }, /* 25 */
17543 + { svr4_ptrace, 4 ITR(0, "ptrace", "xdxx") }, /* 26 */
17544 + { SC(alarm), -1 ITR(0, "alarm", "d") }, /* 27 */
17545 + { abi_fstat, 2 ITR(0, "fstat", "dp") }, /* 28 */
17546 + { SC(pause), -ZERO ITR(0, "pause", "") }, /* 29 */
17547 + { SC(utime), -2 ITR(0, "utime", "xx") }, /* 30 */
17548 + { uw7_stty, 2 ITR(0, "stty", "dd") }, /* 31 */
17549 + { uw7_gtty, 2 ITR(1, "gtty", "dd") }, /* 32 */
17550 + { uw7_access, 2 ITR(0, "access", "so") }, /* 33 */
17551 + { SC(nice), -1 ITR(0, "nice", "d") }, /* 34 */
17552 + { svr4_statfs, 4 ITR(0, "statfs", "spdd") }, /* 35 */
17553 + { SC(sync), -ZERO ITR(0, "sync", "") }, /* 36 */
17554 + { abi_kill, 2 ITR(0, "kill", "dd") }, /* 37 */
17555 + { svr4_fstatfs, 4 ITR(0, "fstatfs", "dpdd") }, /* 38 */
17556 + { abi_procids, Spl ITR(0, "ibcs_procids", "d") }, /* 39 */
17557 + { iBCS_class_XNX, Fast ITR(0, "sysext", "") }, /* 40 */
17558 + { SC(dup), -1 ITR(0, "dup", "d") }, /* 41 */
17559 + { abi_pipe, Spl ITR(0, "pipe", "") }, /* 42 */
17560 + { SC(times), -1 ITR(0, "times", "p") }, /* 43 */
17561 + { SC(profil), -4 ITR(0, "prof", "xxxx")}, /* 44 */
17562 + { 0, Ukn ITR(1, "lock/plock", "") }, /* 45 */
17563 + { SC(setgid), -1 ITR(0, "setgid", "d") }, /* 46 */
17564 + { abi_getgid, Spl ITR(0, "getgid", "") }, /* 47 */
17565 + { abi_sigfunc, Fast ITR(0, "sigfunc", "xxx") }, /* 48 */
17566 + { svr4_msgsys, Spl ITR(0, "msgsys", "dxddd")}, /* 49 */
17567 + { svr4_sysi86, Spl ITR(0, "sysi86/sys3b", "d") }, /* 50 */
17568 + { SC(acct), -1 ITR(0, "acct/sysacct", "x") }, /* 51 */
17569 + { svr4_shmsys, Fast ITR(0, "shmsys", "ddxo")}, /* 52 */
17570 + { svr4_semsys, Spl ITR(0, "semsys", "dddx")}, /* 53 */
17571 + { uw7_ioctl, Spl ITR(0, "ioctl", "dxx") }, /* 54 */
17572 + { 0, 3 ITR(0, "uadmin", "xxx") }, /* 55 */
17573 + { 0, Ukn ITR(1, "exch", "") }, /* 56 */
17574 + { v7_utsname, 1 ITR(0, "utsys", "x") }, /* 57 */
17575 + { SC(fsync), -1 ITR(0, "fsync", "d") }, /* 58 */
17576 + { abi_exec, Spl ITR(0, "execv", "spp") }, /* 59 */
17577 + { SC(umask), -1 ITR(0, "umask", "o") }, /* 60 */
17578 + { SC(chroot), -1 ITR(0, "chroot", "s") }, /* 61 */
17579 + { svr4_fcntl, Spl ITR(0, "fcntl", "dxx") }, /* 62 */
17580 + { svr4_ulimit, 2 ITR(0, "ulimit", "xx") }, /* 63 */
17581 + { 0, Ukn ITR(1, "cg_ids", "") }, /* 64 */
17582 + { 0, Ukn ITR(1, "cg_processors", "") }, /* 65 */
17583 + { 0, Ukn ITR(1, "cg_info", "") }, /* 66 */
17584 + { 0, Ukn ITR(1, "cg_bind", "") }, /* 67 */
17585 + { 0, Ukn ITR(1, "cg_current", "") }, /* 68 */
17586 + { 0, Ukn ITR(1, "cg_memloc", "") }, /* 69 */
17587 + { 0, Ukn ITR(1, "advfs", "") }, /* 70 */
17588 + { 0, Ukn ITR(1, "unadvfs", "") }, /* 71 */
17589 + { 0, Ukn ITR(1, "rmount", "") }, /* 72 */
17590 + { 0, Ukn ITR(1, "rumount", "") }, /* 73 */
17591 + { 0, Ukn ITR(1, "rfstart", "") }, /* 74 */
17592 + { 0, Ukn ITR(1, "unused 75", "") }, /* 75 */
17593 + { 0, Ukn ITR(1, "rdebug", "") }, /* 76 */
17594 + { 0, Ukn ITR(1, "rfstop", "") }, /* 77 */
17595 + { 0, Ukn ITR(1, "rfsys", "") }, /* 78 */
17596 + { SC(rmdir), -1 ITR(0, "rmdir", "s") }, /* 79 */
17597 + { SC(mkdir), 2 ITR(0, "mkdir", "so") }, /* 80 */
17598 + { svr4_getdents, 3 ITR(0, "getdents", "dxd") }, /* 81 */
17599 + { 0, Ukn ITR(1, "libattach", "") }, /* 82 */
17600 + { 0, Ukn ITR(1, "libdetach", "") }, /* 83 */
17601 + { svr4_sysfs, 3 ITR(0, "sysfs", "dxx") }, /* 84 */
17602 + { svr4_getmsg, Spl ITR(0, "getmsg", "dxxx") }, /* 85 */
17603 + { svr4_putmsg, Spl ITR(0, "putmsg", "dxxd") }, /* 86 */
17604 + { svr4_poll, 3 ITR(0, "poll", "xdd") }, /* 87 */
17605 + { abi_lstat, 2 ITR(0, "lstat", "sp") }, /* 88 */
17606 + { SC(symlink), -2 ITR(0, "symlink", "ss") }, /* 89 */
17607 + { SC(readlink), -3 ITR(0, "readlink", "spd") }, /* 90 */
17608 + { 0, Ukn ITR(0, "svr4_setgroups","dp") }, /* 91 */
17609 + { 0, Ukn ITR(0, "svr4_getgroups","dp") }, /* 92 */
17610 + { SC(fchmod), -2 ITR(0, "fchmod", "do") }, /* 93 */
17611 + { SC(fchown), -3 ITR(0, "fchown", "ddd") }, /* 94 */
17612 + { abi_sigprocmask, 3 ITR(0, "sigprocmask", "dxx") }, /* 95 */
17613 + { abi_sigsuspend, Spl ITR(0, "sigsuspend", "x") }, /* 96 */
17614 + { uw7_sigaltstack, 2 ITR(1, "sigaltstack", "xx") }, /* 97 */
17615 + { abi_sigaction, 3 ITR(0, "sigaction", "dxx") }, /* 98 */
17616 + { svr4_sigpending, 2 ITR(1, "sigpending", "dp") }, /* 99 */
17617 + { uw7_context, Spl ITR(0, "ucontext", "") }, /* 100 */
17618 + { 0, Ukn ITR(1, "evsys", "") }, /* 101 */
17619 + { 0, Ukn ITR(1, "evtrapret", "") }, /* 102 */
17620 + { abi_statvfs, 2 ITR(0, "statvfs", "sp") }, /* 103 */
17621 + { abi_statvfs, 2 ITR(0, "fstatvfs", "dp") }, /* 104 */
17622 + { 0, Ukn ITR(1, "reserved 105", "") }, /* 105 */
17623 + { 0, Ukn ITR(1, "nfssys", "") }, /* 106 */
17624 + { svr4_waitid, 4 ITR(0, "waitid", "ddxd") }, /* 107 */
17625 + { 0, 3 ITR(1, "sigsendsys", "ddd") }, /* 108 */
17626 + { svr4_hrtsys, Spl ITR(0, "hrtsys", "xxx") }, /* 109 */
17627 + { 0, 3 ITR(1, "acancel", "dxd") }, /* 110 */
17628 + { 0, Ukn ITR(1, "async", "") }, /* 111 */
17629 + { 0, Ukn ITR(1, "priocntlsys", "") }, /* 112 */
17630 + { svr4_pathconf, 2 ITR(1, "pathconf", "sd") }, /* 113 */
17631 + { 0, 3 ITR(1, "mincore", "xdx") }, /* 114 */
17632 + { uw7_mmap, 6 ITR(0, "mmap", "xxxxdx") },/* 115 */
17633 + { SC(mprotect), -3 ITR(0, "mprotect", "xdx") },/* 116 */
17634 + { SC(munmap), -2 ITR(0, "munmap", "xd") },/* 117 */
17635 + { svr4_fpathconf, 2 ITR(1, "fpathconf", "dd") }, /* 118 */
17636 + { abi_fork, Spl ITR(0, "vfork", "") }, /* 119 */
17637 + { SC(fchdir), -1 ITR(0, "fchdir", "d") }, /* 120 */
17638 + { SC(readv), -3 ITR(0, "readv", "dxd") }, /* 121 */
17639 + { SC(writev), -3 ITR(0, "writev", "dxd") }, /* 122 */
17640 + { svr4_xstat, 3 ITR(0, "xstat", "dsx") }, /* 123 */
17641 + { svr4_lxstat, 3 ITR(0, "lxstat", "dsx") }, /* 124 */
17642 + { svr4_fxstat, 3 ITR(0, "fxstat", "ddx") }, /* 125 */
17643 + { svr4_xmknod, 4 ITR(0, "xmknod", "dsox")}, /* 126 */
17644 + { svr4_syslocal, Spl ITR(0, "syslocal", "d") }, /* 127 */
17645 + { svr4_getrlimit, 2 ITR(0, "setrlimit", "dx") }, /* 128 */
17646 + { svr4_setrlimit, 2 ITR(0, "getrlimit", "dx") }, /* 129 */
17647 + { SC(lchown), 3 ITR(1, "lchown","sdd") }, /* 130 */
17648 + { 0, Ukn ITR(1, "memcntl", "") }, /* 131 */
17649 +#ifdef CONFIG_ABI_XTI
17650 + { svr4_getpmsg, 5 ITR(0, "getpmsg", "dxxxx")}, /* 132 */
17651 + { svr4_putpmsg, 5 ITR(0, "putpmsg", "dxxdd")}, /* 133 */
17653 + { 0, 5 ITR(0, "getpmsg", "dxxxx")}, /* 132 */
17654 + { 0, 5 ITR(0, "putpmsg", "dxxdd")}, /* 133 */
17656 + { SC(rename), -2 ITR(0, "rename", "ss") }, /* 134 */
17657 + { abi_utsname, 1 ITR(0, "uname", "x") }, /* 135 */
17658 + { uw7_setegid, 1 ITR(1, "setegid", "d") }, /* 136 */
17659 + { svr4_sysconfig, 1 ITR(0, "sysconfig", "d") }, /* 137 */
17660 + { 0, Ukn ITR(1, "adjtime", "") }, /* 138 */
17661 + { svr4_sysinfo, 3 ITR(0, "systeminfo", "dsd") }, /* 139 */
17662 + { socksys_syscall, 1 ITR(0, "socksys_syscall","x") }, /* 140 */
17663 + { uw7_seteuid, 1 ITR(1, "seteuid", "d") }, /* 141 */
17664 + { 0, Ukn ITR(1, "?", "") }, /* 142 */
17665 + { 0, Ukn ITR(1, "keyctl", "") }, /* 143 */
17666 + { 0, 2 ITR(1, "secsys", "dx") }, /* 144 */
17667 + { 0, 4 ITR(1, "filepriv", "sdxd") }, /* 145 */
17668 + { 0, 3 ITR(1, "procpriv", "dxd") }, /* 146 */
17669 + { 0, 3 ITR(1, "devstat", "sdx") }, /* 147 */
17670 + { 0, 5 ITR(1, "aclipc", "ddddx")}, /* 148 */
17671 + { 0, 3 ITR(1, "fdevstat", "ddx") }, /* 149 */
17672 + { 0, 3 ITR(1, "flvlfile", "ddx") }, /* 150 */
17673 + { 0, 3 ITR(1, "lvlfile", "sdx") }, /* 151 */
17674 + { 0, Ukn ITR(1, "sendv", "") }, /* 152 */
17675 + { 0, 2 ITR(1, "lvlequal", "xx") }, /* 153 */
17676 + { 0, 2 ITR(1, "lvlproc", "dx") }, /* 154 */
17677 + { 0, Ukn ITR(1, "?", "") }, /* 155 */
17678 + { 0, 4 ITR(1, "lvlipc", "dddx") }, /* 156 */
17679 + { 0, 4 ITR(1, "acl", "sddx") }, /* 157 */
17680 + { 0, Ukn ITR(1, "auditevt", "") }, /* 158 */
17681 + { 0, Ukn ITR(1, "auditctl", "") }, /* 159 */
17682 + { 0, Ukn ITR(1, "auditdmp", "") }, /* 160 */
17683 + { 0, Ukn ITR(1, "auditlog", "") }, /* 161 */
17684 + { 0, Ukn ITR(1, "auditbuf", "") }, /* 162 */
17685 + { 0, 2 ITR(1, "lvldom", "xx") }, /* 163 */
17686 + { 0, Ukn ITR(1, "lvlvfs", "") }, /* 164 */
17687 + { 0, 2 ITR(1, "mkmld", "so") }, /* 165 */
17688 + { uw7_mldmode, 1 ITR(1, "mldmode", "d") }, /* 166 */
17689 + { 0, 2 ITR(0, "secadvise", "xx") }, /* 167 */
17690 + { 0, Ukn ITR(1, "online", "") }, /* 168 */
17691 + { SC(setitimer), -3 ITR(0, "setitimer", "dxx") }, /* 169 */
17692 + { SC(getitimer), -2 ITR(0, "getitimer", "dx") }, /* 170 */
17693 + { SC(gettimeofday), -2 ITR(0, "gettimeofday", "xx") }, /* 171 */
17694 + { SC(settimeofday), -2 ITR(0, "settimeofday", "xx") }, /* 172 */
17695 + { 0, Ukn ITR(1, "lwpcreate", "") }, /* 173 */
17696 + { 0, Ukn ITR(1, "lwpexit", "") }, /* 174 */
17697 + { 0, Ukn ITR(1, "lwpwait", "") }, /* 175 */
17698 + { 0, Ukn ITR(1, "lwpself", "") }, /* 176 */
17699 + { 0, Ukn ITR(1, "lwpinfo", "") }, /* 177 */
17700 + { 0, Ukn ITR(1, "lwpprivate", "") }, /* 178 */
17701 + { 0, Ukn ITR(1, "processorbind", "") }, /* 179 */
17702 + { 0, Ukn ITR(1, "processorexbind","") }, /* 180 */
17703 + { 0, Ukn ITR(1, "", "") }, /* 181 */
17704 + { 0, Ukn ITR(1, "sync_mailbox", "") }, /* 182 */
17705 + { 0, Ukn ITR(1, "prepblock", "") }, /* 183 */
17706 + { 0, Ukn ITR(1, "block", "") }, /* 184 */
17707 + { 0, Ukn ITR(1, "rdblock", "") }, /* 185 */
17708 + { 0, Ukn ITR(1, "unblock", "") }, /* 186 */
17709 + { 0, Ukn ITR(1, "cancelblock", "") }, /* 187 */
17710 + { 0, Ukn ITR(1, "187", "") }, /* 188 */
17711 + { uw7_pread, 4 ITR(1, "pread", "dsdd") }, /* 189 */
17712 + { uw7_pwrite, 4 ITR(1, "pwrite", "dsdd") }, /* 190 */
17713 + { SC(truncate), -2 ITR(0, "truncate", "sd") }, /* 191 */
17714 + { SC(ftruncate), -2 ITR(0, "ftruncate", "dd") }, /* 192 */
17715 + { 0, Ukn ITR(1, "lwpkill", "") }, /* 193 */
17716 + { 0, Ukn ITR(1, "sigwait", "") }, /* 194 */
17717 + { abi_fork, Spl ITR(1, "fork1", "") }, /* 195 */
17718 + { abi_fork, Spl ITR(1, "forkall", "") }, /* 196 */
17719 + { 0, Ukn ITR(1, "modload", "") }, /* 197 */
17720 + { 0, Ukn ITR(1, "moduload", "") }, /* 198 */
17721 + { 0, Ukn ITR(1, "modpath", "") }, /* 199 */
17722 + { 0, Ukn ITR(1, "modstat", "") }, /* 200 */
17723 + { 0, Ukn ITR(1, "modadm", "") }, /* 201 */
17724 + { 0, Ukn ITR(1, "getksym", "") }, /* 202 */
17725 + { 0, Ukn ITR(1, "lwpsuspend", "") }, /* 203 */
17726 + { 0, Ukn ITR(1, "lwpcontinue", "") }, /* 204 */
17727 + { 0, Ukn ITR(1, "priocntllst", "") }, /* 205 */
17728 + { uw7_sleep, 1 ITR(1, "sleep", "d") }, /* 206 */
17729 + { 0, Ukn ITR(1, "lwp_sema_wait", "") }, /* 207 */
17730 + { 0, Ukn ITR(1, "lwp_sema_post", "") }, /* 208 */
17731 + { 0, Ukn ITR(1, "lwp_sema_trywait","") }, /* 209 */
17732 + { 0, Ukn ITR(1, "reserved 210","") }, /* 210 */
17733 + { 0, Ukn ITR(1, "unused 211","") }, /* 211 */
17734 + { 0, Ukn ITR(1, "unused 212","") }, /* 212 */
17735 + { 0, Ukn ITR(1, "unused 213","") }, /* 213 */
17736 + { 0, Ukn ITR(1, "unused 214","") }, /* 214 */
17737 + { 0, Ukn ITR(1, "unused 215","") }, /* 215 */
17738 + { uw7_fstatvfs64, 2 ITR(1, "fstatvfs64", "dp") }, /* 216 */
17739 + { uw7_statvfs64, 2 ITR(1, "statvfs64", "sp") }, /* 217 */
17740 + { 0, Ukn ITR(1, "ftruncate64","") }, /* 218 */
17741 + { 0, Ukn ITR(1, "truncate64","") }, /* 219 */
17742 + { 0, Ukn ITR(1, "getrlimit64","") }, /* 220 */
17743 + { 0, Ukn ITR(1, "setrlimit64","") }, /* 221 */
17744 + { uw7_lseek64, 4 ITR(1, "lseek64", "dddd") }, /* 222 */
17745 + { 0, Ukn ITR(1, "mmap64","") }, /* 223 */
17746 + { uw7_pread64, 5 ITR(1, "pread64", "dsddd")}, /* 224 */
17747 + { uw7_pwrite64, 5 ITR(1, "pwrite64", "dsddd")}, /* 225 */
17748 + { 0, Ukn ITR(1, "creat64","") }, /* 226 */
17749 + { 0, Ukn ITR(1, "dshmsys","") }, /* 227 */
17750 + { 0, Ukn ITR(1, "invlpg","") }, /* 228 */
17751 + { 0, Ukn ITR(1, "rfork1","") }, /* 229 */
17752 + { 0, Ukn ITR(1, "rforkall","") }, /* 230 */
17753 + { 0, Ukn ITR(1, "rexecve","") }, /* 231 */
17754 + { 0, Ukn ITR(1, "migrate","") }, /* 232 */
17755 + { 0, Ukn ITR(1, "kill3","") }, /* 233 */
17756 + { 0, Ukn ITR(1, "ssisys","") }, /* 234 */
17757 + { 0, Ukn ITR(1, "xaccept","") }, /* 235 */
17758 + { 0, Ukn ITR(1, "xbind","") }, /* 236 */
17759 + { 0, Ukn ITR(1, "xbindresvport","") }, /* 237 */
17760 + { 0, Ukn ITR(1, "xconnect","") }, /* 238 */
17761 + { 0, Ukn ITR(1, "xgetsockaddr","") }, /* 239 */
17762 + { 0, Ukn ITR(1, "xgetsockopt","") }, /* 240 */
17763 + { 0, Ukn ITR(1, "xlisten","") }, /* 241 */
17764 + { 0, Ukn ITR(1, "xrecvmsg","") }, /* 242 */
17765 + { 0, Ukn ITR(1, "xsendmsg","") }, /* 243 */
17766 + { 0, Ukn ITR(1, "xsetsockaddr","") }, /* 244 */
17767 + { 0, Ukn ITR(1, "xsetsockopt","") }, /* 245 */
17768 + { 0, Ukn ITR(1, "xshutdown","") }, /* 246 */
17769 + { 0, Ukn ITR(1, "xsocket","") }, /* 247 */
17770 + { 0, Ukn ITR(1, "xsocketpair","") }, /* 248 */
17771 + { 0, Ukn ITR(1, "unused 249","") }, /* 249 */
17772 + { 0, Ukn ITR(1, "unused 250","") }, /* 250 */
17776 +UW7_lcall7(int segment, struct pt_regs * regs)
17778 + abi_dispatch(regs, &uw7_funcs[regs->eax & 0xff], 1);
17781 +static struct exec_domain uw7_exec_domain = {
17782 + name: "UnixWare 7",
17783 + handler: UW7_lcall7,
17784 + pers_low: 14 /* PER_UW7 */,
17785 + pers_high: 14 /* PER_UW7 */,
17786 + signal_map: ibcs_to_linux_signals,
17787 + signal_invmap: linux_to_ibcs_signals,
17788 + err_map: svr4_err_map,
17789 + socktype_map: svr4_socktype_map,
17790 + sockopt_map: abi_sockopt_map,
17791 + af_map: abi_af_map,
17792 + module: THIS_MODULE
17798 + return (register_exec_domain(&uw7_exec_domain));
17801 +static void __exit
17804 + unregister_exec_domain(&uw7_exec_domain);
17807 +module_init(init_uw7);
17808 +module_exit(cleanup_uw7);
17809 diff -uNr --exclude-from=dontdiff linux-2.4.3/abi/uw7/ioctl.c linux/abi/uw7/ioctl.c
17810 --- linux-2.4.3/abi/uw7/ioctl.c Thu Jan 1 01:00:00 1970
17811 +++ linux/abi/uw7/ioctl.c Mon Mar 12 16:34:48 2001
17814 + * abi/uw7/ioctl.c - Support for UnixWare 7.x ioctl(2) system call.
17816 + * This module provides a function uw7_ioctl() which is called indirectly
17817 + * via uw7_funcs[] array, see abi/uw7/funcs.c.
17818 + * This software is under GPL
17821 +#include <linux/errno.h>
17822 +#include <linux/sched.h>
17824 +#include <asm/uaccess.h>
17826 +#include <abi/abi.h>
17827 +#include <abi/uw7.h>
17828 +#include <abi/uw7_termbits.h>
17834 +#define DBG(x...) printk(x)
17840 +static int tioc_tcgets(int fd, struct uw7_termios * tios);
17841 +static int tioc_tcsets(int fd, int lnx_cmd, struct uw7_termios * tios);
17842 +static int ioctl_T(int fd, unsigned int cmd, void * arg);
17844 +int uw7_ioctl(struct pt_regs * regs)
17847 + unsigned int cmd, class;
17849 + char class_str[4];
17851 + fd = (int)get_syscall_parameter(regs, 0);
17852 + cmd = (unsigned int)get_syscall_parameter(regs, 1);
17853 + arg = (void *)get_syscall_parameter(regs, 2);
17854 + class = cmd >> 8;
17857 + return ioctl_T(fd, cmd, arg);
17860 + class_str[0] = class & 0xFF0000 ? (char)((class >> 16) & 0xFF) : '.';
17861 + class_str[1] = class & 0x00FF00 ? (char)((class >> 8) & 0xFF) : '.';
17862 + class_str[2] = class & 0x0000FF ? (char)((class ) & 0xFF) : '.';
17863 + class_str[3] = 0;
17865 + DBG(KERN_ERR "UW7: ioctl(%d, %x[%s], 0x%lx) unsupported\n",
17866 + fd, cmd, class_str, (unsigned long)arg);
17871 +static int tioc_tcsets(int fd, int lnx_cmd, struct uw7_termios * tios)
17873 + struct termios t;
17874 + struct uw7_termios tmp = {0, };
17875 + mm_segment_t old_fs;
17878 + DBG(KERN_ERR "UW7[%d]: tioc_tcsets(%d,%x,%p)\n",
17879 + current->pid, fd, lnx_cmd, tios);
17881 + error = verify_area(VERIFY_READ, tios, sizeof(struct uw7_termios));
17885 + old_fs = get_fs();
17886 + set_fs(get_ds());
17887 + error = SYS(ioctl)(fd, TCGETS, &t);
17892 + if (copy_from_user(&tmp, tios, sizeof(struct uw7_termios)))
17894 + t.c_iflag = tmp.c_iflag & ~UW7_DOSMODE;
17895 + t.c_oflag = tmp.c_oflag;
17896 + t.c_cflag = tmp.c_cflag;
17897 + t.c_lflag = tmp.c_lflag & ~UW7_DEFECHO;
17898 + if (tmp.c_lflag & UW7_FLUSHO)
17899 + t.c_lflag |= FLUSHO;
17901 + t.c_lflag &= ~FLUSHO;
17904 + "UW7[%d]: iflag: %lx->%lx, oflag: %lx->%lx, cflag: %lx->%lx, lflag: %lx->%lx\n",
17905 + current->pid, tmp.c_iflag, t.c_iflag, tmp.c_oflag, t.c_oflag,
17906 + tmp.c_cflag, t.c_cflag, tmp.c_lflag, t.c_lflag);
17908 + t.c_cc[VINTR] = tmp.c_cc[UW7_VINTR];
17909 + t.c_cc[VQUIT] = tmp.c_cc[UW7_VQUIT];
17910 + t.c_cc[VERASE] = tmp.c_cc[UW7_VERASE];
17911 + t.c_cc[VKILL] = tmp.c_cc[UW7_VKILL];
17912 + t.c_cc[VEOL2] = tmp.c_cc[UW7_VEOL2];
17913 + t.c_cc[VSWTC] = tmp.c_cc[UW7_VSWTCH];
17914 + t.c_cc[VSTART] = tmp.c_cc[UW7_VSTART];
17915 + t.c_cc[VSTOP] = tmp.c_cc[UW7_VSTOP];
17916 + t.c_cc[VSUSP] = tmp.c_cc[UW7_VSUSP];
17917 + t.c_cc[VREPRINT] = tmp.c_cc[UW7_VREPRINT];
17918 + t.c_cc[VDISCARD] = tmp.c_cc[UW7_VDISCARD];
17919 + t.c_cc[VWERASE] = tmp.c_cc[UW7_VWERASE];
17920 + t.c_cc[VLNEXT] = tmp.c_cc[UW7_VLNEXT];
17921 + if (t.c_lflag & ICANON) {
17922 + t.c_cc[VEOF] = tmp.c_cc[UW7_VEOF];
17923 + t.c_cc[VEOL] = tmp.c_cc[UW7_VEOL];
17925 + t.c_cc[VMIN] = tmp.c_cc[UW7_VMIN];
17926 + t.c_cc[VTIME] = tmp.c_cc[UW7_VTIME];
17927 + t.c_cc[VEOL] = tmp.c_cc[UW7_VEOL2];
17933 + "VINTR: %x->%x, VQUIT: %x->%x, VERASE: %x->%x, VKILL: %x->%x\n"
17934 + "VEOL2: %x->%x\n",
17935 + current->pid, tmp.c_cc[UW7_VINTR], t.c_cc[VINTR],
17936 + tmp.c_cc[UW7_VQUIT], t.c_cc[VQUIT],
17937 + tmp.c_cc[UW7_VERASE], t.c_cc[VERASE],
17938 + tmp.c_cc[UW7_VKILL], t.c_cc[VKILL],
17939 + tmp.c_cc[UW7_VEOL2], t.c_cc[VEOL2]);
17941 + old_fs = get_fs();
17942 + set_fs(get_ds());
17943 + error = SYS(ioctl)(fd, lnx_cmd, &t);
17948 +static int tioc_tcgets(int fd, struct uw7_termios * tios)
17950 + struct termios t;
17951 + struct uw7_termios tmp = { 0 };
17952 + mm_segment_t old_fs;
17955 + DBG(KERN_ERR "UW7[%d]: tioc_tcgets(%d,%p)\n", current->pid, fd, tios);
17957 + old_fs = get_fs();
17958 + set_fs(get_ds());
17959 + error = SYS(ioctl)(fd, TCGETS, &t);
17964 + tmp.c_iflag = UW7_IFLAG_MSK & (t.c_iflag & ~UW7_DOSMODE);
17965 + tmp.c_oflag = UW7_OFLAG_MSK & t.c_oflag;
17966 + tmp.c_cflag = UW7_CFLAG_MSK & t.c_cflag;
17967 + tmp.c_lflag = UW7_LFLAG_MSK & (t.c_lflag & ~UW7_DEFECHO);
17968 + if (t.c_lflag & FLUSHO)
17969 + tmp.c_lflag |= UW7_FLUSHO;
17971 + tmp.c_lflag &= ~UW7_FLUSHO;
17974 + "UW7[%d]: iflag: %lx->%lx, oflag: %lx->%lx, cflag: %lx->%lx, lflag: %lx->%lx\n",
17975 + current->pid, tmp.c_iflag, t.c_iflag, tmp.c_oflag, t.c_oflag,
17976 + tmp.c_cflag, t.c_cflag, tmp.c_lflag, t.c_lflag);
17978 + if (t.c_lflag & ICANON) {
17979 + tmp.c_cc[UW7_VEOF] = t.c_cc[VEOF];
17980 + tmp.c_cc[UW7_VEOL] = t.c_cc[VEOL];
17982 + tmp.c_cc[UW7_VMIN] = t.c_cc[VMIN];
17983 + tmp.c_cc[UW7_VTIME] = t.c_cc[VTIME];
17986 + tmp.c_cc[UW7_VINTR] = t.c_cc[VINTR];
17987 + tmp.c_cc[UW7_VQUIT] = t.c_cc[VQUIT];
17988 + tmp.c_cc[UW7_VERASE] = t.c_cc[VERASE];
17989 + tmp.c_cc[UW7_VKILL] = t.c_cc[VKILL];
17990 + tmp.c_cc[UW7_VEOL2] = t.c_cc[VEOL2];
17991 + tmp.c_cc[UW7_VSWTCH] = t.c_cc[VSWTC];
17992 + tmp.c_cc[UW7_VSTART] = t.c_cc[VSTART];
17993 + tmp.c_cc[UW7_VSTOP] = t.c_cc[VSTOP];
17994 + tmp.c_cc[UW7_VSUSP] = tmp.c_cc[UW7_VDSUSP] = t.c_cc[VSUSP];
17995 + tmp.c_cc[UW7_VREPRINT] = t.c_cc[VREPRINT];
17996 + tmp.c_cc[UW7_VDISCARD] = t.c_cc[VDISCARD];
17997 + tmp.c_cc[UW7_VWERASE] = t.c_cc[VWERASE];
17998 + tmp.c_cc[UW7_VLNEXT] = t.c_cc[VLNEXT];
18000 + return copy_to_user(tios, &tmp, sizeof(struct uw7_termios)) ? -EFAULT : 0;
18003 +static int ioctl_T(int fd, unsigned int cmd, void * arg)
18005 + DBG(KERN_ERR "ioctl_T(%d,%x,%p)\n", fd, cmd, arg);
18009 + return SYS(ioctl)(fd, TCSBRK, arg);
18012 + return SYS(ioctl)(fd, TCXONC, arg);
18015 + return SYS(ioctl)(fd, TCFLSH, arg);
18017 + case UW7_TIOCSWINSZ:
18018 + return SYS(ioctl)(fd, TIOCSWINSZ, arg);
18020 + case UW7_TIOCGWINSZ:
18021 + return SYS(ioctl)(fd, TIOCGWINSZ, arg);
18024 + return tioc_tcgets(fd, arg);
18027 + return tioc_tcsets(fd, TCSETS, arg);
18029 + case UW7_TCSETSW:
18030 + return tioc_tcsets(fd, TCSETSW, arg);
18032 + case UW7_TCSETSF:
18033 + return tioc_tcsets(fd, TCSETSF, arg);
18037 diff -uNr --exclude-from=dontdiff linux-2.4.3/abi/uw7/kernel.c linux/abi/uw7/kernel.c
18038 --- linux-2.4.3/abi/uw7/kernel.c Thu Jan 1 01:00:00 1970
18039 +++ linux/abi/uw7/kernel.c Mon Mar 12 16:34:48 2001
18042 + * abi/uw7/kernel.c - various UW7 system calls.
18044 + * This software is under GPL
18047 +#include <asm/uaccess.h>
18049 +#include <linux/errno.h>
18050 +#include <linux/kernel.h>
18051 +#include <linux/file.h>
18054 +#include <abi/abi.h>
18055 +#include <abi/uw7.h>
18058 +int uw7_sleep(int seconds)
18060 + struct timespec t;
18061 + mm_segment_t old_fs;
18064 + t.tv_sec = seconds;
18066 + old_fs = get_fs();
18067 + set_fs(get_ds());
18068 + error = SYS(nanosleep)(&t, NULL);
18073 +#define UW7_MAXUID 60002
18075 +int uw7_seteuid(int uid)
18077 + if (uid < 0 || uid > UW7_MAXUID)
18079 + return SYS(setreuid)(-1, uid);
18082 +int uw7_setegid(int gid)
18084 + if (gid < 0 || gid > UW7_MAXUID)
18086 + return SYS(setreuid)(-1, gid);
18089 +int uw7_lseek64(unsigned int fd, unsigned int off, unsigned int off_hi, unsigned int orig)
18091 + loff_t result; /* XXX: how does uw7 return the result? -- ch */
18094 + /* if (off_hi != 0) (commented because some buggy progs set off_hi = -1)
18095 + return -EINVAL; */
18096 + retval = SYS(_llseek)(fd, (off_t) off_hi, off, &result, orig);
18098 + return retval ? retval : (int) result;
18101 +/* can't call sys_pread() directly because off is 32bit on UW7 */
18102 +int uw7_pread(unsigned int fd, char * buf, int count, long off)
18104 + return SYS(pread)(fd, buf, count, (loff_t)off);
18107 +int uw7_pread64(unsigned int fd, char * buf, int count, unsigned int off, unsigned int off_hi)
18112 + return SYS(pread)(fd, buf, count, ((loff_t) off_hi << 32) | off);
18115 +int uw7_pwrite64(unsigned int fd, char * buf, int count, unsigned int off, unsigned int off_hi)
18120 + return SYS(pread)(fd, buf, count, ((loff_t) off_hi << 32) | off);
18123 +/* can't call sys_pwrite() directly because off is 32bit on UW7 */
18124 +int uw7_pwrite(unsigned int fd, char * buf, int count, long off)
18126 + return SYS(pwrite)(fd, buf, count, (loff_t)off);
18129 +int uw7_stty(int fd, int cmd)
18134 +int uw7_gtty(int fd, int cmd)
18138 diff -uNr --exclude-from=dontdiff linux-2.4.3/abi/uw7/mac.c linux/abi/uw7/mac.c
18139 --- linux-2.4.3/abi/uw7/mac.c Thu Jan 1 01:00:00 1970
18140 +++ linux/abi/uw7/mac.c Mon Mar 12 16:34:48 2001
18143 + * abi/uw7/mac.c - mldmode(2) and friends.
18145 + * This software is under GPL
18148 +#include <linux/sched.h>
18149 +#include <abi/uw7.h>
18154 +#define DBG(x...) printk(x)
18159 +#define UW7_MLD_REAL 1
18160 +#define UW7_MLD_VIRT 0
18161 +#define UW7_MLD_QUERY 2
18163 +int uw7_mldmode(int mldmode)
18165 + switch (mldmode) {
18166 + case UW7_MLD_REAL:
18167 + DBG(KERN_ERR "UW7[%d]: mldmode(MLD_REAL)\n", current->pid);
18170 + case UW7_MLD_VIRT:
18171 + DBG(KERN_ERR "UW7[%d]: mldmode(MLD_VIRT)\n", current->pid);
18174 + case UW7_MLD_QUERY:
18175 + DBG(KERN_ERR "UW7[%d]: mldmode(MLD_QUERY)\n", current->pid);
18176 + return UW7_MLD_REAL;
18183 diff -uNr --exclude-from=dontdiff linux-2.4.3/abi/uw7/mmap.c linux/abi/uw7/mmap.c
18184 --- linux-2.4.3/abi/uw7/mmap.c Thu Jan 1 01:00:00 1970
18185 +++ linux/abi/uw7/mmap.c Fri Mar 30 16:14:07 2001
18188 + * abi/uw7/mmap.c - mmap(2) system call.
18190 + * This software is under GPL
18193 +#include <linux/mm.h>
18194 +#include <linux/errno.h>
18195 +#include <linux/file.h>
18196 +#include <linux/mman.h>
18197 +#include <asm/uaccess.h>
18199 +#include <abi/abi.h>
18200 +#include <abi/uw7.h>
18202 +/* same as arch/i386/kernel/sys_i386.c:sys_mmap2 (besides the UW_* handling) -- ch */
18203 +int uw7_mmap(unsigned long addr, unsigned long len, unsigned long prot, unsigned long flags,
18204 + unsigned long fd, unsigned long offset)
18206 + int error = -EBADF;
18207 + struct file * file = NULL;
18209 + if (flags & UW7_MAP_ANONYMOUS) {
18210 + flags |= MAP_ANONYMOUS;
18211 + flags &= ~UW7_MAP_ANONYMOUS;
18214 + flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
18215 + if (!(flags & MAP_ANONYMOUS)) {
18221 + down_write(¤t->mm->mmap_sem);
18222 + error = do_mmap(file, addr, len, prot, flags, offset);
18223 + up_write(¤t->mm->mmap_sem);
18230 diff -uNr --exclude-from=dontdiff linux-2.4.3/abi/uw7/statvfs.c linux/abi/uw7/statvfs.c
18231 --- linux-2.4.3/abi/uw7/statvfs.c Thu Jan 1 01:00:00 1970
18232 +++ linux/abi/uw7/statvfs.c Mon Mar 12 16:34:48 2001
18235 + * abi/uw7/statvfs.c - statvfs64() and friends for UW7
18237 + * This software is under GPL
18240 +#include <linux/sched.h>
18241 +#include <linux/file.h>
18243 +#include <asm/uaccess.h>
18245 +#include <abi/uw7.h>
18248 +cp_uw7_statvfs64(struct super_block * sb, struct statfs * src,
18249 + struct uw7_statvfs64 * dst)
18251 + struct uw7_statvfs64 tmp = {0, };
18253 + tmp.f_bsize = src->f_bsize;
18254 + tmp.f_frsize = src->f_bsize;
18255 + tmp.f_blocks = src->f_blocks;;
18256 + tmp.f_bfree = src->f_bfree;
18257 + tmp.f_bavail = src->f_bavail;
18258 + tmp.f_files = src->f_files;
18259 + tmp.f_ffree = src->f_ffree;
18260 + tmp.f_favail = src->f_ffree;
18261 + tmp.f_fsid = sb->s_dev;
18263 + strcpy(tmp.f_basetype, sb->s_type->name);
18266 + tmp.f_namemax = src->f_namelen;
18268 + return copy_to_user(dst, &tmp, sizeof(tmp)) ? -EFAULT : 0;
18272 +uw7_statvfs64(char * filename, struct uw7_statvfs64 * buf)
18275 + struct nameidata nd;
18278 + error = user_path_walk(filename, &nd);
18280 + struct statfs tmp;
18281 + error = vfs_statfs(nd.dentry->d_inode->i_sb, &tmp);
18282 + if (!error && cp_uw7_statvfs64(nd.dentry->d_inode->i_sb, &tmp, buf))
18284 + path_release(&nd);
18292 +uw7_fstatvfs64(int fd, struct uw7_statvfs64 * buf)
18294 + struct file * file;
18295 + struct statfs tmp;
18302 + error = vfs_statfs(file->f_dentry->d_inode->i_sb, &tmp);
18303 + if (!error && cp_uw7_statvfs64(file->f_dentry->d_inode->i_sb, &tmp, buf))
18310 diff -uNr --exclude-from=dontdiff linux-2.4.3/arch/i386/config.in linux/arch/i386/config.in
18311 --- linux-2.4.3/arch/i386/config.in Fri Mar 30 14:45:00 2001
18312 +++ linux/arch/i386/config.in Fri Mar 30 17:25:23 2001
18313 @@ -246,6 +246,8 @@
18317 +source abi/Config.in
18319 source drivers/mtd/Config.in
18321 source drivers/parport/Config.in
18322 diff -uNr --exclude-from=dontdiff linux-2.4.3/fs/Makefile linux/fs/Makefile
18323 --- linux-2.4.3/fs/Makefile Fri Mar 30 14:48:44 2001
18324 +++ linux/fs/Makefile Fri Mar 30 17:25:23 2001
18328 obj-$(CONFIG_BINFMT_AOUT) += binfmt_aout.o
18329 +obj-$(CONFIG_BINFMT_XOUT) += binfmt_xout.o
18330 +obj-$(CONFIG_BINFMT_COFF) += binfmt_coff.o
18331 obj-$(CONFIG_BINFMT_EM86) += binfmt_em86.o
18332 obj-$(CONFIG_BINFMT_MISC) += binfmt_misc.o
18334 diff -uNr --exclude-from=dontdiff linux-2.4.3/fs/binfmt_coff.c linux/fs/binfmt_coff.c
18335 --- linux-2.4.3/fs/binfmt_coff.c Thu Jan 1 01:00:00 1970
18336 +++ linux/fs/binfmt_coff.c Fri Mar 30 16:32:53 2001
18340 + * These are the functions used to load COFF IBCS style executables.
18341 + * Information on COFF format may be obtained in either the Intel Binary
18342 + * Compatibility Specification 2 or O'Rilley's book on COFF. The shared
18343 + * libraries are defined only the in the Intel book.
18345 + * This file is based upon code written by Eric Youngdale for the ELF object
18348 + * Author: Al Longyear (longyear@sii.com)
18350 + * Latest Revision:
18351 + * 3 February 1994
18352 + * Al Longyear (longyear@sii.com)
18353 + * Cleared first page of bss section using put_fs_byte.
18355 + * 4 February 1994
18356 + * Mike Jagdis (jaggy@purplet.demon.co.uk)
18357 + * Added scanning of .comment sections for clues as to the
18358 + * "personality" of the executable. This is then used to emulate
18359 + * the right set of non-standard syscall extensions and bugs. :-)
18361 + * 18 February 1994
18362 + * Mike Jagdis (jaggy@purplet.demon.co.uk)
18363 + * If compile the module version of iBCS rather than the in-kernel
18364 + * version we must take care to signal when module code is in use
18365 + * or it may be freed from under us - Bad News :-).
18369 +#include <linux/module.h>
18371 +#include <asm/uaccess.h>
18373 +#include <linux/fs.h>
18374 +#include <linux/stat.h>
18375 +#include <linux/sched.h>
18376 +#include <linux/init.h>
18377 +#include <linux/kernel.h>
18378 +#include <linux/mm.h>
18379 +#include <linux/mman.h>
18380 +#include <linux/a.out.h>
18381 +#include <linux/errno.h>
18382 +#include <linux/signal.h>
18383 +#include <linux/binfmts.h>
18384 +#include <linux/string.h>
18385 +#include <linux/fcntl.h>
18386 +#include <linux/ptrace.h>
18387 +#include <linux/coff.h>
18388 +#include <linux/malloc.h>
18389 +#include <linux/personality.h>
18390 +#include <linux/file.h>
18391 +#include <linux/smp_lock.h>
18393 +#include <abi/abi.h>
18396 +static unsigned long * create_coff_tables(char *p,
18397 + struct linux_binprm *bprm, int ibcs);
18399 +static int load_coff_binary(struct linux_binprm *bprm, struct pt_regs *regs);
18400 +static int load_coff_library(struct file * file);
18401 +static int preload_library(struct linux_binprm *exe_bprm,
18402 + COFF_SCNHDR * sect, struct file *fp);
18403 +static int load_object(struct linux_binprm *bprm, struct pt_regs *regs,
18405 +static int parse_comments(struct linux_binprm *exe_bprm, COFF_SCNHDR * sect,
18406 + long *personality);
18409 + * The following table gives clues to the "personality" of the executable
18410 + * which we hope to find in the .comment sections of the binary.
18411 + * The set here may not be comprehensive even for those systems listed.
18412 + * Use 'mcs -p' to list the .comments sections of a binary to see what
18413 + * clues might be there. Or use 'strings' if you don't have mcs.
18415 +struct coff_clue {
18416 + short terminal; /* non-zero to stop parsing with this entry */
18417 + short len; /* negative number uses strstr for lookup */
18419 + unsigned long mask_and, mask_or;
18422 +static struct coff_clue coff_clues[] = {
18423 + /* Wyse Unix V/386 3.2.1[A]. */
18424 + {1, 36, "@(#) UNIX System V/386 Release 3.2.1",
18425 + 0, PER_WYSEV386},
18427 + /* SCO Unix V 3.2, 3.2.2, 3.2.4, 3.2.4.2 etc. */
18428 + {1, 23, "@(#) crt1.s 1.8 89/05/30",
18430 + {1, 16, "@(#)SCO UNIX 3.2",
18432 + {1, 18, "\"@(#) SCO UNIX 3.2",
18434 + {1, 17, "@(#) SCO UNIX 3.2",
18436 + {1, 11, "@(#)SCO 3.2",
18440 + * SCO Unix 3.2.4.2 OpenServer 5 gives 32 bit inodes except
18441 + * programs compiled with ods30 compatibilty. In fact OS5
18442 + * always gives 32 bits but the library drops the top 16 in
18443 + * odt30 mode. We know what should happen and do it however.
18445 + {0, 32, "@(#) crt1.s.source 20.1 94/12/04",
18447 + {1, 13, "ods_30_compat",
18448 + ~0, SHORT_INODE},
18450 + /* Interactive (ISC) 4.0 */
18451 + {1, -1, "INTERACTIVE",
18454 + /* End of table */
18459 +static struct linux_binfmt coff_format = {
18460 + NULL, THIS_MODULE, load_coff_binary, load_coff_library, NULL, PAGE_SIZE
18465 + * Small procedure to test for the proper file alignment.
18468 +static inline int is_properly_aligned(COFF_SCNHDR * sect)
18470 + long scnptr = COFF_LONG(sect->s_scnptr);
18471 + long vaddr = COFF_LONG(sect->s_vaddr);
18475 + * Return the error code if the section is not properly aligned.
18478 + return ((((vaddr - scnptr) & ~PAGE_MASK) != 0) ? -ENOEXEC : 0);
18482 + * Clear the bytes in the last page of data.
18486 +int clear_memory(unsigned long addr, unsigned long size)
18490 + size = (PAGE_SIZE - (addr & ~PAGE_MASK)) & ~PAGE_MASK;
18495 + status = verify_area(VERIFY_WRITE, (void *) addr, size);
18497 + while (size-- != 0) {
18498 + __put_user(0, (char *) addr);
18505 +struct coff_section {
18511 +static inline unsigned long
18512 +map_coff(struct file *file, struct coff_section * sect, unsigned long prot,
18513 + unsigned long flag, unsigned long offset)
18515 + unsigned long map_addr;
18517 + down(¤t->mm->mmap_sem);
18518 + map_addr = do_mmap(file,
18519 + sect->vaddr & PAGE_MASK,
18520 + sect->size + (sect->vaddr & ~PAGE_MASK),
18521 + prot, flag, offset);
18522 + up(¤t->mm->mmap_sem);
18524 + return (map_addr);
18529 + * Helper function to process the load operation.
18533 +load_object(struct linux_binprm * bprm, struct pt_regs * regs, int lib_ok)
18535 + COFF_FILHDR * coff_hdr = NULL;
18536 + COFF_SCNHDR * sect_bufr = NULL; /* Pointer to section table */
18537 + COFF_SCNHDR * sect_ptr = NULL;
18539 + COFF_SCNHDR * text_sect, * data_sect, * bss_sect;
18541 + struct coff_section text, data, bss;
18542 + mm_segment_t old_fs;
18544 + int text_count, data_count, bss_count, lib_count;
18546 + unsigned int start_addr = 0; /* Starting location for program */
18547 + short int sections = 0; /* Number of sections in the file */
18548 + short int aout_size = 0; /* Size of the a.out header area */
18549 + short int flags; /* Flag bits from the COFF header */
18550 + int not_pageable = 0; /* Can we demand page the executable? */
18551 + unsigned long p = bprm->p;
18552 + unsigned long personality;
18553 + int coff_exec_fileno;
18555 + int status = 0; /* Result status register */
18558 + text_sect = data_sect = bss_sect = NULL;
18560 + coff_hdr = (COFF_FILHDR *) bprm->buf; /* COFF Header */
18563 + * Validate the magic value for the object file.
18566 + if (COFF_I386BADMAG(*coff_hdr))
18569 + flags = COFF_SHORT(coff_hdr->f_flags);
18572 + * The object file should have 32 BIT little endian format. Do not allow
18573 + * it to have the 16 bit object file flag set as Linux is not able to run
18574 + * on the 80286/80186/8086.
18576 + if ((flags & (COFF_F_AR32WR | COFF_F_AR16WR)) != COFF_F_AR32WR)
18580 + * If the file is not executable then reject the execution. This means
18581 + * that there must not be external references.
18583 + if ((flags & COFF_F_EXEC) == 0)
18587 + * Extract the header information which we need.
18589 + sections = COFF_SHORT(coff_hdr->f_nscns); /* Number of sections */
18590 + aout_size = COFF_SHORT(coff_hdr->f_opthdr); /* Size of opt. headr */
18593 + * There must be atleast one section.
18598 + if (!bprm->file->f_op->mmap)
18599 + not_pageable = 1;
18601 + if (!(sect_bufr = kmalloc(sections * COFF_SCNHSZ, GFP_KERNEL))) {
18602 + printk(KERN_WARNING "coff: kmalloc failed\n");
18606 + status = kernel_read(bprm->file, aout_size + COFF_FILHSZ,
18607 + (char *)sect_bufr, sections * COFF_SCNHSZ);
18609 + goto out_free_buf;
18611 + status = get_unused_fd();
18613 + goto out_free_buf;
18615 + get_file(bprm->file);
18616 + fd_install(coff_exec_fileno = status, bprm->file);
18624 + * Loop through the sections and find the various types
18626 + sect_ptr = sect_bufr;
18628 + for (nIndex = 0; nIndex < sections; ++nIndex) {
18629 + long int sect_flags = COFF_LONG(sect_ptr->s_flags);
18631 + switch (sect_flags) {
18632 + case COFF_STYP_TEXT:
18633 + status = is_properly_aligned(sect_ptr);
18634 + text_sect = sect_ptr;
18638 + case COFF_STYP_DATA:
18639 + status = is_properly_aligned(sect_ptr);
18640 + data_sect = sect_ptr;
18644 + case COFF_STYP_BSS:
18645 + bss_sect = sect_ptr;
18649 + case COFF_STYP_LIB:
18657 + sect_ptr = (COFF_SCNHDR *) & ((char *) sect_ptr)[COFF_SCNHSZ];
18661 + * If any of the sections weren't properly aligned we aren't going to
18662 + * be able to demand page this executable. Note that at this stage the
18663 + * *only* excuse for having status <= 0 is if the alignment test failed.
18666 + if (status < 0) {
18667 + not_pageable = 1;
18672 + * Ensure that there are the required sections. There must be one text
18673 + * sections and one each of the data and bss sections for an executable.
18674 + * A library may or may not have a data / bss section.
18677 + if (text_count != 1)
18678 + status = -ENOEXEC;
18681 + if (data_count != 1 || bss_count != 1)
18682 + status = -ENOEXEC;
18685 + * If there is no additional header then assume the file starts at
18686 + * the first byte of the text section. This may not be the proper place,
18687 + * so the best solution is to include the optional header. A shared library
18688 + * __MUST__ have an optional header to indicate that it is a shared library.
18692 + goto out_free_file;
18694 + if (aout_size == 0) {
18696 + status = -ENOEXEC;
18697 + start_addr = COFF_LONG(text_sect->s_vaddr);
18700 + * There is some header. Ensure that it is sufficient.
18704 + if (aout_size < (short) COFF_AOUTSZ)
18705 + status = -ENOEXEC;
18707 + /* Pointer to a.out header */
18708 + COFF_AOUTHDR *aout_hdr =
18709 + (COFF_AOUTHDR *) & ((char *) coff_hdr)[COFF_FILHSZ];
18710 + short int aout_magic = COFF_SHORT(aout_hdr->magic); /* id */
18713 + * Validate the magic number in the a.out header. If it is valid then
18714 + * update the starting symbol location. Do not accept these file formats
18715 + * when loading a shared library.
18718 + switch (aout_magic) {
18719 + case COFF_OMAGIC:
18720 + case COFF_ZMAGIC:
18721 + case COFF_STMAGIC:
18723 + status = -ENOEXEC;
18725 + (unsigned int) COFF_LONG(aout_hdr->entry);
18729 + * Magic value for a shared library. This is valid only when loading a
18730 + * shared library. (There is no need for a start_addr. It won't be used.)
18733 + case COFF_SHMAGIC:
18735 + status = -ENOEXEC;
18739 + status = -ENOEXEC;
18746 + goto out_free_file;
18749 + * Generate the proper values for the text fields
18751 + * THIS IS THE POINT OF NO RETURN. THE NEW PROCESS WILL TRAP OUT SHOULD
18752 + * SOMETHING FAIL IN THE LOAD SEQUENCE FROM THIS POINT ONWARD.
18755 + text.scnptr = COFF_LONG(text_sect->s_scnptr);
18756 + text.size = COFF_LONG(text_sect->s_size);
18757 + text.vaddr = COFF_LONG(text_sect->s_vaddr);
18760 + * Generate the proper values for the data fields
18763 + if (data_sect != NULL) {
18764 + data.scnptr = COFF_LONG(data_sect->s_scnptr);
18765 + data.size = COFF_LONG(data_sect->s_size);
18766 + data.vaddr = COFF_LONG(data_sect->s_vaddr);
18774 + * Generate the proper values for the bss fields
18777 + if (bss_sect != NULL) {
18778 + bss.size = COFF_LONG(bss_sect->s_size);
18779 + bss.vaddr = COFF_LONG(bss_sect->s_vaddr);
18786 + * Flush the executable from memory. At this point the executable is
18787 + * committed to being defined or a segmentation violation will occur.
18791 + status = flush_old_exec(bprm); /* SIGSEGV */
18793 + goto out_free_file;
18796 + * Look for clues as to the system this binary was compiled on in the
18797 + * comments section(s). Only look at the main binary, not the shared
18798 + * libraries (or would it be better to prefer shared libraries over
18799 + * binaries? Or could they be different???)
18802 + personality = PER_SVR3;
18805 + COFF_SCNHDR *sect_ptr2 = sect_bufr;
18808 + for (i = 0; i < sections; i++) {
18809 + long sect_flags = COFF_LONG(sect_ptr2->s_flags);
18811 + if (sect_flags == COFF_STYP_INFO &&
18812 + (status = parse_comments(bprm, sect_ptr2, &personality)) > 0)
18815 + sect_ptr2 = (COFF_SCNHDR *) & ((char *) sect_ptr2) [COFF_SCNHSZ];
18819 + * If no .comments section was found there is no way to
18820 + * figure out the personality. Odds on it is SCO though...
18822 + personality = PER_SCOSVR3;
18826 + set_personality(personality);
18828 + current->mm->start_data = 0;
18829 + current->mm->end_data = 0;
18830 + current->mm->end_code = 0;
18831 + current->mm->mmap = NULL;
18832 + current->flags &= ~PF_FORKNOEXEC;
18835 + * Construct the parameter and environment string table entries.
18838 + current->mm->rss = 0;
18839 + status = setup_arg_pages(bprm);
18840 + if (status < 0) {
18841 + send_sig(SIGSEGV, current, 1);
18844 + p = (unsigned long) create_coff_tables((char *)
18845 + bprm->p, bprm, 1);
18848 + * Do the end processing once the stack has been constructed
18851 + current->mm->end_code = text.size +
18852 + (current->mm->start_code = text.vaddr);
18853 + current->mm->end_data = data.size +
18854 + (current->mm->start_data = data.vaddr);
18855 + current->mm->brk = bss.size +
18856 + (current->mm->start_brk = bss.vaddr);
18858 + current->mm->start_stack = p;
18859 + compute_creds(bprm);
18860 + start_thread(regs, start_addr, p);
18863 + old_fs = get_fs();
18864 + set_fs(get_ds());
18866 + if (not_pageable) {
18868 + * Read the file from disk...
18872 + loff_t pos = data.scnptr;
18873 + status = do_brk(text.vaddr, text.size);
18874 + bprm->file->f_op->read(bprm->file,
18875 + (char *)data.vaddr, data.scnptr, &pos);
18876 + status = do_brk(data.vaddr, data.size);
18877 + bprm->file->f_op->read(bprm->file,
18878 + (char *)text.vaddr, text.scnptr, &pos);
18882 + * Map the text pages
18885 + status = map_coff(bprm->file, &text, PROT_READ | PROT_EXEC,
18886 + MAP_FIXED | MAP_SHARED | MAP_DENYWRITE | MAP_EXECUTABLE,
18887 + text.scnptr & PAGE_MASK);
18889 + if (status != (text.vaddr & PAGE_MASK)) {
18890 + status = -ENOEXEC;
18891 + goto out_free_file;
18895 + * Map the data pages
18898 + if (data.size != 0) {
18899 + status = map_coff(bprm->file, &data,
18900 + PROT_READ | PROT_WRITE | PROT_EXEC,
18901 + MAP_FIXED | MAP_PRIVATE | MAP_DENYWRITE | MAP_EXECUTABLE,
18902 + data.scnptr & PAGE_MASK);
18904 + if (status != (data.vaddr & PAGE_MASK)) {
18905 + status = -ENOEXEC;
18906 + goto out_free_file;
18912 + * Construct the bss data for the process. The bss ranges from the
18913 + * end of the data (which may not be on a page boundary) to the end
18914 + * of the bss section. Allocate any necessary pages for the data.
18917 + if (bss.size != 0) {
18918 + down(¤t->mm->mmap_sem);
18919 + do_mmap(NULL, PAGE_ALIGN(bss.vaddr),
18920 + bss.size + bss.vaddr -
18921 + PAGE_ALIGN(bss.vaddr),
18922 + PROT_READ | PROT_WRITE | PROT_EXEC,
18923 + MAP_FIXED | MAP_PRIVATE, 0);
18924 + up(¤t->mm->mmap_sem);
18925 + status = clear_memory(bss.vaddr, bss.size);
18928 + goto out_free_file;
18934 + * Load any shared library for the executable.
18937 + if (lib_ok && lib_count != 0) {
18939 + COFF_SCNHDR *sect_ptr = sect_bufr;
18942 + * Find the library sections. (There should be at least one. It was counted
18943 + * earlier.) This will eventually recurse to our code and load the shared
18944 + * library with our own procedures.
18947 + for (nIndex = 0; nIndex < sections; ++nIndex) {
18948 + long int sect_flags =
18949 + COFF_LONG(sect_ptr->s_flags);
18950 + if (sect_flags == COFF_STYP_LIB) {
18951 + status = preload_library(bprm,
18952 + sect_ptr, bprm->file);
18958 + (COFF_SCNHDR *) & ((char *) sect_ptr) [COFF_SCNHSZ];
18963 + set_binfmt(&coff_format);
18966 + * Generate any needed trap for this process. If an error occured then
18967 + * generate a segmentation violation. If the process is being debugged
18968 + * then generate the load trap. (Note: If this is a library load then
18969 + * do not generate the trap here. Pass the error to the caller who
18970 + * will do it for the process in the outer lay of this procedure call.)
18974 + send_sig(SIGSEGV, current, 0); /* Generate the error trap */
18976 + if (current->ptrace & PT_PTRACED)
18977 + send_sig(SIGTRAP, current, 0);
18979 + status = 0; /* We are committed. It can't fail */
18984 + sys_close(coff_exec_fileno);
18987 + kfree(sect_bufr);
18992 + * This procedure will load the library listed in the file name given
18993 + * as the parameter. The result will be non-zero should something fail
18998 +preload_this_library(struct linux_binprm *exe_bprm, char *lib_name)
19001 + mm_segment_t old_fs = get_fs();
19003 + * Change the FS register to the proper kernel address space and attempt
19004 + * to load the library. The library name is allocated from the kernel
19007 + set_fs(get_ds());
19008 + status = SYS(uselib) (lib_name);
19011 + * Return the success/failure to the caller.
19017 + * This procedure is called to load a library section. The various
19018 + * libraries are loaded from the list given in the section data.
19022 +preload_library(struct linux_binprm *exe_bprm,
19023 + COFF_SCNHDR * sect, struct file *fp)
19025 + int status = 0; /* Completion status */
19026 + long nbytes; /* Count of bytes in the header area */
19028 + * Fetch the size of the section. There must be enough room for at least
19031 + nbytes = (long) COFF_LONG(sect->s_size);
19032 + if (nbytes < (long) COFF_SLIBSZ) {
19033 + status = -ENOEXEC;
19036 + * Allocate a buffer to hold the section data
19039 + COFF_SLIBHD *phdr;
19040 + char *buffer = (char *) kmalloc(nbytes, GFP_KERNEL);
19042 + if (0 == buffer) {
19043 + status = -ENOEXEC;
19044 + printk(KERN_WARNING "COFF: kmalloc failed\n");
19046 + status = kernel_read(exe_bprm->file,
19047 + COFF_LONG(sect->s_scnptr), buffer, nbytes);
19049 + if (status >= 0 && status != nbytes)
19050 + status = -ENOEXEC;
19053 + * At this point, go through the list of libraries in the data area.
19055 + phdr = (COFF_SLIBHD *) buffer;
19056 + while (status >= 0 && nbytes > (long) COFF_SLIBSZ) {
19058 + COFF_LONG(phdr->sl_entsz) * sizeof(long);
19059 + int header_size =
19060 + COFF_LONG(phdr->sl_pathndx) * sizeof(long);
19062 + * Validate the sizes of the various items. I don't trust the linker!!
19064 + if ((unsigned) header_size >= (unsigned) nbytes ||
19065 + entry_size <= 0 ||
19066 + (unsigned) entry_size <=
19067 + (unsigned) header_size) {
19068 + status = -ENOEXEC;
19071 + * Load the library. Stop the load process on the first error.
19074 + status = preload_this_library(exe_bprm,
19080 + * Point to the next library in the section data.
19082 + nbytes -= entry_size;
19084 + (COFF_SLIBHD *) & ((char *) phdr)[entry_size];
19087 + * Release the space for the library list.
19089 + if (buffer != NULL)
19093 + * Return the resulting status to the caller.
19099 + * Parse a comments section looking for clues as to the system this
19100 + * was compiled on so we can get the system call interface right.
19104 +parse_comments(struct linux_binprm *exe_bprm, COFF_SCNHDR * sect, long *personality)
19106 + unsigned long offset, nbytes;
19108 + int status, hits;
19111 + * Fetch the size of the section. There must be something in there or the
19112 + * section wouldn't exist at all. We only bother with the first 8192
19113 + * characters though. There isn't any point getting too carried away!
19115 + if ((nbytes = COFF_LONG(sect->s_size)) > 8192)
19118 + if (!(buffer = (char *) __get_free_page(GFP_KERNEL)))
19122 + offset = COFF_LONG(sect->s_scnptr);
19123 + while (nbytes > 0) {
19125 + unsigned long count, str_start;
19127 + status = kernel_read(exe_bprm->file, offset, buffer,
19128 + nbytes > PAGE_SIZE ? PAGE_SIZE : nbytes);
19130 + if (status <= 0) {
19131 + free_page((unsigned long) buffer);
19137 + for (count = 0; count < status; count++) {
19138 + struct coff_clue *clue;
19139 + char c = *(buffer + PAGE_SIZE - 1);
19140 + *(buffer + PAGE_SIZE - 1) = '\0';
19141 + for (clue = coff_clues; clue->len; clue++) {
19142 + if ((clue->len < 0 && strstr(p, clue->text))
19143 + || (clue->len > 0
19144 + && !strncmp(p, clue->text, clue->len))) {
19145 + *personality &= clue->mask_and;
19146 + *personality |= clue->mask_or;
19147 + if (clue->terminal) {
19148 + free_page((unsigned long)
19155 + *(buffer + PAGE_SIZE - 1) = c;
19157 + while (*p && count < status)
19159 + if (count < status) {
19162 + str_start = count;
19166 + /* If we didn't find an end ofstring at all this page
19167 + * probably isn't useful string data.
19169 + if (str_start == 0)
19170 + str_start = status;
19172 + nbytes -= str_start;
19173 + offset += str_start;
19176 + free_page((unsigned long) buffer);
19182 + * Load the image for an (coff) binary.
19184 + * => this procedure is called by the main load sequence,
19185 + * it will load the executable and prepare it for execution
19188 +load_coff_binary(struct linux_binprm *bprm, struct pt_regs *regs)
19190 + return load_object(bprm, regs, 1);
19194 + * Load the image for an (coff) shared library.
19196 + * => this is called when we need to load a library based upon a file name.
19197 + * => also called through preload_this_library
19200 +load_coff_library(struct file *fp)
19202 + struct linux_binprm *bpp;
19203 + struct pt_regs regs;
19204 + int err = -ENOMEM;
19206 + if (!(bpp = kmalloc(sizeof(struct linux_binprm), GFP_KERNEL))) {
19207 + printk(KERN_WARNING "coff: kmalloc failed\n");
19211 + memset(bpp, 0, sizeof(struct linux_binprm));
19214 + if ((err = kernel_read(fp, 0L, bpp->buf, sizeof(bpp->buf))) < 0)
19215 + printk(KERN_WARNING "coff: unable to read library header\n");
19217 + err = load_object(bpp, ®s, 0);
19224 +static unsigned long *
19225 +create_coff_tables(char *p, struct linux_binprm *bprm, int ibcs)
19227 + unsigned long *argv, *envp;
19228 + unsigned long *sp;
19229 + int argc = bprm->argc;
19230 + int envc = bprm->envc;
19232 + sp = (unsigned long *) ((-(unsigned long) sizeof(char *))
19233 + & (unsigned long) p);
19241 + put_user(envp, --sp);
19242 + put_user(argv, --sp);
19245 + put_user(argc, --sp);
19246 + current->mm->arg_start = (unsigned long) p;
19248 + while (argc-- > 0) {
19249 + __put_user(p, argv++);
19250 + p += strlen_user(p);
19253 + __put_user(NULL, argv);
19254 + current->mm->arg_end = current->mm->env_start = (unsigned long) p;
19256 + while (envc-- > 0) {
19257 + __put_user(p, envp++);
19258 + p += strlen_user(p);
19261 + __put_user(NULL, envp);
19262 + current->mm->env_end = (unsigned long) p;
19270 +static void __exit
19271 +cleanup_binfmt_coff(void)
19273 + unregister_binfmt(&coff_format);
19279 +init_binfmt_coff(void)
19281 + register_binfmt(&coff_format);
19285 +module_init(init_binfmt_coff);
19286 +module_exit(cleanup_binfmt_coff);
19288 diff -uNr --exclude-from=dontdiff linux-2.4.3/fs/binfmt_elf.c linux/fs/binfmt_elf.c
19289 --- linux-2.4.3/fs/binfmt_elf.c Fri Mar 30 14:48:44 2001
19290 +++ linux/fs/binfmt_elf.c Fri Mar 30 17:25:23 2001
19291 @@ -397,7 +397,6 @@
19292 int load_addr_set = 0;
19293 char * elf_interpreter = NULL;
19294 unsigned int interpreter_type = INTERPRETER_NONE;
19295 - unsigned char ibcs2_interpreter = 0;
19296 mm_segment_t old_fs;
19297 unsigned long error;
19298 struct elf_phdr * elf_ppnt, *elf_phdata;
19299 @@ -477,40 +476,18 @@
19300 elf_ppnt->p_filesz);
19302 goto out_free_interp;
19303 - /* If the program interpreter is one of these two,
19304 - * then assume an iBCS2 image. Otherwise assume
19305 - * a native linux image.
19308 + * Change our personality, if needed.
19310 - if (strcmp(elf_interpreter,"/usr/lib/libc.so.1") == 0 ||
19311 - strcmp(elf_interpreter,"/usr/lib/ld.so.1") == 0)
19312 - ibcs2_interpreter = 1;
19313 + SET_ELF_PERSONALITY(elf_ex, elf_interpreter);
19316 printk("Using ELF interpreter %s\n", elf_interpreter);
19319 - if (ibcs2_interpreter) {
19320 - unsigned long old_pers = current->personality;
19321 - struct exec_domain *old_domain = current->exec_domain;
19322 - struct exec_domain *new_domain;
19323 - struct fs_struct *old_fs = current->fs, *new_fs;
19324 - get_exec_domain(old_domain);
19325 - atomic_inc(&old_fs->count);
19327 - set_personality(PER_SVR4);
19328 - interpreter = open_exec(elf_interpreter);
19330 - new_domain = current->exec_domain;
19331 - new_fs = current->fs;
19332 - current->personality = old_pers;
19333 - current->exec_domain = old_domain;
19334 - current->fs = old_fs;
19335 - put_exec_domain(new_domain);
19336 - put_fs_struct(new_fs);
19340 - interpreter = open_exec(elf_interpreter);
19343 + interpreter = open_exec(elf_interpreter);
19345 retval = PTR_ERR(interpreter);
19346 if (IS_ERR(interpreter))
19347 goto out_free_interp;
19348 @@ -582,10 +559,6 @@
19349 current->flags &= ~PF_FORKNOEXEC;
19350 elf_entry = (unsigned long) elf_ex.e_entry;
19352 - /* Do this immediately, since STACK_TOP as used in setup_arg_pages
19353 - may depend on the personality. */
19354 - SET_PERSONALITY(elf_ex, ibcs2_interpreter);
19356 /* Do this so that we can load the interpreter, if need be. We will
19357 change some of these later */
19358 current->mm->rss = 0;
19359 @@ -725,8 +698,7 @@
19360 printk("(brk) %lx\n" , (long) current->mm->brk);
19363 - if ( current->personality == PER_SVR4 )
19365 + if (current->personality & MMAP_PAGE_ZERO) {
19366 /* Why this, you ask??? Well SVr4 maps page 0 as read-only,
19367 and some applications "depend" upon this behavior.
19368 Since we do not have the power to recompile these, we
19369 diff -uNr --exclude-from=dontdiff linux-2.4.3/fs/binfmt_xout.c linux/fs/binfmt_xout.c
19370 --- linux-2.4.3/fs/binfmt_xout.c Thu Jan 1 01:00:00 1970
19371 +++ linux/fs/binfmt_xout.c Sun Mar 18 18:41:16 2001
19374 + * binfmt_xout.c - support for the Microsoft Xenix x.out binary format
19376 + * Copyright (c) 1994 Mike Jagdis (jaggy@purplet.demon.co.uk)
19377 + * Copyright (c) 2001 Christoph Hellwig (chhellwig@gmx.net)
19379 + * This file is based upon code written by Al Longyear for the COFF file
19380 + * format which is in turn based upon code written by Eric Youngdale for
19381 + * the ELF object file format. Any errors are most likely my own however.
19384 +#include <linux/config.h>
19385 +#include <linux/module.h>
19386 +#include <linux/init.h>
19387 +#include <linux/fs.h>
19388 +#include <linux/sched.h>
19389 +#include <linux/mm.h>
19390 +#include <linux/mman.h>
19391 +#include <linux/a.out.h>
19392 +#include <linux/errno.h>
19393 +#include <linux/signal.h>
19394 +#include <linux/binfmts.h>
19395 +#include <linux/string.h>
19396 +#include <linux/fcntl.h>
19397 +#include <linux/ptrace.h>
19398 +#include <linux/personality.h>
19399 +#include <linux/file.h>
19400 +#include <linux/slab.h>
19402 +#include <asm/uaccess.h>
19403 +#include <asm/ldt.h>
19405 +#include <abi/abi.h>
19406 +#include <abi/xout.h>
19410 + * If you compile with dprintk defined to printk you will get
19411 + * lots of debugging messages from the x.out module.
19416 + * If you compile with XOUT_FORCE_PAGE defined (the default)
19417 + * then if all segments are aligned on 1k bounaries within the
19418 + * file and 4k boundaries within the address space we assume
19419 + * that no overlaps occur within the same VM page and the
19420 + * executable can thus be mmapped if the filesystem allows it.
19421 + * I believe this is the case for all 386 small model binaries,
19422 + * 286 binaries can't be demand paged.
19424 +#define XOUT_FORCE_PAGE
19427 + * If you compile with XOUT_SEGMENTS defined the loader will take care
19428 + * to set up the LDT as would "real" Xenix. This shouldn't be necessary
19429 + * for most programs but it is just possible that something out there
19430 + * makes assumptions about its environment and uses segment overrides.
19432 + * The default is not to bother setting up the LDT unless we need support
19433 + * for Xenix 286 binaries.
19435 +#undef XOUT_SEGMENTS
19438 + * Xenix 286 requires segment handling.
19440 +#if defined(CONFIG_ABI_IBCS_X286) || defined(CONFIG_ABI_IBCS_X286)
19441 +#define XOUT_SEGMENTS
19445 +static int xout_load_binary(struct linux_binprm *, struct pt_regs *);
19446 +static int xout_load_library(struct file *);
19448 +static struct linux_binfmt xout_format = {
19449 + NULL, THIS_MODULE, xout_load_binary, xout_load_library, NULL, PAGE_SIZE
19453 +#if defined(XOUT_DEBUG) && defined(XOUT_SEGMENTS)
19455 + * This is borrowed (with minor variations since we are in kernel mode)
19456 + * from the DPMI code for DOSEMU. I don't claim to understand LDTs :-).
19459 +print_desc(int which)
19461 + u_long base_addr, limit;
19463 + int count, type, dpl, i;
19466 + lp = (u_long *)((struct desc_struct*)(current->mm->segments));
19467 + count = LDT_ENTRIES;
19468 + printk(KERN_DEBUG "xout: LDT\n");
19470 + lp = (u_long *)0x10c860; /* gdt; DANGER! MAGIC! */
19472 + printk(KERN_DEBUG "xout: GDT\n");
19478 + printk(KERN_DEBUG "XOUT: SLOT BASE/SEL LIM/OFF TYPE DPL ACCESSBITS\n");
19479 + for (i=0; i < count; i++, lp++) {
19480 + /* First 32 bits of descriptor */
19481 + base_addr = (*lp >> 16) & 0x0000FFFF;
19482 + limit = *lp & 0x0000FFFF;
19485 + /* First 32 bits of descriptor */
19486 + base_addr |= (*lp & 0xFF000000) | ((*lp << 16) & 0x00FF0000);
19487 + limit |= (*lp & 0x000F0000);
19488 + type = (*lp >> 10) & 7;
19489 + dpl = (*lp >> 13) & 3;
19490 + if ((base_addr > 0) || (limit > 0 )) {
19491 + printk(KERN_DEBUG "XOUT: %03d 0x%08lx 0x%08lx 0x%02x %03d %s%s%s%s%s%s%s\n",
19493 + base_addr, limit, type, dpl,
19494 + (*lp & 0x100) ? " ACCS'D" : "",
19495 + (*lp & 0x200) ? " R&W" : " R&X",
19496 + (*lp & 0x8000) ? " PRESENT" : "",
19497 + (*lp & 0x100000) ? " USER" : "",
19498 + (*lp & 0x200000) ? " X" : "",
19499 + (*lp & 0x400000) ? " 32" : "",
19500 + (*lp & 0x800000) ? " PAGES" : "");
19508 +xout_create_tables(char *p, struct linux_binprm *bprm, int ibcs)
19510 + int argc = bprm->argc, envc = bprm->envc;
19511 + u_long *argv,*envp;
19514 + sp = (u_long *) ((-(u_long)sizeof(char *)) & (u_long) p);
19521 + put_user(envp, sp);
19523 + put_user(argv, sp);
19526 + put_user(argc, sp);
19527 + current->mm->arg_start = (u_long) p;
19528 + while (argc-->0) {
19529 + put_user(p, argv); argv++;
19530 + p += strlen_user(p);
19532 + put_user(NULL,argv);
19533 + current->mm->arg_end = current->mm->env_start = (u_long) p;
19534 + while (envc-->0) {
19535 + put_user(p, envp); envp++;
19536 + p += strlen_user(p);
19538 + put_user(NULL,envp);
19539 + current->mm->env_end = (u_long) p;
19547 + * If you compile with XOUT_FORCE_PAGE defined (the default)
19548 + * then if all segments are aligned on 1k bounaries within the
19549 + * file and 4k boundaries within the address space we assume
19550 + * that no overlaps occur within the same VM page and the
19551 + * executable can thus be mmapped if the filesystem allows it.
19552 + * I believe this is the case for all 386 small model binaries
19553 + * - which is all we support anyway.
19555 +static __inline__ int
19556 +isaligned(struct xseg *seg)
19558 + dprintk(KERN_DEBUG
19559 + "xout: %04x %04x %04x %02x %08lx %08lx %08lx %08lx\n",
19560 + seg->xs_type, seg->xs_attr, seg->xs_seg,
19561 + seg->xs_align, seg->xs_filpos, seg->xs_psize,
19562 + seg->xs_vsize, seg->xs_rbase);
19564 +#ifdef XOUT_FORCE_PAGE
19566 + * XXXX The file alignment should be dependent on the block size
19567 + * of the filesystem shouldn't it?
19569 + if ((seg->xs_filpos & 0x3ff) | (seg->xs_rbase & ~PAGE_MASK))
19570 + printk(KERN_DEBUG "xout: bad alignment - demand paging disabled\n");
19571 + return ((seg->xs_filpos & 0x3ff) | (seg->xs_rbase & ~PAGE_MASK));
19573 + if ((seg->xs_filpos - seg->xs_rbase) & ~PAGE_MASK)
19574 + printk(KERN_DEBUG "xout: bad alignment - demand paging disabled\n");
19575 + return ((seg->xs_filpos - seg->xs_rbase) & ~PAGE_MASK);
19580 +static __inline__ void
19581 +clear_memory(u_long addr, u_long size)
19583 + while (size-- != 0)
19584 + put_user(0, (char *)addr++);
19588 +xout_amen(struct file *fp, struct xseg *sp, int pageable)
19590 +#ifdef XOUT_SEGMENTS
19591 + struct desc_struct def_ldt;
19592 + modify_ldt_t ldt_info;
19593 + mm_segment_t old_fs;
19596 + u_long bss_size, bss_base;
19599 +#ifdef XOUT_SEGMENTS
19600 + old_fs = get_fs();
19606 + * Xenix 386 segments simply map the whole address
19607 + * space either read-exec only or read-write.
19609 + ldt_info.entry_number = sp->xs_seg >> 3;
19610 + ldt_info.read_exec_only = 0 /* ((s->xs_attr & XS_APURE) ? 1 : 0) */;
19611 + ldt_info.contents = ((sp->xs_type == XS_TTEXT) ? 2 : 0);
19612 + ldt_info.seg_not_present = 0;
19613 + ldt_info.seg_32bit = ((sp->xs_attr & XS_A32BIT) ? 1 : 0);
19614 + if (!ldt_info.seg_32bit) {
19615 + ldt_info.base_addr = *addrp;
19616 + *addrp = PAGE_ALIGN(*addrp + sp->xs_vsize);
19617 + sp->xs_rbase = ldt_info.base_addr;
19619 + ldt_info.base_addr = 0;
19622 + bss_size = sp->xs_vsize - sp->xs_psize;
19623 + bss_base = sp->xs_rbase + sp->xs_psize;
19626 + * If it is a text segment update the code boundary
19627 + * markers. If it is a data segment update the data
19628 + * boundary markers.
19630 + if (sp->xs_type == XS_TTEXT) {
19631 + if ((sp->xs_rbase + sp->xs_psize) > current->mm->end_code)
19632 + current->mm->end_code = (sp->xs_rbase + sp->xs_psize);
19633 + } else if (sp->xs_type == XS_TDATA) {
19634 +#ifdef XOUT_SEGMENTS
19636 + * If it is the first data segment note that
19637 + * this is the segment we start in. If this
19638 + * isn't a 386 binary add the stack to the
19639 + * top of this segment.
19641 + if ((xexec->x_cpu & XC_CPU) != XC_386) {
19642 + if (regs->ebx == regs->ecx) {
19643 + regs->ecx = s->xs_seg;
19644 + regs->edx = s->xs_vsize;
19645 + sp->xs_vsize = 0x10000;
19646 + *addrp = PAGE_ALIGN(ldt_info.base_addr + s->xs_vsize);
19649 + if (regs->xds == regs->xcs)
19650 + regs->xds = regs->xes = regs->xss = s->xs_seg;
19653 + if ((sp->xs_rbase + sp->xs_psize) > current->mm->end_data)
19654 + current->mm->end_data = (sp->xs_rbase + sp->xs_psize);
19657 + if ((sp->xs_rbase + sp->xs_vsize) > current->mm->brk)
19658 + current->mm->start_brk =
19659 + current->mm->brk = PAGE_ALIGN(sp->xs_rbase + sp->xs_vsize);
19660 +#ifdef XOUT_SEGMENTS
19661 + if (ldt_info.seg_32bit) {
19662 + ldt_info.limit = (TASK_SIZE-1) >> 12;
19663 + ldt_info.limit_in_pages = 1;
19665 + ldt_info.limit = s->xs_vsize-1;
19666 + ldt_info.limit_in_pages = 0;
19669 + dprintk(KERN_DEBUG "xout: ldt %02x, type=%d, base=0x%08lx, "
19670 + "limit=0x%08x, pages=%d, 32bit=%d\n",
19671 + ldt_info.entry_number, ldt_info.contents,
19672 + ldt_info.base_addr, ldt_info.limit,
19673 + ldt_info.limit_in_pages, ldt_info.seg_32bit);
19676 + * Use the modify_ldt syscall since this allocates
19677 + * the initial space for the LDT table, tweaks the
19678 + * GDT etc. We need to read the current LDT first
19679 + * since we need to copy the lcall7 call gate.
19681 + set_fs(get_ds());
19682 + if (!current->mm->segments) {
19683 + SYS(modify_ldt)(0, &def_ldt, sizeof(def_ldt));
19687 + status = SYS(modify_ldt)(1, &ldt_info, sizeof(ldt_info));
19689 + if (status >= 0 && !ntext && s->xs_seg == 0x47) {
19690 + /* Uh oh, impure binary... */
19691 + ldt_info.entry_number = 0x3f >> 3;
19693 + ldt_info.read_exec_only = 1;
19695 + ldt_info.read_exec_only = 0;
19697 + ldt_info.contents = 2;
19698 + status = SYS(modify_ldt)(1, &ldt_info, sizeof(ldt_info));
19704 + ((struct desc_struct *)(current->mm->segments))[0].a = def_ldt.a;
19705 + ((struct desc_struct *)(current->mm->segments))[0].b = def_ldt.b;
19708 + printk(KERN_INFO "xout: modify_ldt returned %d\n", status);
19715 + dprintk(KERN_DEBUG "xout: Null map 0x%08lx, length 0x%08lx\n",
19716 + sp->xs_rbase, sp->xs_vsize);
19717 + err = do_mmap(NULL, sp->xs_rbase, sp->xs_vsize,
19718 + PROT_READ|PROT_WRITE|PROT_EXEC,
19719 + MAP_FIXED|MAP_PRIVATE, 0);
19723 + dprintk(KERN_DEBUG "xout: mmap to 0x%08lx from 0x%08lx, length 0x%08lx\n",
19724 + sp->xs_rbase, sp->xs_filpos, sp->xs_psize);
19725 + if (sp->xs_attr & XS_APURE) {
19726 + err = do_mmap(fp, sp->xs_rbase, sp->xs_psize,
19727 + PROT_READ|PROT_EXEC, MAP_FIXED|MAP_SHARED,
19730 + err = do_mmap(fp, sp->xs_rbase, sp->xs_psize,
19731 + PROT_READ|PROT_WRITE|PROT_EXEC,
19732 + MAP_FIXED|MAP_PRIVATE | MAP_DENYWRITE | MAP_EXECUTABLE,
19740 + * Map uninitialised data.
19743 + if (bss_base & PAGE_MASK) {
19744 + clear_memory(bss_base, PAGE_ALIGN(bss_base)-bss_base);
19745 + bss_size -= (PAGE_ALIGN(bss_base) - bss_base);
19746 + bss_base = PAGE_ALIGN(bss_base);
19749 + dprintk(KERN_DEBUG "xout: Null map 0x%08lx, length 0x%08lx\n",
19750 + bss_base, bss_size);
19752 + err = do_mmap(NULL, bss_base, bss_size,
19753 + PROT_READ | PROT_WRITE | PROT_EXEC,
19754 + MAP_FIXED | MAP_PRIVATE, 0);
19758 +#ifdef XOUT_SEGMENTS
19759 + if (err >= 0 && !ntext && ndata == 1 && sp->xs_seg >= 0x47) {
19761 + * Uh oh, impure binary.
19762 + * Mirror this data segment to the text segment
19764 + addrp = mirror_addr = sp->xs_rbase;
19765 + sp->xs_seg = xext->xe_eseg;
19766 + sp->xs_type = XS_TTEXT;
19774 + * Helper function to process the load operation.
19777 +xout_load_object(struct linux_binprm * bpp, struct pt_regs *rp, int executable)
19779 + struct xexec *xexec = (struct xexec *)bpp->buf;
19780 + struct xext *xext = (struct xext *)(xexec + 1);
19781 + struct xseg *seglist;
19782 + struct file *fp = NULL;
19783 + u_long addr, mirror_addr;
19784 + int nsegs, ntext, ndata;
19785 + int pageable = 1, err = 0;
19788 + dprintk(KERN_DEBUG "xout: binfmt_xout entry: %s\n",
19789 + bpp->file->f_dentry->d_name.name);
19791 + if (xexec->x_magic != X_MAGIC) {
19792 + dprintk(KERN_DEBUG "xout: bad magic %04x\n", xexec->x_magic);
19796 + switch (xexec->x_cpu & XC_CPU) {
19807 + dprintk(KERN_DEBUG "xout: unsupported CPU type (%02x)\n",
19813 + * We can't handle byte or word swapped headers. Well, we
19814 + * *could* but they should never happen surely?
19816 + if ((xexec->x_cpu & (XC_BSWAP | XC_WSWAP)) != XC_WSWAP) {
19817 + dprintk(KERN_DEBUG "xout: wrong byte or word sex (%02x)\n",
19822 + /* Check it's an executable. */
19823 + if (!(xexec->x_renv & XE_EXEC)) {
19824 + dprintk(KERN_DEBUG "xout: not executable\n");
19829 + * There should be an extended header and there should be
19830 + * some segments. At this stage we don't handle non-segmented
19831 + * binaries. I'm not sure you can get them under Xenix anyway.
19833 + if (xexec->x_ext != sizeof(struct xext)) {
19834 + dprintk(KERN_DEBUG "xout: bad extended header\n");
19838 + if (!(xexec->x_renv & XE_SEG) || !xext->xe_segsize) {
19839 + dprintk(KERN_DEBUG "xout: not segmented\n");
19843 + if (!(seglist = kmalloc(xext->xe_segsize, GFP_KERNEL))) {
19844 + printk(KERN_WARNING "xout: allocating segment list failed\n");
19848 + err = kernel_read(bpp->file, xext->xe_segpos,
19849 + (char *)seglist, xext->xe_segsize);
19851 + dprintk(KERN_DEBUG "xout: problem reading segment table\n");
19855 + if (!bpp->file->f_op->mmap)
19858 + nsegs = xext->xe_segsize / sizeof(struct xseg);
19860 + ntext = ndata = 0;
19861 + for (i=0; i<nsegs; i++) {
19862 + switch (seglist[i].xs_type) {
19864 + if (!isaligned(seglist+i))
19869 + if (!isaligned(seglist+i))
19880 + * Generate the proper values for the text fields
19882 + * THIS IS THE POINT OF NO RETURN. THE NEW PROCESS WILL TRAP OUT SHOULD
19883 + * SOMETHING FAIL IN THE LOAD SEQUENCE FROM THIS POINT ONWARD.
19887 + * Flush the executable from memory. At this point the executable is
19888 + * committed to being defined or a segmentation violation will occur.
19890 + if (executable) {
19891 + dprintk(KERN_DEBUG "xout: flushing executable\n");
19893 + flush_old_exec(bpp);
19895 + current->mm->mmap = NULL;
19896 + current->mm->rss = 0;
19898 + if ((err = setup_arg_pages(bpp)) < 0) {
19899 + send_sig(SIGSEGV, current, 1);
19904 + bpp->p = (u_long)xout_create_tables((char *)bpp->p, bpp,
19905 + (xexec->x_cpu & XC_CPU) == XC_386 ? 1 : 0);
19907 + bpp->p = (u_long)xout_create_tables((char *)bpp->p, bpp, 1);
19911 + * Do the end processing once the stack has been constructed
19913 +#ifdef XOUT_SEGMENTS
19915 + * These will be set up later once we've seen the
19916 + * segments that make the program up.
19918 + current->mm->start_code =
19919 + current->mm->end_code =
19920 + current->mm->end_data =
19921 + current->mm->start_brk =
19922 + current->mm->brk = 0;
19924 + current->mm->start_code = 0;
19925 + current->mm->end_code = xexec->x_text;
19926 + current->mm->end_data = xexec->x_text + xexec->x_data;
19927 + current->mm->start_brk =
19928 + current->mm->brk = xexec->x_text + xexec->x_data + xexec->x_bss;
19930 + compute_creds(bpp);
19931 + current->flags &= ~PF_FORKNOEXEC;
19933 +#ifdef XOUT_SEGMENTS
19935 + * The code selector is advertised in the header.
19937 + if ((xexec->x_cpu & XC_CPU) != XC_386) {
19938 + regs->ebx = regs->ecx = xext->xe_eseg;
19939 + regs->eax = xexec->x_entry;
19941 + regs->xcs = regs->xds = regs->xes = regs->xss = xext->xe_eseg;
19942 + regs->eip = xexec->x_entry;
19945 + rp->xcs = __USER_CS;
19946 + rp->xds = rp->xes = rp->xss = __USER_DS;
19947 + rp->eip = xexec->x_entry;
19950 + dprintk(KERN_DEBUG "xout: entry point = 0x%x:0x%08lx\n",
19951 + xext->xe_eseg, xexec->x_entry);
19953 + rp->esp = current->mm->start_stack = bpp->p;
19955 + set_personality(PER_XENIX);
19958 + /* Base address for mapping 16bit segments. This should lie above
19959 + * the emulator overlay.
19961 + addr = X286_MAP_ADDR;
19964 + /* If this isn't a 386 executable we need to load the overlay
19965 + * library to emulate a [2]86 environment and save the binary
19966 + * headers for later reference by the emulator.
19968 + if ((xexec->x_cpu & XC_CPU) != XC_386) {
19969 + mm_segment_t old_fs = get_fs();
19971 + set_fs (get_ds ());
19972 + status = SYS(uselib)("/usr/lib/x286emul");
19975 + status = do_mmap(NULL,
19976 + addr, sizeof(struct xexec)+sizeof(struct xext),
19977 + PROT_READ|PROT_WRITE|PROT_EXEC,
19978 + MAP_FIXED|MAP_PRIVATE,
19980 + if (status >= 0) {
19981 + copy_to_user((char *)addr, xexec, sizeof(struct xexec));
19982 + copy_to_user((char *)addr+sizeof(struct xexec), xext, sizeof(struct xext));
19983 + addr = PAGE_ALIGN(addr+sizeof(struct xexec)+sizeof(struct xext));
19989 + * Scan the segments and map them into the process space. If this
19990 + * executable is pageable (unlikely since Xenix aligns to 1k
19991 + * boundaries and we want it aligned to 4k boundaries) this is
19992 + * all we need to do. If it isn't pageable we go round again
19993 + * afterwards and load the data. We have to do this in two steps
19994 + * because if segments overlap within a 4K page we'll lose the
19995 + * first instance when we remap the page. Hope that's clear...
19997 + * N.B. If you compile with XOUT_FORCE_PAGE defined (the default)
19998 + * then if all segments are aligned on 1k bounaries within the
19999 + * file and 4k boundaries within the address space we assume
20000 + * that no overlaps occur within the same VM page and the
20001 + * executable can thus be mmapped if the filesystem allows it.
20002 + * I believe this is the case for all 386 small model binaries
20003 + * - which is all we support anyway.
20007 + for (i = 0; err >= 0 && i < nsegs; i++) {
20008 + struct xseg *sp = seglist+i;
20010 + if (sp->xs_attr & XS_AMEM)
20011 + err = xout_amen(fp, sp, pageable);
20016 + if (addr > current->mm->brk)
20017 + current->mm->start_brk = current->mm->brk = addr;
20020 + dprintk(KERN_DEBUG "xout: start code 0x%08lx, end code 0x%08lx,"
20021 + " end data 0x%08lx, brk 0x%08lx\n",
20022 + current->mm->start_code, current->mm->end_code,
20023 + current->mm->end_data, current->mm->brk);
20024 +#ifdef XOUT_SEGMENTS
20034 + for (i = 0; (err >= 0) && (i < nsegs); i++) {
20035 + struct xseg *sp = seglist + i;
20038 + if (sp->xs_type == XS_TTEXT || sp->xs_type == XS_TDATA) {
20039 + dprintk(KERN_DEBUG "xout: read to 0x%08lx from 0x%08lx,"
20040 + " length 0x%08lx\n", sp->xs_rbase,
20041 + sp->xs_filpos, sp->xs_psize);
20043 + if (sp->xs_psize < 0)
20046 + psize = kernel_read(bpp->file, sp->xs_filpos,
20047 + (char *)sp->xs_rbase, sp->xs_psize);
20049 + if (psize != sp->xs_psize) {
20050 + dprintk(KERN_DEBUG "xout: short read\n");
20058 + * Generate any needed trap for this process. If an error occured then
20059 + * generate a segmentation violation. If the process is being debugged
20060 + * then generate the load trap. (Note: If this is a library load then
20061 + * do not generate the trap here. Pass the error to the caller who
20062 + * will do it for the process in the outer lay of this procedure call.)
20065 + if (executable) {
20067 + dprintk(KERN_DEBUG "xout: loader forces seg fault "
20068 + "(err = %d)\n", err);
20069 + send_sig(SIGSEGV, current, 0);
20070 + } else if (current->ptrace & PT_PTRACED)
20071 + send_sig(SIGTRAP, current, 0);
20078 + dprintk(KERN_DEBUG "xout: binfmt_xout: result = %d\n", err);
20081 + * If we are using the [2]86 emulation overlay we enter this
20082 + * rather than the real program and give it the information
20083 + * it needs to start the ball rolling.
20085 + if ((xexec->x_cpu & XC_CPU) != XC_386) {
20087 + regs->eax = regs->eip;
20088 + regs->ebx = regs->xcs;
20089 + regs->ecx = regs->xds;
20090 + regs->xcs = __USER_CS;
20091 + regs->xds = regs->xes = regs->xss = __USER_DS;
20093 + rp->eip = 0x1020;
20094 + dprintk(KERN_DEBUG "xout: x286emul 0x%02lx:0x%04lx,"
20095 + " ds=0x%02lx, stack 0x%02lx:0x%04lx\n",
20096 + rp->ebx, rp->eax, rp->ecx, rp->ecx,
20099 + while (!signal_pending(current))
20102 + return (err < 0 ? err : rp->eax);
20106 + while (!signal_pending(current))
20110 + * Xenix 386 programs expect the initial brk value to be in eax
20111 + * on start up. Hence if we succeeded we need to pass back
20112 + * the brk value rather than the status. Ultimately the
20113 + * ret_from_sys_call assembly will place this in eax before
20114 + * resuming (starting) the process.
20116 + return (err < 0 ? err : current->mm->brk);
20121 + * This procedure is called by the main load sequence. It will load
20122 + * the executable and prepare it for execution. It provides the additional
20123 + * parameters used by the recursive xout loader and tells the loader that
20124 + * this is the main executable. How simple it is . . . .
20127 +xout_load_binary(struct linux_binprm *bpp, struct pt_regs *rp)
20129 + return (xout_load_object(bpp, rp, 1));
20133 + * Load the image for any shared library. This is called when
20134 + * we need to load a library based upon a file name.
20136 + * XXX: I have never seen a Xenix shared library... --hch
20139 +xout_load_library(struct file *fp)
20141 + struct linux_binprm *bpp;
20142 + struct pt_regs regs;
20143 + int err = -ENOMEM;
20145 + if (!(bpp = kmalloc(sizeof(struct linux_binprm), GFP_KERNEL))) {
20146 + printk(KERN_WARNING "xout: kmalloc failed\n");
20150 + memset(bpp, 0, sizeof(struct linux_binprm));
20153 + if ((err = kernel_read(fp, 0L, bpp->buf, sizeof(bpp->buf))) < 0)
20154 + printk(KERN_WARNING "xout: unable to read library header\n");
20156 + err = xout_load_object(bpp, ®s, 0);
20164 +binfmt_xout_init(void)
20166 + return register_binfmt(&xout_format);
20169 +static void __exit
20170 +binfmt_xout_exit(void)
20172 + unregister_binfmt(&xout_format);
20175 +module_init(binfmt_xout_init);
20176 +module_exit(binfmt_xout_exit);
20177 diff -uNr --exclude-from=dontdiff linux-2.4.3/include/abi/abi.h linux/include/abi/abi.h
20178 --- linux-2.4.3/include/abi/abi.h Thu Jan 1 01:00:00 1970
20179 +++ linux/include/abi/abi.h Fri Mar 30 15:23:49 2001
20182 + * Function prototypes used by the iBCS2 emulator
20188 +#ifndef __IBCS_IBCS_H__
20189 +#define __IBCS_IBCS_H__
20190 +#include <linux/ptrace.h> /* for pt_regs */
20191 +#include <linux/sched.h>
20192 +#include <linux/signal.h>
20193 +#include <linux/unistd.h>
20194 +#include <linux/config.h>
20196 +#include <abi/stream.h>
20197 +#include <abi/map.h>
20198 +#include <asm/abi.h>
20200 +/* This is straight from linux/fs/stat.c. It is required for
20201 + * proper NFS attribute caching (so it says there). Maybe the
20202 + * kernel should export it - but it is basically simple...
20204 +static __inline__ int
20205 +do_revalidate(struct dentry *dentry)
20207 + struct inode *inode = dentry->d_inode;
20208 + if (inode->i_op && inode->i_op->revalidate)
20209 + return inode->i_op->revalidate(dentry);
20214 +static inline unsigned short map_flags(unsigned short f, unsigned short map[])
20217 + unsigned short m, r;
20220 + for (i=0,m=1; i < 16; i++,m<<=1)
20228 +/* XXX anyone has an idea how to make gcc shut up about this? */
20229 +typedef int (*sysfun_p)();
20231 +extern sysfun_p sys_call_table[];
20233 +#define SYS(name) (sys_call_table[__NR_##name])
20237 + * the function prefix sys_... are used by linux in native mode.
20238 + * abi_, svr4_, sol_, uw7_ and ibcs_... are emulation interfaces for routines that
20239 + * differ from iBCS2 and linux. The xnx_... are xenix routines.
20241 +typedef struct abi_function {
20242 + void * kfunc; /* function to call (sys_..., ibcs_... or xnx_...)
20243 + * or pointer to a sub class.
20245 + short nargs; /* number of args to kfunc or Ukn, Spl or Fast */
20246 + short trace; /* trace function we can turn tracing on or off */
20247 + char * name; /* name of function (for tracing) */
20248 + char * args; /* how to print the arg list (see plist) */
20251 +struct ibcs_statfs {
20271 +struct ibcs_stat {
20272 + unsigned long st_dev;
20273 + long st_pad1[3]; /* network id */
20274 + unsigned long st_ino;
20275 + unsigned long st_mode;
20276 + unsigned long st_nlink;
20277 + unsigned long st_uid;
20278 + unsigned long st_gid;
20279 + unsigned long st_rdev;
20282 + long st_pad3; /* st_size, off_t expansion */
20283 + timestruct_t st_atime;
20284 + timestruct_t st_mtime;
20285 + timestruct_t st_ctime;
20288 + char st_fstype[16];
20289 + long st_pad4[8]; /* expansion area */
20292 +struct ibcs_stat {
20293 + unsigned short st_dev;
20294 + unsigned short st_ino;
20295 + unsigned short st_mode;
20296 + unsigned short st_nlink;
20297 + unsigned short st_uid;
20298 + unsigned short st_gid;
20299 + unsigned short st_rdev;
20300 + unsigned long st_size;
20301 + unsigned long st_atime;
20302 + unsigned long st_mtime;
20303 + unsigned long st_ctime;
20308 +struct ibcs_iovec {
20309 + unsigned long addr;
20314 +extern int abi_brk(unsigned long newbrk);
20315 +extern int abi_lseek(int fd, unsigned long offset, int whence);
20316 +extern int abi_fork(struct pt_regs * regs);
20317 +extern int abi_pipe(struct pt_regs * regs);
20318 +extern int abi_getpid(struct pt_regs * regs);
20319 +extern int abi_getuid(struct pt_regs * regs);
20320 +extern int abi_getgid(struct pt_regs * regs);
20321 +extern int abi_wait(struct pt_regs * regs);
20322 +extern int ibcs_execv(struct pt_regs * regs);
20323 +extern int abi_exec(struct pt_regs * regs);
20324 +extern int abi_read(int fd, char *buf, int nbytes);
20325 +extern int abi_procids(struct pt_regs * regs);
20326 +extern int abi_select(int n, void *rfds, void *wfds, void *efds,
20327 + struct timeval *t);
20328 +extern int abi_time(void);
20329 +extern int ibcs_writev(int fd, struct ibcs_iovec *it, int n);
20331 +extern int abi_syscall(struct pt_regs *regs);
20334 +extern int abi_mkdir(const char *fname, int mode);
20335 +extern int abi_mknod(const char *fname, int mode, int dev);
20337 +/* secureware.c */
20338 +extern int sw_security(int cmd, void *p1, void *p2, void *p3, void *p4, void *p5);
20341 +/* For mapping signal numbers */
20342 +void deactivate_signal(struct task_struct *task, int signum);
20343 +extern int abi_sigfunc(struct pt_regs * regs);
20344 +extern int abi_kill(int pid, int sig);
20347 +extern int abi_stat(char * filename, struct ibcs_stat * statbuf);
20348 +extern int abi_lstat(char * filename, struct ibcs_stat * statbuf);
20349 +extern int abi_fstat(unsigned int fd, struct ibcs_stat * statbuf);
20352 +struct svr4_siginfo {
20357 + struct { /* kill(), SIGCLD */
20370 + struct { /* SIGSEGV, SIGBUS, SIGILL, SIGFPE */
20373 + struct { /* SIGPOLL, SIGXFSZ */
20379 +#define SVR4_CLD_EXITED 1
20380 +#define SVR4_CLD_KILLED 2
20381 +#define SVR4_CLD_DUMPED 3
20382 +#define SVR4_CLD_TRAPPED 4
20383 +#define SVR4_CLD_STOPPED 5
20384 +#define SVR4_CLD_CONTINUED 6
20385 +extern int svr4_getgroups(int n, unsigned long *buf);
20386 +extern int svr4_setgroups(int n, unsigned long *buf);
20387 +extern int svr4_waitid(int idtype, int id, struct svr4_siginfo *infop, int options);
20388 +extern int svr4_access(char *path, int mode);
20391 +extern int ibcs_sysconf(int name);
20394 +extern int abi_utsname(unsigned long addr);
20395 +extern int sco_utsname(unsigned long addr);
20396 +extern int v7_utsname(unsigned long addr);
20399 +extern int abi_do_setsockopt(unsigned long *sp);
20400 +extern int abi_do_getsockopt(unsigned long *sp);
20403 +extern int abi_gethostname(char *name, int len);
20404 +extern int abi_getdomainname(char *name, int len);
20405 +extern int abi_wait3(int *loc);
20406 +extern int abi_socket(struct pt_regs *regs);
20407 +extern int abi_connect(struct pt_regs *regs);
20408 +extern int abi_accept(struct pt_regs *regs);
20409 +extern int abi_send(struct pt_regs *regs);
20410 +extern int abi_recv(struct pt_regs *regs);
20411 +extern int abi_bind(struct pt_regs *regs);
20412 +extern int abi_setsockopt(struct pt_regs *regs);
20413 +extern int abi_listen(struct pt_regs *regs);
20414 +extern int abi_getsockopt(struct pt_regs *regs);
20415 +extern int abi_recvfrom(struct pt_regs *regs);
20416 +extern int abi_sendto(struct pt_regs *regs);
20417 +extern int abi_shutdown(struct pt_regs *regs);
20418 +extern int abi_socketpair(struct pt_regs *regs);
20419 +extern int abi_getpeername(struct pt_regs *regs);
20420 +extern int abi_getsockname(struct pt_regs *regs);
20423 +extern int bsd_ioctl_termios(int fd, unsigned int func, void *arg);
20426 +extern int abi_sigsuspend(struct pt_regs *regs);
20428 +/* From wysev386i.c */
20429 +extern int wv386_ioctl(int fd, unsigned int ioctl_num, void *arg);
20431 +/* From socksys.c */
20432 +extern int socksys_major;
20433 +extern void inherit_socksys_funcs(unsigned int fd, int state);
20434 +extern int abi_socksys_fd_init(int fd, int rw, const char *buf, int *count);
20435 +extern int socksys_syscall(int *sp);
20436 +extern int abi_ioctl_socksys(int fd, unsigned int cmd, void *arg);
20439 +/* From sysisc.c */
20440 +extern int isc_setostype(int);
20443 +extern int ibcs_ioctl_vtkd(int, int, void *);
20447 +#define SC(name) (void *)__NR_##name
20448 +#define ITR(trace, name, args) ,trace,name,args
20451 +/* This table contains the appropriate kernel routines that can be run
20452 + * to perform the syscalls in question. If an entry is 'Ukn' we don't
20453 + * know how to handle it yet. (We also set trace on by default for these)
20454 + * Spl means that we need to do special processing for this syscall
20455 + * (see ibcs_wait or ibcs_getpid)
20456 + * Fast means that even the error return handling is done by the function call.
20458 +#define ZERO 0x64 /* Um, magic zero for callmap. Don't ask :-). */
20459 +#define Spl 0x65 /* pass the regs structure down */
20460 +#define Ukn 0x66 /* no code to handle this case yet */
20461 +#define Fast 0x67 /* magic on return, return regs structure already set up */
20463 +void abi_dispatch(struct pt_regs *regs, ABI_func *p, int offset);
20466 +/* Translate the errno numbers from linux to current personality.
20467 + * This should be removed and all other sources changed to call the
20468 + * map function above directly.
20470 +static inline int iABI_errors(int lnx_errno)
20472 + return map_value(current->exec_domain->err_map, lnx_errno, 1);
20475 +#endif /* __IBCS_IBCS_H__ */
20476 diff -uNr --exclude-from=dontdiff linux-2.4.3/include/abi/abi4.h linux/include/abi/abi4.h
20477 --- linux-2.4.3/include/abi/abi4.h Thu Jan 1 01:00:00 1970
20478 +++ linux/include/abi/abi4.h Mon Mar 12 16:35:05 2001
20481 + * These are defined to enable their inclsion in the branch table
20484 + * Hacked by Eric Youngdale for iBCS (1993, 1994).
20490 +#ifndef __ABI_ABI_H__
20491 +#define __ABI_ABI_H__
20492 +#include <abi/svr4sig.h>
20494 +typedef unsigned long ABI_dev_t;
20495 +typedef unsigned long ABI_ino_t;
20496 +typedef unsigned long ABI_mode_t;
20497 +typedef unsigned long ABI_nlink_t;
20498 +typedef long ABI_uid_t;
20499 +typedef long ABI_off_t;
20500 +typedef struct timeval ABI_timestruc_t;
20503 +struct abi_sigaction {
20505 + __sighandler_t sa_handler;
20506 + unsigned long sa_mask;
20507 + int sa_resv[2]; /* Reserved for something or another */
20509 +#define ABI_SA_ONSTACK 1
20510 +#define ABI_SA_RESETHAND 2
20511 +#define ABI_SA_RESTART 4
20512 +#define ABI_SA_SIGINFO 8
20513 +#define ABI_SA_NODEFER 16
20514 +#define ABI_SA_NOCLDWAIT 0x10000
20515 +#define ABI_SA_NOCLDSTOP 0x20000
20518 +struct sco_sigaction {
20519 + void (*sa_handler)(int);
20520 + unsigned long sa_mask;
20523 +#define SCO_SA_NOCLDSTOP 0x001
20524 +#define SCO_SA_COMPAT 0x080 /* 3.2.2 compatibilty. Like SA_SIGNAL? */
20525 +#define SCO_SA_SIGNAL 0x100
20528 +extern int abi_sigaction(int abi_signum, const struct abi_sigaction * action,
20529 + struct abi_sigaction * oldaction);
20530 +extern int sco_sigaction(int sco_signum, const struct sco_sigaction * action,
20531 + struct sco_sigaction * oldaction);
20532 +extern int abi_sigprocmask(int how, unsigned long *set, unsigned long *oset);
20533 +extern int abi_sigsuspend(struct pt_regs * regs);
20537 + * This is the general form of the stat structure in an ABI compliant system.
20540 +struct svr4_xstat {
20541 + ABI_dev_t st_dev;
20543 + ABI_ino_t st_ino;
20544 + ABI_mode_t st_mode;
20545 + ABI_nlink_t st_nlink;
20546 + ABI_uid_t st_uid;
20547 + ABI_uid_t st_gid;
20548 + ABI_dev_t st_rdev;
20550 + ABI_off_t st_size;
20552 + ABI_timestruc_t st_atim;
20553 + ABI_timestruc_t st_mtim;
20554 + ABI_timestruc_t st_ctim;
20557 + char st_fstype[ 16 ] ;
20562 + * Structure used by statvfs syscall.
20564 +struct abi_statvfs {
20565 + unsigned long f_bsize; /* blocksize */
20566 + unsigned long f_frsize; /* fragment size. */
20567 + unsigned long f_blocks;
20568 + unsigned long f_bfree;
20569 + unsigned long f_bavail;
20570 + unsigned long f_files;
20571 + unsigned long f_free;
20572 + unsigned long f_sid;
20573 + char f_basetype[16];
20574 + unsigned long f_flag;
20575 + unsigned long f_namemax;
20577 + unsigned long f_filler[16];
20580 +struct sco_statvfs {
20581 + unsigned long f_bsize; /* blocksize */
20582 + unsigned long f_frsize; /* fragment size. */
20583 + unsigned long f_blocks;
20584 + unsigned long f_bfree;
20585 + unsigned long f_bavail;
20586 + unsigned long f_files;
20587 + unsigned long f_free;
20588 + unsigned long f_favail;
20589 + unsigned long f_sid;
20590 + char f_basetype[16];
20591 + unsigned long f_flag;
20592 + unsigned long f_namemax;
20594 + unsigned long f_filler[16];
20597 +extern int svr4_xstat(int vers, char * path, void * buf);
20598 +extern int svr4_lxstat(int vers, char * path, void * buf);
20599 +extern int svr4_xmknod(int vers, const char * path, mode_t mode, dev_t dev);
20601 +extern int abi_statvfs(char * path, void * buf);
20602 +extern int abi_fstatvfs(int fd, void * buf);
20606 +int svr4_fpathconf(int fd, int name);
20607 +int svr4_pathconf(char *path, int name);
20608 +int svr4_sigpending (int which_routine, svr4_sigset_t *set);
20609 +int svr4_context (struct pt_regs *regs);
20610 +int svr4_ioctl(struct pt_regs *regs);
20612 +/* POSIX.1 names */
20613 +#define _PC_LINK_MAX 1
20614 +#define _PC_MAX_CANON 2
20615 +#define _PC_MAX_INPUT 3
20616 +#define _PC_NAME_MAX 4
20617 +#define _PC_PATH_MAX 5
20618 +#define _PC_PIPE_BUF 6
20619 +#define _PC_NO_TRUNC 7
20620 +#define _PC_VDISABLE 8
20621 +#define _PC_CHOWN_RESTRICTED 9
20622 +/* POSIX.4 names */
20623 +#define _PC_ASYNC_IO 10
20624 +#define _PC_PRIO_IO 11
20625 +#define _PC_SYNC_IO 12
20627 diff -uNr --exclude-from=dontdiff linux-2.4.3/include/abi/bsd.h linux/include/abi/bsd.h
20628 --- linux-2.4.3/include/abi/bsd.h Thu Jan 1 01:00:00 1970
20629 +++ linux/include/abi/bsd.h Mon Mar 12 16:35:05 2001
20632 + * Function prototypes used by the BSD emulator
20634 + * Copyright (C) 1994 Mike Jagdis (jaggy@purplet.demon.co.uk)
20640 +/* Ioctl's have the command encoded in the lower word, and the size of
20641 + * any in or out parameters in the upper word. The high 3 bits of the
20642 + * upper word are used to encode the in/out status of the parameter.
20643 + * Note that Linux does the same but has the IOC_IN and IOC_OUT values
20644 + * round the other way and uses 0 for IOC_VOID.
20646 +#define BSD_IOCPARM_MASK 0x1fff /* parameter length, at most 13 bits */
20647 +#define BSD_IOC_VOID 0x20000000 /* no parameters */
20648 +#define BSD_IOC_OUT 0x40000000 /* copy out parameters */
20649 +#define BSD_IOC_IN 0x80000000 /* copy in parameters */
20650 +#define BSD_IOC_INOUT (BSD_IOC_IN|BSD_IOC_OUT)
20652 +#define BSD__IOC(inout,group,num,len) \
20653 + (inout | ((len & BSD_IOCPARM_MASK) << 16) | ((group) << 8) | (num))
20654 +#define BSD__IO(g,n) BSD__IOC(BSD_IOC_VOID, (g), (n), 0)
20655 +#define BSD__IOR(g,n,t) BSD__IOC(BSD_IOC_OUT, (g), (n), sizeof(t))
20656 +#define BSD__IOW(g,n,t) BSD__IOC(BSD_IOC_IN, (g), (n), sizeof(t))
20657 +#define BSD__IOWR(g,n,t) BSD__IOC(BSD_IOC_INOUT, (g), (n), sizeof(t))
20659 +/* Some SYSV systems exhibit "compatible" BSD ioctls without the bumf. */
20660 +#define BSD__IOV(c,d) (((c) << 8) | (d))
20664 +#include <linux/limits.h>
20667 +/* Some BSD values have been extended to 64 bit types... */
20668 +typedef long long quad;
20671 +extern int bsd_getpagesize(void);
20672 +extern int bsd_geteuid(void);
20673 +extern int bsd_getegid(void);
20674 +extern int bsd_sbrk(unsigned long n);
20675 +extern int bsd_getdtablesize(void);
20676 +extern int bsd_killpg(int pgrp, int sig);
20677 +extern int bsd_setegid(int egid);
20678 +extern int bsd_seteuid(int euid);
20679 +extern int bsd_open(const char * fname, int flag, int mode);
20680 +extern int bsd_fcntl(struct pt_regs *regs);
20681 +extern int bsd_ioctl(struct pt_regs *regs);
20683 +/* From bsdioctl.c */
20684 +extern int bsd_ioctl_termios(int fd, unsigned int func, void *arg);
20686 +/* From bsdsignal.c */
20687 +#define BSD_SA_ONSTACK 0x0001
20688 +#define BSD_SA_RESTART 0x0002
20689 +#define BSD_SA_NOCLDSTOP 0x0004
20690 +struct bsd_sigaction {
20691 + void (*sa_handler)(int);
20692 + unsigned int sa_mask;
20695 +extern int bsd_sigaction(int bsd_signum, const struct bsd_sigaction *action,
20696 + struct bsd_sigaction *oldaction);
20697 +extern int bsd_sigprocmask(int how, unsigned long bsdnset, unsigned long *bsdoset);
20698 +extern int bsd_sigpending(unsigned long *set);
20700 +/* From bsdsocket.c */
20701 +extern int bsd_connect(struct pt_regs *regs);
20703 +/* From bsdstat.c */
20705 + unsigned short st_dev;
20706 + unsigned long st_ino;
20707 + unsigned short st_mode;
20708 + unsigned short st_nlink;
20709 + unsigned short st_uid;
20710 + unsigned short st_gid;
20711 + unsigned short st_rdev;
20712 + unsigned long st_size;
20713 + unsigned long st_atime;
20714 + unsigned long st_spare1;
20715 + unsigned long st_mtime;
20716 + unsigned long st_spare2;
20717 + unsigned long st_ctime;
20718 + unsigned long st_spare3;
20719 + unsigned long st_blksize;
20720 + unsigned long st_blocks;
20721 + unsigned long st_flags;
20722 + unsigned long st_gen;
20724 +extern int bsd_stat(char *filename, struct bsd_stat *st);
20725 +extern int bsd_lstat(char *filename, struct bsd_stat *st);
20726 +extern int bsd_fstat(unsigned int fd, struct bsd_stat *st);
20729 +#define MNAMELEN 90 /* length of buffer for returned name */
20731 +struct bsd_statfs {
20732 + short f_type; /* type */
20733 + short f_flags; /* copy of mount flags */
20734 + long f_fsize; /* fundamental file system block size */
20735 + long f_bsize; /* optimal transfer block size */
20736 + long f_blocks; /* total data blocks in file system */
20737 + long f_bfree; /* free blocks in fs */
20738 + long f_bavail; /* free blocks avail to non-superuser */
20739 + long f_files; /* total file nodes in file system */
20740 + long f_ffree; /* free file nodes in fs */
20741 + quad f_fsid; /* file system id */
20742 + long f_spare[9]; /* spare for later */
20743 + char f_mntonname[MNAMELEN]; /* directory on which mounted */
20744 + char f_mntfromname[MNAMELEN];/* mounted filesystem */
20746 +extern int bsd_statfs(const char *path, struct bsd_statfs *buf);
20747 +extern int bsd_fstatfs(unsigned int fd, struct bsd_statfs *buf);
20750 +#define MAXNAMELEN NAME_MAX
20752 +struct bsd_dirent {
20753 + unsigned long d_fileno;
20754 + unsigned short d_reclen;
20755 + unsigned short d_namlen;
20756 + char d_name[MAXNAMELEN+1];
20758 +extern int bsd_getdirentries(int fd, char *buf, int nbytes, char *end_posn);
20759 diff -uNr --exclude-from=dontdiff linux-2.4.3/include/abi/lfs.h linux/include/abi/lfs.h
20760 --- linux-2.4.3/include/abi/lfs.h Thu Jan 1 01:00:00 1970
20761 +++ linux/include/abi/lfs.h Mon Mar 12 16:35:05 2001
20763 +/* Large File Summit support functions */
20765 +#ifndef __IBCS_LFS_H__
20767 +#include <abi/abi.h>
20768 +#include <abi/svr4sig.h>
20770 +struct sol_stat64 {
20771 + unsigned long st_dev;
20772 + long st_pad1[3]; /* reserve for dev expansion */
20773 + /* sysid definition */
20774 + unsigned long long st_ino;
20775 + unsigned long st_mode;
20776 + unsigned long st_nlink;
20777 + unsigned long st_uid;
20778 + unsigned long st_gid;
20779 + unsigned long st_rdev;
20781 + unsigned long long st_size; /* large file support */
20782 + unsigned long st_atime;
20783 + unsigned long st_mtime;
20784 + unsigned long st_ctime;
20786 + long long st_blocks; /* large file support */
20787 + char st_fstype[16];
20788 + long st_pad4[8]; /* expansion area */
20791 +struct sol_dirent64 {
20792 + unsigned long long d_ino;
20793 + unsigned long long d_off;
20794 + unsigned short d_reclen;
20798 +int sol_stat64(char * filename, struct sol_stat64 * statbuf);
20799 +int sol_lstat64(char * filename, struct sol_stat64 * statbuf);
20800 +int sol_fstat64(unsigned int fd, struct sol_stat64 * statbuf);
20801 +int sol_open64(const char *fname, int flag, int mode);
20802 +int sol_getdents64(int fd, char *buf, int nbytes);
20803 +int sol_mmap64(unsigned vaddr, unsigned vsize, int prot, int flags,
20804 + int fd, unsigned int off_hi, unsigned file_offset);
20806 +/* version 4 (UW7_STAT64_VERSION) stat structure */
20807 +struct uw7_stat64 {
20808 + unsigned long st_dev;
20810 + unsigned long long st_ino;
20811 + unsigned long st_mode;
20812 + unsigned long st_nlink;
20815 + unsigned long st_rdev;
20817 + long long st_size;
20818 + struct timeval st_atime;
20819 + struct timeval st_mtime;
20820 + struct timeval st_ctime;
20822 + long long st_blocks;
20823 + char st_fstype[16];
20825 + unsigned long st_level;
20826 + unsigned long st_flags; /* may contain MLD flag */
20827 + unsigned long st_cmwlevel;
20831 +#endif /* __IBCS_LFS_H__ */
20832 diff -uNr --exclude-from=dontdiff linux-2.4.3/include/abi/map.h linux/include/abi/map.h
20833 --- linux-2.4.3/include/abi/map.h Thu Jan 1 01:00:00 1970
20834 +++ linux/include/abi/map.h Mon Mar 12 16:35:05 2001
20837 + * include/abi/map.h
20839 + * Copyright (C) 1994 Mike Jagdis (jaggy@purplet.demon.co.uk)
20845 +#ifndef __ABI_MAP_H__
20846 +#define __ABI_MAP_H__
20848 +struct map_segment {
20850 + unsigned char *map;
20854 +extern long map_bitvec(unsigned long vec, long map[]);
20855 +extern unsigned long map_sigvec_from_kernel(sigset_t vec, unsigned long map[]);
20856 +extern sigset_t map_sigvec_to_kernel(unsigned long vec, unsigned long map[]);
20857 +extern int map_value(struct map_segment *m, int val, int def);
20860 diff -uNr --exclude-from=dontdiff linux-2.4.3/include/abi/signal.h linux/include/abi/signal.h
20861 --- linux-2.4.3/include/abi/signal.h Thu Jan 1 01:00:00 1970
20862 +++ linux/include/abi/signal.h Mon Mar 12 16:35:05 2001
20864 +#define NSIGNALS 32
20867 +/* These are the signal numbers for the SVr4 signal handling */
20868 +#define IBCS_SIGHUP 1
20869 +#define IBCS_SIGINT 2
20870 +#define IBCS_SIGQUIT 3
20871 +#define IBCS_SIGILL 4
20872 +#define IBCS_SIGTRAP 5
20873 +#define IBCS_SIGIOT 6
20874 +#define IBCS_SIGABRT 6
20875 +#define IBCS_SIGEMT 7
20876 +#define IBCS_SIGFPE 8
20877 +#define IBCS_SIGKILL 9
20878 +#define IBCS_SIGBUS 10
20879 +#define IBCS_SIGSEGV 11
20880 +#define IBCS_SIGSYS 12
20881 +#define IBCS_SIGPIPE 13
20882 +#define IBCS_SIGALRM 14
20883 +#define IBCS_SIGTERM 15
20884 +#define IBCS_SIGUSR1 16
20885 +#define IBCS_SIGUSR2 17
20886 +#define IBCS_SIGCLD 18
20887 +#define IBCS_SIGCHLD 18
20888 +#define IBCS_SIGPWR 19
20889 +#define IBCS_SIGWINCH 20
20890 +#define IBCS_SIGURG 21 /* not SCO, SCO uses SIGUSR2 for SIGURG */
20891 +#define IBCS_SIGPOLL 22
20892 +#define IBCS_SIGIO 22
20893 +#define IBCS_SIGSTOP 23
20894 +#define IBCS_SIGTSTP 24
20895 +#define IBCS_SIGCONT 25
20896 +#define IBCS_SIGTTIN 26
20897 +#define IBCS_SIGTTOU 27
20898 +#define IBCS_SIGVTALRM 28
20899 +#define IBCS_SIGPROF 29
20900 +#define IBCS_SIGGXCPU 30
20901 +#define IBCS_SIGGXFSZ 31
20903 +#define ISC_SIGSTOP 24
20904 +#define ISC_SIGTSTP 25
20905 +#define ISC_SIGCONT 23
20907 +/* These are the signal numbers used by BSD. */
20908 +#define BSD_SIGHUP 1
20909 +#define BSD_SIGINT 2
20910 +#define BSD_SIGQUIT 3
20911 +#define BSD_SIGILL 4
20912 +#define BSD_SIGTRAP 5
20913 +#define BSD_SIGABRT 6
20914 +#define BSD_SIGEMT 7
20915 +#define BSD_SIGFPE 8
20916 +#define BSD_SIGKILL 9
20917 +#define BSD_SIGBUS 10
20918 +#define BSD_SIGSEGV 11
20919 +#define BSD_SIGSYS 12
20920 +#define BSD_SIGPIPE 13
20921 +#define BSD_SIGALRM 14
20922 +#define BSD_SIGTERM 15
20923 +#define BSD_SIGURG 16
20924 +#define BSD_SIGSTOP 17
20925 +#define BSD_SIGTSTP 18
20926 +#define BSD_SIGCONT 19
20927 +#define BSD_SIGCHLD 20
20928 +#define BSD_SIGTTIN 21
20929 +#define BSD_SIGTTOU 22
20930 +#define BSD_SIGIO 23
20931 +#define BSD_SIGXCPU 24
20932 +#define BSD_SIGXFSZ 25
20933 +#define BSD_SIGVTALRM 26
20934 +#define BSD_SIGPROF 27
20935 +#define BSD_SIGWINCH 28
20936 +#define BSD_SIGINFO 29
20937 +#define BSD_SIGUSR1 30
20938 +#define BSD_SIGUSR2 31
20939 diff -uNr --exclude-from=dontdiff linux-2.4.3/include/abi/socket.h linux/include/abi/socket.h
20940 --- linux-2.4.3/include/abi/socket.h Thu Jan 1 01:00:00 1970
20941 +++ linux/include/abi/socket.h Mon Mar 12 16:35:05 2001
20944 + * include/abi/socket.h
20946 + * Copyright (C) 1994 Mike Jagdis (jaggy@purplet.demon.co.uk)
20952 +/* Linux spells this differently. */
20953 +#define SO_ACCEPTCONN SO_ACCEPTCON
20955 +/* These aren't (currently) defined by Linux. Watch out for warnings
20956 + * about redefinitions...
20958 +#define SO_USELOOPBACK 0xff02
20959 +#define SO_ORDREL 0xff03
20960 +#define SO_IMASOCKET 0xff04
20961 +#define SO_PROTOTYPE 0xff09
20962 diff -uNr --exclude-from=dontdiff linux-2.4.3/include/abi/socksys.h linux/include/abi/socksys.h
20963 --- linux-2.4.3/include/abi/socksys.h Thu Jan 1 01:00:00 1970
20964 +++ linux/include/abi/socksys.h Mon Mar 12 16:35:05 2001
20967 + * include/abi/socksys.h
20969 + * Copyright (C) 1994 Mike Jagdis (jaggy@purplet.demon.co.uk)
20975 +/* Interface to /dev/socksys as used for streams based TCP/IP in SYSV */
20977 +/* Get struct rtentry from linux/route.h - this should be compatible. */
20978 +#include <linux/route.h>
20980 +/* Get struct arpreq from linux/if_arp.h - this should be compatible. */
20981 +#include <linux/netdevice.h>
20982 +#include <linux/if_arp.h>
20984 +/* Get struct ifreq and struct ifconf from linux/if.h - these should
20987 +#include <linux/if.h>
20990 +struct socksysreq {
20995 +struct socknewproto {
20996 + int family; /* address family (AF_INET, etc.) */
20997 + int type; /* protocol type (SOCK_STREAM, etc.) */
20998 + int proto; /* per family proto number */
20999 + dev_t dev; /* major/minor to use (must be a clone) */
21000 + int flags; /* protosw flags */
21004 +/* These are nothing to do with what we know as SO_*. I think they
21005 + * are the command requests which appear in socksysreq structures?
21007 +#define SSYS_SO_ACCEPT 1
21008 +#define SSYS_SO_BIND 2
21009 +#define SSYS_SO_CONNECT 3
21010 +#define SSYS_SO_GETPEERNAME 4
21011 +#define SSYS_SO_GETSOCKNAME 5
21012 +#define SSYS_SO_GETSOCKOPT 6
21013 +#define SSYS_SO_LISTEN 7
21014 +#define SSYS_SO_RECV 8
21015 +#define SSYS_SO_RECVFROM 9
21016 +#define SSYS_SO_SEND 10
21017 +#define SSYS_SO_SENDTO 11
21018 +#define SSYS_SO_SETSOCKOPT 12
21019 +#define SSYS_SO_SHUTDOWN 13
21020 +#define SSYS_SO_SOCKET 14
21021 +#define SSYS_SO_SELECT 15
21022 +#define SSYS_SO_GETIPDOMAIN 16
21023 +#define SSYS_SO_SETIPDOMAIN 17
21024 +#define SSYS_SO_ADJTIME 18
21025 +#define SSYS_SO_SETREUID 19
21026 +#define SSYS_SO_SETREGID 20
21027 +#define SSYS_SO_GETTIME 21
21028 +#define SSYS_SO_SETTIME 22
21029 +#define SSYS_SO_GETITIMER 23
21030 +#define SSYS_SO_SETITIMER 24
21031 +#define SSYS_SO_RECVMSG 25 /* Here down is SCO 3.2v5 and up */
21032 +#define SSYS_SO_SENDMSG 26
21033 +#define SSYS_SO_SOCKPAIR 27
21036 +/* We encode the ioctl numbers using the argument size as part of
21037 + * the number. This will warn us if we haven't got compatible
21038 + * structures :-).
21039 + * Naturally the SVR3/Lachman ioctl numbers are different from the
21040 + * BSD/SVR4-XTI ioctl numbers. What more would you expect?
21043 +#define SSYS_IOCPARM_MASK 0xff /* parameters must be < 256 bytes */
21044 +#define SSYS_IOC_VOID 0x20000000 /* no parameters */
21045 +#define SSYS_IOC_OUT 0x40000000 /* copy out parameters */
21046 +#define SSYS_IOC_IN 0x80000000 /* copy in parameters */
21047 +#define SSYS_IOC_INOUT (SSYS_IOC_IN|SSYS_IOC_OUT)
21049 +#define SSYS_IOS(x,y) (SSYS_IOC_VOID|(x<<8)|y)
21050 +#define SSYS_IOSR(x,y,t) (SSYS_IOC_OUT|((sizeof(t)&SSYS_IOCPARM_MASK)<<16)|(x<<8)|y)
21051 +#define SSYS_IOSW(x,y,t) (SSYS_IOC_IN|((sizeof(t)&SSYS_IOCPARM_MASK)<<16)|(x<<8)|y)
21052 +#define SSYS_IOSWR(x,y,t) (SSYS_IOC_INOUT|((sizeof(t)&SSYS_IOCPARM_MASK)<<16)|(x<<8)|y)
21054 +#define SSYS_SIOCSHIWAT SSYS_IOSW('S', 1, int) /* set high watermark */
21055 +#define SSYS_SIOCGHIWAT SSYS_IOSR('S', 2, int) /* get high watermark */
21056 +#define SSYS_SIOCSLOWAT SSYS_IOSW('S', 3, int) /* set low watermark */
21057 +#define SSYS_SIOCGLOWAT SSYS_IOSR('S', 4, int) /* get low watermark */
21058 +#define SSYS_SIOCATMARK SSYS_IOSR('S', 5, int) /* at oob mark? */
21059 +#define SSYS_SIOCSPGRP SSYS_IOSW('S', 6, int) /* set process group */
21060 +#define SSYS_SIOCGPGRP SSYS_IOSR('S', 7, int) /* get process group */
21063 +#define SSYS_FIONREAD SSYS_IOSR('S', 8, int) /* BSD compatibilty */
21064 +#define SSYS_FIONBIO SSYS_IOSW('S', 9, int) /* BSD compatibilty */
21065 +#define SSYS_FIOASYNC SSYS_IOSW('S', 10, int) /* BSD compatibilty */
21066 +#define SSYS_SIOCPROTO SSYS_IOSW('S', 11, struct socknewproto) /* link proto */
21067 +#define SSYS_SIOCGETNAME SSYS_IOSR('S', 12, struct sockaddr) /* getsockname */
21068 +#define SSYS_SIOCGETPEER SSYS_IOSR('S', 13, struct sockaddr) /* getpeername */
21069 +#define SSYS_IF_UNITSEL SSYS_IOSW('S', 14, int) /* set unit number */
21070 +#define SSYS_SIOCXPROTO SSYS_IOS('S', 15) /* empty proto table */
21072 +#define SSYS_SIOCADDRT SSYS_IOSW('R', 9, struct rtentry) /* add route */
21073 +#define SSYS_SIOCDELRT SSYS_IOSW('R', 10, struct rtentry) /* delete route */
21075 +#define SSYS_SIOCSIFADDR SSYS_IOSW('I', 11, struct ifreq) /* set ifnet address */
21076 +#define SSYS_SIOCGIFADDR SSYS_IOSWR('I', 12, struct ifreq) /* get ifnet address */
21077 +#define SSYS_SIOCSIFDSTADDR SSYS_IOSW('I', 13, struct ifreq) /* set p-p address */
21078 +#define SSYS_SIOCGIFDSTADDR SSYS_IOSWR('I', 14, struct ifreq) /* get p-p address */
21079 +#define SSYS_SIOCSIFFLAGS SSYS_IOSW('I', 15, struct ifreq) /* set ifnet flags */
21080 +#define SSYS_SIOCGIFFLAGS SSYS_IOSWR('I', 16, struct ifreq) /* get ifnet flags */
21081 +#define SSYS_SIOCGIFCONF SSYS_IOSWR('I', 17, struct ifconf) /* get ifnet list */
21083 +#define SSYS_SIOCSIFMTU SSYS_IOSW('I', 21, struct ifreq) /* get if_mtu */
21084 +#define SSYS_SIOCGIFMTU SSYS_IOSWR('I', 22, struct ifreq) /* set if_mtu */
21086 +#define SSYS_SIOCIFDETACH SSYS_IOSW('I', 26, struct ifreq) /* detach interface */
21087 +#define SSYS_SIOCGENPSTATS SSYS_IOSWR('I', 27, struct ifreq) /* get ENP stats */
21089 +#define SSYS_SIOCX25XMT SSYS_IOSWR('I', 29, struct ifreq) /* start a slp proc in
21091 +#define SSYS_SIOCX25RCV SSYS_IOSWR('I', 30, struct ifreq) /* start a slp proc in
21093 +#define SSYS_SIOCX25TBL SSYS_IOSWR('I', 31, struct ifreq) /* xfer lun table to
21096 +#define SSYS_SIOCGIFBRDADDR SSYS_IOSWR('I', 32, struct ifreq) /* get broadcast addr */
21097 +#define SSYS_SIOCSIFBRDADDR SSYS_IOSW('I', 33, struct ifreq) /* set broadcast addr */
21098 +#define SSYS_SIOCGIFNETMASK SSYS_IOSWR('I', 34, struct ifreq) /* get net addr mask */
21099 +#define SSYS_SIOCSIFNETMASK SSYS_IOSW('I', 35, struct ifreq) /* set net addr mask */
21100 +#define SSYS_SIOCGIFMETRIC SSYS_IOSWR('I', 36, struct ifreq) /* get IF metric */
21101 +#define SSYS_SIOCSIFMETRIC SSYS_IOSW('I', 37, struct ifreq) /* set IF metric */
21103 +#define SSYS_SIOCSARP SSYS_IOSW('I', 38, struct arpreq) /* set arp entry */
21104 +#define SSYS_SIOCGARP SSYS_IOSWR('I', 39, struct arpreq) /* get arp entry */
21105 +#define SSYS_SIOCDARP SSYS_IOSW('I', 40, struct arpreq) /* delete arp entry */
21107 +#define SSYS_SIOCSIFNAME SSYS_IOSW('I', 41, struct ifreq) /* set interface name */
21108 +#define SSYS_SIOCGIFONEP SSYS_IOSWR('I', 42, struct ifreq) /* get one-packet params */
21109 +#define SSYS_SIOCSIFONEP SSYS_IOSW('I', 43, struct ifreq) /* set one-packet params */
21111 +#define SSYS_SIOCGENADDR SSYS_IOSWR('I', 65, struct ifreq) /* Get ethernet addr */
21113 +#define SSYS_SIOCSOCKSYS SSYS_IOSW('I', 66, struct socksysreq) /* Pseudo socket syscall */
21116 +#define SVR4_SIOCSHIWAT SSYS_IOSW('s', 0, int) /* set high watermark */
21117 +#define SVR4_SIOCGHIWAT SSYS_IOSR('s', 1, int) /* get high watermark */
21118 +#define SVR4_SIOCSLOWAT SSYS_IOSW('s', 2, int) /* set low watermark */
21119 +#define SVR4_SIOCGLOWAT SSYS_IOSR('s', 3, int) /* get low watermark */
21120 +#define SVR4_SIOCATMARK SSYS_IOSR('s', 7, int) /* at oob mark? */
21121 +#define SVR4_SIOCSPGRP SSYS_IOSW('s', 8, int) /* set process group */
21122 +#define SVR4_SIOCGPGRP SSYS_IOSR('s', 9, int) /* get process group */
21124 +#define SVR4_SIOCADDRT SSYS_IOSW('r', 10, struct rtentry) /* add route */
21125 +#define SVR4_SIOCDELRT SSYS_IOSW('r', 11, struct rtentry) /* delete route */
21127 +#define SVR4_SIOCSIFADDR SSYS_IOSW('i', 12, struct ifreq) /* set ifnet address */
21128 +#define SVR4_SIOCGIFADDR SSYS_IOSWR('i',13, struct ifreq) /* get ifnet address */
21129 +#define SVR4_SIOCSIFDSTADDR SSYS_IOSW('i', 14, struct ifreq) /* set p-p address */
21130 +#define SVR4_SIOCGIFDSTADDR SSYS_IOSWR('i',15, struct ifreq) /* get p-p address */
21131 +#define SVR4_SIOCSIFFLAGS SSYS_IOSW('i', 16, struct ifreq) /* set ifnet flags */
21132 +#define SVR4_SIOCGIFFLAGS SSYS_IOSWR('i',17, struct ifreq) /* get ifnet flags */
21133 +#define SVR4_SIOCSIFMEM SSYS_IOSW('i', 18, struct ifreq) /* set interface mem */
21134 +#define SVR4_SIOCGIFMEM SSYS_IOSWR('i',19, struct ifreq) /* get interface mem */
21135 +#define SVR4_SIOCGIFCONF SSYS_IOSWR('i',20, struct ifconf) /* get ifnet list */
21136 +#define SVR4_SIOCSIFMTU SSYS_IOSW('i', 21, struct ifreq) /* set if_mtu */
21137 +#define SVR4_SIOCGIFMTU SSYS_IOSWR('i',22, struct ifreq) /* get if_mtu */
21139 + /* from 4.3BSD */
21140 +#define SVR4_SIOCGIFBRDADDR SSYS_IOSWR('i',23, struct ifreq) /* get broadcast addr */
21141 +#define SVR4_SIOCSIFBRDADDR SSYS_IOSW('i',24, struct ifreq) /* set broadcast addr */
21142 +#define SVR4_SIOCGIFNETMASK SSYS_IOSWR('i',25, struct ifreq) /* get net addr mask */
21143 +#define SVR4_SIOCSIFNETMASK SSYS_IOSW('i',26, struct ifreq) /* set net addr mask */
21144 +#define SVR4_SIOCGIFMETRIC SSYS_IOSWR('i',27, struct ifreq) /* get IF metric */
21145 +#define SVR4_SIOCSIFMETRIC SSYS_IOSW('i',28, struct ifreq) /* set IF metric */
21147 +#define SVR4_SIOCSARP SSYS_IOSW('i', 30, struct arpreq) /* set arp entry */
21148 +#define SVR4_SIOCGARP SSYS_IOSWR('i',31, struct arpreq) /* get arp entry */
21149 +#define SVR4_SIOCDARP SSYS_IOSW('i', 32, struct arpreq) /* delete arp entry */
21150 +#define SVR4_SIOCUPPER SSYS_IOSW('i', 40, struct ifreq) /* attach upper layer */
21151 +#define SVR4_SIOCLOWER SSYS_IOSW('i', 41, struct ifreq) /* attach lower layer */
21152 +#define SVR4_SIOCSETSYNC SSYS_IOSW('i', 44, struct ifreq) /* set syncmode */
21153 +#define SVR4_SIOCGETSYNC SSYS_IOSWR('i', 45, struct ifreq) /* get syncmode */
21154 +#define SVR4_SIOCSSDSTATS SSYS_IOSWR('i', 46, struct ifreq) /* sync data stats */
21155 +#define SVR4_SIOCSSESTATS SSYS_IOSWR('i', 47, struct ifreq) /* sync error stats */
21157 +#define SVR4_SIOCSPROMISC SSYS_IOSW('i', 48, int) /* request promisc mode
21159 +#define SVR4_SIOCADDMULTI SSYS_IOSW('i', 49, struct ifreq) /* set m/c address */
21160 +#define SVR4_SIOCDELMULTI SSYS_IOSW('i', 50, struct ifreq) /* clr m/c address */
21162 +/* protocol i/o controls */
21163 +#define SVR4_SIOCSNIT SSYS_IOSW('p', 0, struct nit_ioc) /* set nit modes */
21164 +#define SVR4_SIOCGNIT SSYS_IOSWR('p', 1, struct nit_ioc) /* get nit modes */
21166 +/* STREAMS based socket emulation */
21168 +#define SVR4_SIOCPROTO SSYS_IOSW('s', 51, struct socknewproto) /* link proto */
21169 +#define SVR4_SIOCGETNAME SSYS_IOSR('s', 52, struct sockaddr) /* getsockname */
21170 +#define SVR4_SIOCGETPEER SSYS_IOSR('s', 53, struct sockaddr) /* getpeername */
21171 +#define SVR4_IF_UNITSEL SSYS_IOSW('s', 54, int) /* set unit number */
21172 +#define SVR4_SIOCXPROTO SSYS_IOS('s', 55) /* empty proto table */
21174 +#define SVR4_SIOCIFDETACH SSYS_IOSW('i', 56, struct ifreq) /* detach interface */
21175 +#define SVR4_SIOCGENPSTATS SSYS_IOSWR('i', 57, struct ifreq) /* get ENP stats */
21176 +#define SVR4_SIOCX25XMT SSYS_IOSWR('i', 59, struct ifreq) /* start a slp proc in
21178 +#define SVR4_SIOCX25RCV SSYS_IOSWR('i', 60, struct ifreq) /* start a slp proc in
21180 +#define SVR4_SIOCX25TBL SSYS_IOSWR('i', 61, struct ifreq) /* xfer lun table to
21182 +#define SVR4_SIOCSLGETREQ SSYS_IOSWR('i', 71, struct ifreq) /* wait for switched
21183 + * SLIP request */
21184 +#define SVR4_SIOCSLSTAT SSYS_IOSW('i', 72, struct ifreq) /* pass SLIP info to
21186 +#define SVR4_SIOCSIFNAME SSYS_IOSW('i', 73, struct ifreq) /* set interface name */
21187 +#define SVR4_SIOCGENADDR SSYS_IOSWR('i', 85, struct ifreq) /* Get ethernet addr */
21188 +#define SVR4_SIOCSOCKSYS SSYS_IOSW('i', 86, struct socksysreq) /* Pseudo socket syscall */
21192 +/* Strange, there also seem to be two byte SVR4 ioctls used which are
21193 + * not simply the BSD style ioctl with the high word masked out. i.e the
21194 + * class character doesn't match what I expect.
21196 +#define SVRX_SIOCGIFCONF 0x8912
21197 +#define SVRX_SIOCGIFFLAGS 0x8913
21201 +/* With NFS/NIS there is also a pseudo device /dev/nfsd which understands
21202 + * some ioctls. Since these don't conflict with the socksys ioctls we
21203 + * just link nfsd to socksys and let socksys handle both sets.
21205 +#define NIOCNFSD 1
21206 +#define NIOCOLDGETFH 2
21207 +#define NIOCASYNCD 3
21208 +#define NIOCSETDOMNAM 4
21209 +#define NIOCGETDOMNAM 5
21210 +#define NIOCCLNTHAND 6
21211 +#define NIOCEXPORTFS 7
21212 +#define NIOCGETFH 8
21213 +#define NIOCLSTAT 9
21215 +/* These ioctls take argument structures... */
21216 +struct domnam_args {
21221 +struct lstat_args {
21226 +#define NFS_FHSIZE 32
21229 + unsigned short fsid; /* filesystem id (device) */
21230 + unsigned long fno; /* file number (inode) */
21231 + unsigned long fgen; /* file generation */
21232 + unsigned short ex_fsid; /* exported fs id (device) */
21233 + unsigned long ex_fno; /* exported file no (inode) */
21234 + unsigned long ex_fgen; /* exported file gen */
21236 + char pad[NFS_FHSIZE];
21239 +struct getfh_args {
21243 diff -uNr --exclude-from=dontdiff linux-2.4.3/include/abi/solaris.h linux/include/abi/solaris.h
21244 --- linux-2.4.3/include/abi/solaris.h Thu Jan 1 01:00:00 1970
21245 +++ linux/include/abi/solaris.h Mon Mar 12 16:35:05 2001
21247 +#ifndef __IBCS_SOLX86_H__
21248 +#define __IBCS_SOLX86_H__
21250 +#include <abi/lfs.h>
21252 +typedef void svr4_ucontext_t;
21254 +int sol_llseek(struct pt_regs * regs);
21255 +int ibcs_memcntl(unsigned addr, unsigned len, int cmd, unsigned arg,
21256 + int attr, int mask);
21263 +#define GETACLCNT 3
21265 +int sol_acl(char *pathp, int cmd, int nentries, void *aclbufp);
21267 +#endif /* __ IBCS_SOLX86_H__ */
21268 diff -uNr --exclude-from=dontdiff linux-2.4.3/include/abi/stream.h linux/include/abi/stream.h
21269 --- linux-2.4.3/include/abi/stream.h Thu Jan 1 01:00:00 1970
21270 +++ linux/include/abi/stream.h Mon Mar 12 16:35:05 2001
21273 + * include/abi/stream.h
21275 + * Copyright (C) 1994 Mike Jagdis (jaggy@purplet.demon.co.uk)
21281 +#ifndef _IBCS_STREAM_H_
21282 +#define _IBCS_STREAM_H_
21284 +#define MSG_HIPRI 1
21285 +#define RS_HIPRI MSG_HIPRI
21287 +#define MSG_BAND 4
21290 +#define MOREDATA 2
21293 + int maxlen; /* size of buffer */
21294 + int len; /* number of bytes in buffer */
21295 + char *buf; /* pointer to buffer */
21298 +/* Used for the I_PEEK STREAMS ioctl. */
21300 + struct strbuf ctl;
21301 + struct strbuf dat;
21305 +/* Used for the I_FDINSERT STREAMS ioctl. */
21306 +struct strfdinsert {
21307 + struct strbuf ctlbuf;
21308 + struct strbuf datbuf;
21310 + unsigned int fildes;
21314 +extern int stream_fdinsert(struct pt_regs *regs, int fd,
21315 + struct strfdinsert *arg);
21318 diff -uNr --exclude-from=dontdiff linux-2.4.3/include/abi/svr4.h linux/include/abi/svr4.h
21319 --- linux-2.4.3/include/abi/svr4.h Thu Jan 1 01:00:00 1970
21320 +++ linux/include/abi/svr4.h Mon Mar 12 16:35:05 2001
21323 + * Function prototypes used for SVR4 emulation.
21328 +#include <linux/ptrace.h> /* for pt_regs */
21329 +#include <linux/sched.h>
21330 +#include <linux/signal.h>
21331 +#include <linux/unistd.h>
21334 +struct svr_termio {
21335 + unsigned short c_iflag;
21336 + unsigned short c_oflag;
21337 + unsigned short c_cflag;
21338 + unsigned short c_lflag;
21340 + unsigned char c_cc[SVR_NCC];
21343 +#define SVR4_NCCS (19)
21344 +struct svr4_termios {
21345 + unsigned long c_iflag;
21346 + unsigned long c_oflag;
21347 + unsigned long c_cflag;
21348 + unsigned long c_lflag;
21349 + unsigned char c_cc[SVR4_NCCS];
21353 +extern int svr4_ioctl_sockmod(int fd, unsigned int func, void *arg);
21356 +extern int svr4_getgroups(int n, unsigned long * buf);
21357 +extern int svr4_setgroups(int n, unsigned long * buf);
21358 +extern int svr4_waitsys(struct pt_regs * regs);
21359 +extern int svr4_seteuid(int uid);
21360 +extern int svr4_setegid(int gid);
21363 +extern int svr4_open(const char * fname, int flag, int mode);
21364 +extern int svr4_statfs(const char * path, struct ibcs_statfs * buf, int len, int fstype);
21365 +extern int svr4_fstatfs(unsigned int fd, struct ibcs_statfs * buf, int len, int fstype);
21366 +extern int svr4_getdents(int fd, char * buf, int nybtes);
21369 +extern int svr4_semsys(struct pt_regs * regs);
21370 +extern int svr4_shmsys(struct pt_regs * regs);
21371 +extern int svr4_msgsys(struct pt_regs * regs);
21374 +extern int svr4_getmsg(struct pt_regs *regs);
21375 +extern int svr4_putmsg(struct pt_regs *regs);
21376 +extern int svr4_getpmsg(struct pt_regs *regs);
21377 +extern int svr4_putpmsg(struct pt_regs *regs);
21380 +extern int svr4_ioctl_stream(struct pt_regs *regs, int fd, unsigned int func, void *arg);
21381 +extern int svr4_ioctl_termiox(int fd, unsigned int func, void *arg);
21384 +extern int svr4_sysfs(int cmd, int arg1, int arg2);
21387 +extern int svr4_sysinfo(int, char *, long);
21390 +extern int svr4_fxstat(int vers, int fd, void * buf);
21393 +extern int svr4_ulimit(int cmd, int val);
21394 +extern int svr4_getrlimit(int cmd, void *val);
21395 +extern int svr4_setrlimit(int cmd, void *val);
21403 +extern int svr4_poll(struct poll * ufds, size_t nfds, int timeout);
21406 +extern int svr4_hrtsys(struct pt_regs * regs);
21409 +extern int svr4_syslocal(struct pt_regs * regs);
21412 +extern int svr4_ptrace(int req, int pid, unsigned long addr, unsigned long data);
21415 +extern int svr4_fcntl(struct pt_regs *regs);
21418 +extern int svr4_mmap(unsigned int vaddr, unsigned int vsize, int prot,
21419 + int flags, int fd, unsigned int file_offset);
21422 +#define _CONFIG_NGROUPS 2 /* # configured supplemental groups */
21423 +#define _CONFIG_CHILD_MAX 3 /* max # of processes per uid session */
21424 +#define _CONFIG_OPEN_FILES 4 /* max # of open files per process */
21425 +#define _CONFIG_POSIX_VER 5 /* POSIX version */
21426 +#define _CONFIG_PAGESIZE 6 /* system page size */
21427 +#define _CONFIG_CLK_TCK 7 /* ticks per second */
21428 +#define _CONFIG_XOPEN_VER 8 /* XOPEN version */
21429 +#define _CONFIG_NACLS_MAX 9 /* for Enhanced Security */
21430 +#define _CONFIG_ARG_MAX 10 /* max length of exec args */
21431 +#define _CONFIG_NPROC 11 /* # processes system is config for */
21432 +#define _CONFIG_NENGINE 12 /* # configured processors (CPUs) */
21433 +#define _CONFIG_NENGINE_ONLN 13 /* # online processors (CPUs) */
21434 +#define _CONFIG_TOTAL_MEMORY 14 /* total memory */
21435 +#define _CONFIG_USEABLE_MEMORY 15 /* user + system memory */
21436 +#define _CONFIG_GENERAL_MEMORY 16 /* user only memory */
21437 +#define _CONFIG_DEDICATED_MEMORY 17 /* dedicated memory */
21438 +#define _CONFIG_NCGS_CONF 18 /* # CGs in system */
21439 +#define _CONFIG_NCGS_ONLN 19 /* # CGs online now */
21440 +#define _CONFIG_MAX_ENG_PER_CG 20 /* max engines per CG */
21441 +#define _CONFIG_CACHE_LINE 21 /* memory cache line size */
21442 +#define _CONFIG_SYSTEM_ID 22 /* system id assigned at ISL */
21443 +#define _CONFIG_KERNEL_VM 23 /* size of kernel virtual memory */
21444 +extern int svr4_sysconfig(int name);
21447 +extern int svr4_sysi86(struct pt_regs * regs);
21449 +/* svr4_funcs.c */
21450 +extern struct map_segment svr4_err_map[];
21451 +extern struct map_segment svr4_socktype_map[];
21452 +extern struct map_segment abi_sockopt_map[];
21453 +extern struct map_segment abi_af_map[];
21454 +extern long linux_to_ibcs_signals[];
21455 +extern long ibcs_to_linux_signals[];
21456 diff -uNr --exclude-from=dontdiff linux-2.4.3/include/abi/svr4sig.h linux/include/abi/svr4sig.h
21457 --- linux-2.4.3/include/abi/svr4sig.h Thu Jan 1 01:00:00 1970
21458 +++ linux/include/abi/svr4sig.h Mon Mar 12 16:35:05 2001
21460 +#ifndef __ABI_SVR4SIG_H__
21461 +#define __ABI_SVR4SIG_H__
21462 +typedef void (*svr4_sig_t)(int, void *, void *);
21470 diff -uNr --exclude-from=dontdiff linux-2.4.3/include/abi/tli.h linux/include/abi/tli.h
21471 --- linux-2.4.3/include/abi/tli.h Thu Jan 1 01:00:00 1970
21472 +++ linux/include/abi/tli.h Mon Mar 12 16:35:05 2001
21489 +/* Error codes used by TLI transport providers. */
21490 +#define TBADADDR 1
21495 +#define TOUTSTATE 6
21499 +#define TBADDATA 10
21500 +#define TBUFOVFLW 11
21502 +#define TNODATA 13
21504 +#define TNOUDERR 15
21505 +#define TBADFLAG 16
21507 +#define TNOTSUPPORT 18
21508 +#define TSTATECHNG 19
21511 +/* User level states (maintained internally by libnsl_s). */
21512 +#define T_UNINIT 0
21515 +#define T_OUTCON 3
21517 +#define T_DATAXFER 5
21518 +#define T_OUTREL 6
21523 +/* Kernel level states of a transport end point. */
21524 +#define TS_UNBND 0 /* unbound */
21525 +#define TS_WACK_BREQ 1 /* waiting for T_BIND_REQ ack */
21526 +#define TS_WACK_UREQ 2 /* waiting for T_UNBIND_REQ ack */
21527 +#define TS_IDLE 3 /* idle */
21528 +#define TS_WACK_OPTREQ 4 /* waiting for T_OPTMGMT_REQ ack */
21529 +#define TS_WACK_CREQ 5 /* waiting for T_CONN_REQ ack */
21530 +#define TS_WCON_CREQ 6 /* waiting for T_CONN_REQ confirmation */
21531 +#define TS_WRES_CIND 7 /* waiting for T_CONN_IND */
21532 +#define TS_WACK_CRES 8 /* waiting for T_CONN_RES ack */
21533 +#define TS_DATA_XFER 9 /* data transfer */
21534 +#define TS_WIND_ORDREL 10 /* releasing read but not write */
21535 +#define TS_WREQ_ORDREL 11 /* wait to release write but not read */
21536 +#define TS_WACK_DREQ6 12 /* waiting for T_DISCON_REQ ack */
21537 +#define TS_WACK_DREQ7 13 /* waiting for T_DISCON_REQ ack */
21538 +#define TS_WACK_DREQ9 14 /* waiting for T_DISCON_REQ ack */
21539 +#define TS_WACK_DREQ10 15 /* waiting for T_DISCON_REQ ack */
21540 +#define TS_WACK_DREQ11 16 /* waiting for T_DISCON_REQ ack */
21541 +#define TS_NOSTATES 17
21544 +/* Messages used by "timod". */
21545 +#define T_CONN_REQ 0
21546 +#define T_CONN_RES 1
21547 +#define T_DISCON_REQ 2
21548 +#define T_DATA_REQ 3
21549 +#define T_EXDATA_REQ 4
21550 +#define T_INFO_REQ 5
21551 +#define T_BIND_REQ 6
21552 +#define T_UNBIND_REQ 7
21553 +#define T_UNITDATA_REQ 8
21554 +#define T_OPTMGMT_REQ 9
21555 +#define T_ORDREL_REQ 10
21557 +#define T_CONN_IND 11
21558 +#define T_CONN_CON 12
21559 +#define T_DISCON_IND 13
21560 +#define T_DATA_IND 14
21561 +#define T_EXDATA_IND 15
21562 +#define T_INFO_ACK 16
21563 +#define T_BIND_ACK 17
21564 +#define T_ERROR_ACK 18
21565 +#define T_OK_ACK 19
21566 +#define T_UNITDATA_IND 20
21567 +#define T_UDERROR_IND 21
21568 +#define T_OPTMGMT_ACK 22
21569 +#define T_ORDREL_IND 23
21571 +/* Flags used from user level library routines. */
21572 +#define T_MORE 0x0001
21573 +#define T_EXPEDITED 0x0002
21574 +#define T_NEGOTIATE 0x0004
21575 +#define T_CHECK 0x0008
21576 +#define T_DEFAULT 0x0010
21577 +#define T_SUCCESS 0x0020
21578 +#define T_FAILURE 0x0040
21579 +#define T_CURRENT 0x0080
21580 +#define T_PARTSUCCESS 0x0100
21581 +#define T_READONLY 0x0200
21582 +#define T_NOTSUPPORT 0x0400
21585 +struct T_conn_req {
21586 + long PRIM_type; /* T_CONN_REQ */
21587 + long DEST_length;
21588 + long DEST_offset;
21593 +struct T_conn_res {
21594 + long PRIM_type; /* T_CONN_RES */
21601 +struct T_discon_req {
21602 + long PRIM_type; /* T_DISCON_REQ */
21606 +struct T_data_req {
21607 + long PRIM_type; /* T_DATA_REQ */
21611 +struct T_exdata_req {
21612 + long PRIM_type; /* T_EXDATA_REQ */
21616 +struct T_info_req {
21617 + long PRIM_type; /* T_INFO_REQ */
21620 +struct T_bind_req {
21621 + long PRIM_type; /* T_BIND_REQ */
21622 + long ADDR_length;
21623 + long ADDR_offset;
21624 + unsigned long CONIND_number;
21627 +struct T_unbind_req {
21628 + long PRIM_type; /* T_UNBIND_REQ */
21631 +struct T_unitdata_req {
21632 + long PRIM_type; /* T_UNITDATA_REQ */
21633 + long DEST_length;
21634 + long DEST_offset;
21639 +struct T_optmgmt_req {
21640 + long PRIM_type; /* T_OPTMGMT_REQ */
21646 +struct T_ordrel_req {
21647 + long PRIM_type; /* T_ORDREL_REQ */
21651 +struct T_conn_ind {
21652 + long PRIM_type; /* T_CONN_IND */
21660 +struct T_conn_con {
21661 + long PRIM_type; /* T_CONN_CON */
21668 +struct T_discon_ind {
21669 + long PRIM_type; /* T_DISCON_IND */
21670 + long DISCON_reason;
21674 +struct T_data_ind {
21675 + long PRIM_type; /* T_DATA_IND */
21679 +struct T_exdata_ind {
21680 + long PRIM_type; /* T_EXDATA_IND */
21684 +/* information acknowledgment */
21686 +struct T_info_ack {
21687 + long PRIM_type; /* T_INFO_ACK */
21696 + long CURRENT_state;
21697 + long PROVIDER_flag;
21700 +struct T_bind_ack {
21701 + long PRIM_type; /* T_BIND_ACK */
21702 + long ADDR_length;
21703 + long ADDR_offset;
21704 + unsigned long CONIND_number;
21707 +struct T_error_ack {
21708 + long PRIM_type; /* T_ERROR_ACK */
21715 + long PRIM_type; /* T_OK_ACK */
21716 + long CORRECT_prim;
21719 +struct T_unitdata_ind {
21720 + long PRIM_type; /* T_UNITDATA_IND */
21727 +struct T_uderror_ind {
21728 + long PRIM_type; /* T_UDERROR_IND */
21729 + long DEST_length;
21730 + long DEST_offset;
21736 +struct T_optmgmt_ack {
21737 + long PRIM_type; /* T_OPTMGMT_ACK */
21743 +struct T_ordrel_ind {
21744 + long PRIM_type; /* T_ORDREL_IND */
21748 +union T_primitives {
21750 + struct T_conn_req conn_req;
21751 + struct T_conn_res conn_res;
21752 + struct T_discon_req discon_req;
21753 + struct T_data_req data_req;
21754 + struct T_exdata_req exdata_req;
21755 + struct T_info_req info_req;
21756 + struct T_bind_req bind_req;
21757 + struct T_unbind_req unbind_req;
21758 + struct T_unitdata_req unitdata_req;
21759 + struct T_optmgmt_req optmgmt_req;
21760 + struct T_ordrel_req ordrel_req;
21761 + struct T_conn_ind conn_ind;
21762 + struct T_conn_con conn_con;
21763 + struct T_discon_ind discon_ind;
21764 + struct T_data_ind data_ind;
21765 + struct T_exdata_ind exdata_ind;
21766 + struct T_info_ack info_ack;
21767 + struct T_bind_ack bind_ack;
21768 + struct T_error_ack error_ack;
21769 + struct T_ok_ack ok_ack;
21770 + struct T_unitdata_ind unitdata_ind;
21771 + struct T_uderror_ind uderror_ind;
21772 + struct T_optmgmt_ack optmgmt_ack;
21773 + struct T_ordrel_ind ordrel_ind;
21777 +/* The t_opthdr structure defines the layout of options in a T_OPTMGMT_*
21778 + * data buffer. This is specified in the X/Open specs but does not
21779 + * appear to exist in SCO 3.2.x, SCO OS5, Interactive SVR4 or UnixWare 1.x.
21780 + * There are programs that make options request however.
21781 + * The older TLI uses struct opthdr which is different and incompatible
21785 + unsigned long len; /* *Total* length including header */
21786 + unsigned long level;
21787 + unsigned long name;
21788 + unsigned long status;
21789 + char value[0]; /* and onwards... */
21795 + long len; /* Length of option value */
21796 + char value[0]; /* and onwards... */
21801 + struct T_primsg *next;
21802 + unsigned char pri;
21803 + unsigned char band;
21808 +#define XTI_MAGIC 638654838
21810 +struct T_private {
21814 + struct T_primsg *pfirst, *plast;
21817 +#define Priv(file) ((struct T_private *)(file->private_data))
21819 +extern int timod_ioctl(struct pt_regs *, int, unsigned int, void *, int, int *);
21820 +extern int timod_putmsg(int, struct inode *, int, struct pt_regs *);
21821 +extern int timod_getmsg(int, struct inode *, int, struct pt_regs *);
21822 +extern int timod_update_socket(int, struct file *, struct pt_regs *);
21824 +#endif /* __TLI_H */
21825 diff -uNr --exclude-from=dontdiff linux-2.4.3/include/abi/trace.h linux/include/abi/trace.h
21826 --- linux-2.4.3/include/abi/trace.h Thu Jan 1 01:00:00 1970
21827 +++ linux/include/abi/trace.h Fri Mar 30 15:23:49 2001
21830 + * Copyright (c) 2001 Christoph Hellwig.
21831 + * All rights resered.
21833 + * This program is free software; you can redistribute it and/or modify
21834 + * it under the terms of the GNU General Public License as published by
21835 + * the Free Software Foundation; either version 2 of the License, or
21836 + * (at your option) any later version.
21838 + * This program is distributed in the hope that it will be useful,
21839 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
21840 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21841 + * GNU General Public License for more details.
21843 + * You should have received a copy of the GNU General Public License
21844 + * along with this program; if not, write to the Free Software
21845 + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21849 +#ifndef _ABI_TRACE_H_
21850 +#define _ABI_TRACE_H_
21853 + * Linux-ABI tracing helpers.
21855 +#include <linux/config.h>
21856 +#include <linux/types.h>
21860 + * The currently executed syscall.
21862 +extern ABI_func * abi_current;
21865 + * Check if a syscall needs tracing.
21867 +#define abi_traced(res) ((abi_traceflg & (res)) || (abi_current->trace))
21870 + * Possible flags for abi_traceflg.
21872 +#define ABI_TRACE_API 0x00000001 /* all call/return values */
21873 +#define ABI_TRACE_IOCTL 0x00000002 /* all ioctl calls */
21874 +#define ABI_TRACE_IOCTL_F 0x00000004 /* ioctl calls that fail */
21875 +#define ABI_TRACE_SIGNAL 0x00000008 /* all signal calls */
21876 +#define ABI_TRACE_SIGNAL_F 0x00000010 /* signal calls that fail */
21877 +#define ABI_TRACE_SOCKSYS 0x00000020 /* socksys and spx devices */
21878 +#define ABI_TRACE_COFF_LD 0x00000040 /* COFF loader */
21879 +#define ABI_TRACE_ELF_LD 0x00000080 /* ELF loader */
21880 +#define ABI_TRACE_XOUT_LD 0x00000100 /* XOUT loader */
21881 +#define ABI_TRACE_XOUT_DB 0x00000200 /* XOUT loader before launch */
21882 +#define ABI_TRACE_STREAMS 0x00000400 /* STREAMS faking */
21883 +#define ABI_TRACE_FUNC 0x10000000 /* trace this function */
21885 +extern u_int abi_traceflg;
21887 +#define __abi_trace(fmt...) \
21888 + printk(KERN_DEBUG "[%s:%d]: ", current->comm, current->pid); \
21891 +#define abi_trace(reason, fmt...) \
21892 + { if (abi_traced(reason)) __abi_trace(fmt); }
21894 +#endif /* _ABI_TRACE_H_ */
21895 diff -uNr --exclude-from=dontdiff linux-2.4.3/include/abi/unused-termios.h linux/include/abi/unused-termios.h
21896 --- linux-2.4.3/include/abi/unused-termios.h Thu Jan 1 01:00:00 1970
21897 +++ linux/include/abi/unused-termios.h Mon Mar 12 16:35:05 2001
21900 + * This file was entered from the book
21901 + * Intel386 Family Binary Compatability Specification 2
21902 + * McGraw-Hill Book company
21903 + * ISBN 0-07-031219-2
21912 +typedef unsigned short tcflag_t;
21913 +typesef unsigned char cc_t;
21914 +typedef unsigned long speed_t;
21917 + unsigned short c_iflag;
21918 + unsigned short c_oflag;
21919 + unsigned short c_cflag;
21920 + unsigned short c_lflag;
21922 + unsigned char c_cc[NC];
21926 + tcflag_t c_iflag;
21927 + tcflag_t c_oflag;
21928 + tcflag_t c_cflag;
21929 + tcflag_t c_lflag;
21953 +#define CINTR 0177
21955 +#define CERASE '#'
21957 +#define CSTART 021
21959 +#define CSWTCH 032
21963 +#define IGNBRK 0000001
21964 +#define BRKINT 0000002
21965 +#define IGNPAR 0000004
21966 +#define PARMRK 0000010
21967 +#define INPCK 0000020
21968 +#define ISTRIP 0000040
21969 +#define INLCR 0000100
21970 +#define IGNCR 0000200
21971 +#define ICRNL 0000400
21972 +#define IUCLC 0001000
21973 +#define IXON 0002000
21974 +#define IXANY 0004000
21975 +#define IXOFF 0010000
21976 +#define IMAXBEL 0020000 /* RESERVED */
21977 +#define DOSMODE 0100000
21979 +#define OPOST 00000001
21980 +#define OLCUC 00000002
21981 +#define ONLCR 00000004
21982 +#define OCRNL 00000010
21983 +#define ONOCR 00000020
21984 +#define ONLRET 00000040
21985 +#define OFILL 00000100
21986 +#define OFDEL 00000200
21987 +#define NLDLY 00000400
21989 +#define NL1 00000400
21990 +#define CRDLY 00003000
21992 +#define CR1 00001000
21993 +#define CR2 00002000
21994 +#define CR3 00003000
21995 +#define TABDLY 00014000
21997 +#define TAB1 00004000
21998 +#define TAB2 00010000
21999 +#define TAB3 00014000
22000 +#define BSDLY 00200000
22002 +#define BS1 00200000
22003 +#define VTDLY 00400000
22005 +#define VT1 00400000
22006 +#define FFDLY 01000000
22008 +#define FF1 01000000
22010 +#define CBAUD 0000017
22011 +#define CSIZE 0000060
22013 +#define CS6 0000020
22014 +#define CS7 0000040
22015 +#define CS8 0000060
22016 +#define CSTOPB 0000100
22017 +#define CREAD 0000200
22018 +#define PARENB 0000400
22019 +#define PARODD 0001000
22020 +#define HUPCL 0002000
22021 +#define CLOCAL 0004000
22022 +#define RCV1EN 0010000
22023 +#define XMT1EN 0020000
22024 +#define LOBLK 0040000
22025 +#define XCLUDE 0100000
22027 +#define ISIG 0000001
22028 +#define ICANON 0000002
22029 +#define XCASE 0000004
22030 +#define ECHO 0000010
22031 +#define ECHOE 0000020
22032 +#define ECHOK 0000040
22033 +#define ECHONL 0000100
22034 +#define NOFLSH 0000200
22035 +#define IEXTEN 0000400
22036 +#defien TOSTOP 0001000
22038 +/* Bits 10-15 (0176000) in the c_lflag field are RESERVED */
22041 +#define XIOC ('x'<<8) Level 2
22043 +#define XIOC (('i'<<8)|('X'<<16))
22044 +#define XCGETA (XIOC|1)
22045 +#define XCSETA (XIOC|2)
22046 +#define XCSETAW (XIOC|3)
22047 +#define XCSETAF (XIOC|4)
22049 +#define TIOC ('T'<<8)
22051 +#define TCGETA (TIOC|1)
22052 +#define TCSETA (TIOC|2)
22053 +#define TCSETAW (TIOC|3)
22054 +#define TCSETAF (TIOC|4)
22055 +#define TCSBRK (TIOC|5)
22056 +#define TCXONC (TIOC|6)
22057 +#define TCFLSH (TIOC|7)
22059 +#define TIOCGWINSZ (TIOC|104)
22060 +#define TIOCSWINSZ (TIOC|103)
22062 +#define TCSANOW XCSETA
22063 +#define TCSADRAIN XCSETAW
22064 +#define TCSAFLUSH XCSETAF
22065 +#define TCSADFLUSH XCSETAF
22067 +#define TCIFLUSH 0
22068 +#define TCOFLUSH 1
22069 +#define TCIOFLUSH 2
22094 + unsigned short ws_row;
22095 + unsigned short ws_col;
22096 + unsigned short ws_xpixel;
22097 + unsigned short ws_ypixel;
22099 diff -uNr --exclude-from=dontdiff linux-2.4.3/include/abi/uw7.h linux/include/abi/uw7.h
22100 --- linux-2.4.3/include/abi/uw7.h Thu Jan 1 01:00:00 1970
22101 +++ linux/include/abi/uw7.h Mon Mar 12 16:35:05 2001
22103 +#ifndef __ABI_UW7_H__
22104 +#define __ABI_UW7_H__
22110 +#define GETACLCNT 3
22118 +#define UW7_NCCS (19)
22119 +struct uw7_termios {
22120 + unsigned long c_iflag;
22121 + unsigned long c_oflag;
22122 + unsigned long c_cflag;
22123 + unsigned long c_lflag;
22124 + unsigned char c_cc[UW7_NCCS];
22127 +extern int uw7_acl(char * path, int cmd, int nentries, struct acl * aclp);
22130 +extern int uw7_access(char * path, int mode);
22133 +extern int uw7_sleep(int seconds);
22134 +extern int uw7_seteuid(int uid);
22135 +extern int uw7_setegid(int gid);
22136 +extern int uw7_pread(unsigned int fd, char * buf, int count, long off);
22137 +extern int uw7_pwrite(unsigned int fd, char * buf, int count, long off);
22138 +extern int uw7_lseek64(unsigned int fd, unsigned int off,
22139 + unsigned int off_hi, unsigned int orig);
22140 +extern int uw7_pread64(unsigned int fd, char * buf, int count,
22141 + unsigned int off_hi, unsigned int off);
22142 +extern int uw7_pwrite64(unsigned int fd, char * buf, int count,
22143 + unsigned int off_hi, unsigned int off);
22144 +extern int uw7_stty(int fd, int cmd);
22145 +extern int uw7_gtty(int fd, int cmd);
22148 +extern int uw7_proc_init(void);
22149 +extern void uw7_proc_cleanup(void);
22152 +extern int uw7_ioctl(struct pt_regs * regs);
22155 +extern int uw7_mldmode(int mldmode);
22157 +struct uw7_statvfs64 {
22158 + unsigned long f_bsize;
22159 + unsigned long f_frsize;
22160 + unsigned long long f_blocks;
22161 + unsigned long long f_bfree;
22162 + unsigned long long f_bavail;
22163 + unsigned long long f_files;
22164 + unsigned long long f_ffree;
22165 + unsigned long long f_favail;
22166 + unsigned long f_fsid;
22167 + char f_basetype[16];
22168 + unsigned long f_flag;
22169 + unsigned long f_namemax;
22171 + unsigned long f_filler[16];
22174 +extern int uw7_statvfs64(char * filename, struct uw7_statvfs64 * buf);
22175 +extern int uw7_fstatvfs64(int fd, struct uw7_statvfs64 * buf);
22177 +/* the other MAP_XXX values are the same as on Linux/i386 */
22178 +#define UW7_MAP_ANONYMOUS 0x100
22180 +extern int uw7_mmap(unsigned long, unsigned long, unsigned long, unsigned long,
22181 + unsigned long, unsigned long);
22183 +#endif /* __KERNEL__ */
22184 +#endif /* __ABI_UW7_H__ */
22185 diff -uNr --exclude-from=dontdiff linux-2.4.3/include/abi/uw7_context.h linux/include/abi/uw7_context.h
22186 --- linux-2.4.3/include/abi/uw7_context.h Thu Jan 1 01:00:00 1970
22187 +++ linux/include/abi/uw7_context.h Mon Mar 12 16:35:05 2001
22189 +#ifndef __ABI_UW7_CONTEXT_H__
22190 +#define __ABI_UW7_CONTEXT_H__
22194 +/* ss_size <-> ss_flags which is why we can't use native Linux stack_t :( */
22195 +typedef struct uw7_stack {
22201 +/* XXX more registers, please */
22202 +typedef struct uw7_mcontext {
22203 + unsigned short gs, __gsh;
22204 + unsigned short fs, __fsh;
22205 + unsigned short es, __esh;
22206 + unsigned short ds, __dsh;
22209 +typedef struct uw7_sigset {
22210 + unsigned int sigbits[4];
22213 +typedef struct uw7_context {
22214 + unsigned long uc_flags;
22215 + struct uw7_context *uc_link;
22216 + uw7_sigset_t uc_sigmask;
22217 + uw7_stack_t uc_stack;
22218 + uw7_mcontext_t uc_mcontext;
22220 + char uc_unused[16];
22223 +#define UW7_GETCONTEXT 0
22224 +#define UW7_SETCONTEXT 1
22225 +#define UW7_GETXCONTEXT 2
22229 +extern int uw7_context(struct pt_regs * regs);
22230 +extern int uw7_sigaltstack(const uw7_stack_t *ss, uw7_stack_t *oss);
22232 +#endif /* __KERNEL__ */
22233 +#endif /* __ABI_UW7_CONTEXT_H__ */
22234 diff -uNr --exclude-from=dontdiff linux-2.4.3/include/abi/uw7_termbits.h linux/include/abi/uw7_termbits.h
22235 --- linux-2.4.3/include/abi/uw7_termbits.h Thu Jan 1 01:00:00 1970
22236 +++ linux/include/abi/uw7_termbits.h Mon Mar 12 16:35:05 2001
22238 +#ifndef __ABI_UW7_TERMBITS_H__
22239 +#define __ABI_UW7_TERMBITS_H__
22243 +#define UW7_TIOC ('T'<<8)
22244 +#define UW7_TCGETA (UW7_TIOC|1)
22245 +#define UW7_TCSETA (UW7_TIOC|2)
22246 +#define UW7_TCSETAW (UW7_TIOC|3)
22247 +#define UW7_TCSETAF (UW7_TIOC|4)
22248 +#define UW7_TCSBRK (UW7_TIOC|5)
22249 +#define UW7_TCXONC (UW7_TIOC|6)
22250 +#define UW7_TCFLSH (UW7_TIOC|7)
22251 +#define UW7_TCDSET (UW7_TIOC|32)
22252 +#define UW7_RTS_TOG (UW7_TIOC|33)
22253 +#define UW7_TIOCGWINSZ (UW7_TIOC|104)
22254 +#define UW7_TIOCSWINSZ (UW7_TIOC|103)
22255 +#define UW7_TCGETS (UW7_TIOC|13)
22256 +#define UW7_TCSETS (UW7_TIOC|14)
22257 +#define UW7_TCSANOW UW7_TCSETS
22258 +#define UW7_TCSETSW (UW7_TIOC|15)
22259 +#define UW7_TCSADRAIN UW7_TCSETSW
22260 +#define UW7_TCSETSF (UW7_TIOC|16)
22261 +#define UW7_TCSAFLUSH UW7_TCSETSF
22264 + * VEOF/VEOL and VMIN/VTIME are overloaded.
22265 + * VEOF/VEOL are used in canonical mode (ICANON),
22266 + * otherwise VMIN/VTIME are used.
22268 +#define UW7_VINTR 0
22269 +#define UW7_VQUIT 1
22270 +#define UW7_VERASE 2
22271 +#define UW7_VKILL 3
22272 +#define UW7_VEOF 4
22273 +#define UW7_VEOL 5
22274 +#define UW7_VEOL2 6
22275 +#define UW7_VMIN 4
22276 +#define UW7_VTIME 5
22277 +#define UW7_VSWTCH 7
22278 +#define UW7_VSTART 8
22279 +#define UW7_VSTOP 9
22280 +#define UW7_VSUSP 10
22281 +#define UW7_VDSUSP 11
22282 +#define UW7_VREPRINT 12
22283 +#define UW7_VDISCARD 13
22284 +#define UW7_VWERASE 14
22285 +#define UW7_VLNEXT 15
22288 + * Input modes (c_iflag), same as Linux bits, except DOSMODE (obsolete).
22290 +#define UW7_IFLAG_MSK 0017777
22291 +#define UW7_IGNBRK 0000001
22292 +#define UW7_BRKINT 0000002
22293 +#define UW7_IGNPAR 0000004
22294 +#define UW7_PARMRK 0000010
22295 +#define UW7_INPCK 0000020
22296 +#define UW7_ISTRIP 0000040
22297 +#define UW7_INLCR 0000100
22298 +#define UW7_IGNCR 0000200
22299 +#define UW7_ICRNL 0000400
22300 +#define UW7_IUCLC 0001000
22301 +#define UW7_IXON 0002000
22302 +#define UW7_IXANY 0004000
22303 +#define UW7_IXOFF 0010000
22304 +#define UW7_IMAXBEL 0020000
22305 +#define UW7_DOSMODE 0100000
22308 + * Output modes (c_oflag), exactly the same as Linux bits.
22310 +#define UW7_OFLAG_MSK 0177777
22311 +#define UW7_OPOST 0000001
22312 +#define UW7_OLCUC 0000002
22313 +#define UW7_ONLCR 0000004
22314 +#define UW7_OCRNL 0000010
22315 +#define UW7_ONOCR 0000020
22316 +#define UW7_ONLRET 0000040
22317 +#define UW7_OFILL 0000100
22318 +#define UW7_OFDEL 0000200
22319 +#define UW7_NLDLY 0000400
22320 +#define UW7_NL0 0000000
22321 +#define UW7_NL1 0000400
22322 +#define UW7_CRDLY 0003000
22323 +#define UW7_CR0 0000000
22324 +#define UW7_CR1 0001000
22325 +#define UW7_CR2 0002000
22326 +#define UW7_CR3 0003000
22327 +#define UW7_TABDLY 0014000
22328 +#define UW7_TAB0 0000000
22329 +#define UW7_TAB1 0004000
22330 +#define UW7_TAB2 0010000
22331 +#define UW7_TAB3 0014000
22332 +#define UW7_XTABS UW7_TAB3
22333 +#define UW7_BSDLY 0020000
22334 +#define UW7_BS0 0000000
22335 +#define UW7_BS1 0020000
22336 +#define UW7_VTDLY 0040000
22337 +#define UW7_VT0 0000000
22338 +#define UW7_VT1 0040000
22339 +#define UW7_FFDLY 0100000
22340 +#define UW7_FF0 0000000
22341 +#define UW7_FF1 0100000
22344 + * Control modes (c_cflag).
22346 +#define UW7_CFLAG_MSK 0177777
22347 +#define UW7_CBAUD 0000017
22348 +#define UW7_CSIZE 0000060
22349 +#define UW7_CS5 0000000
22350 +#define UW7_CS6 0000020
22351 +#define UW7_CS7 0000040
22352 +#define UW7_CS8 0000060
22353 +#define UW7_CSTOPB 0000100
22354 +#define UW7_CREAD 0000200
22355 +#define UW7_PARENB 0000400
22356 +#define UW7_PARODD 0001000
22357 +#define UW7_HUPCL 0002000
22358 +#define UW7_CLOCAL 0004000
22359 +#define UW7_XCLUDE 0100000
22360 +#define UW7_CIBAUD 000003600000
22361 +#define UW7_IBSHIFT 16
22362 +#define UW7_PAREXT 000004000000
22365 + * Local modes (c_lflag), same as Linux except
22366 + * UW7_FLUSHO is different and UW7_DEFECHO is obsolete (set to 0).
22368 +#define UW7_LFLAG_MSK 0001777
22369 +#define UW7_ISIG 0000001
22370 +#define UW7_ICANON 0000002
22371 +#define UW7_XCASE 0000004
22372 +#define UW7_ECHO 0000010
22373 +#define UW7_ECHOE 0000020
22374 +#define UW7_ECHOK 0000040
22375 +#define UW7_ECHONL 0000100
22376 +#define UW7_NOFLSH 0000200
22377 +#define UW7_TOSTOP 0000400
22378 +#define UW7_ECHOCTL 0001000
22379 +#define UW7_ECHOPRT 0002000
22380 +#define UW7_ECHOKE 0004000
22381 +#define UW7_DEFECHO 0010000
22382 +#define UW7_FLUSHO 0020000
22383 +#define UW7_PENDIN 0040000
22384 +#define UW7_IEXTEN 0100000
22386 +#endif /* __KERNEL__ */
22387 +#endif /* __ABI_UW7_TERMBITS_H__ */
22388 diff -uNr --exclude-from=dontdiff linux-2.4.3/include/abi/wysev386i.h linux/include/abi/wysev386i.h
22389 --- linux-2.4.3/include/abi/wysev386i.h Thu Jan 1 01:00:00 1970
22390 +++ linux/include/abi/wysev386i.h Mon Mar 12 16:35:05 2001
22393 + * include/abi/wysev386i.h
22395 + * Copyright (C) 1994 Mike Jagdis (jaggy@purplet.demon.co.uk)
22401 +/* Wyse extensions for 4.3 BSD TCP/IP in V/386 3.2.1A */
22403 +#include <linux/ioctl.h>
22406 +/* Get struct rtentry from linux/route.h - this should be compatible. */
22407 +#include <linux/route.h>
22409 +/* Get struct arpreq from linux/if_arp.h - this should be compatible. */
22410 +#include <linux/if_arp.h>
22412 +/* Get struct ifreq and struct ifconf from linux/if.h - these should
22415 +#include <linux/if.h>
22418 +/* Wyse use BSD style ioctls. This will warn us if we haven't got compatible
22419 + * structures :-).
22422 +/* socket i/o controls */
22423 +#define WVR3_SIOCSHIWAT BSD__IOW('s', 0, int) /* set high watermark */
22424 +#define WVR3_SIOCGHIWAT BSD__IOR('s', 1, int) /* get high watermark */
22425 +#define WVR3_SIOCSLOWAT BSD__IOW('s', 2, int) /* set low watermark */
22426 +#define WVR3_SIOCGLOWAT BSD__IOR('s', 3, int) /* get low watermark */
22427 +#define WVR3_SIOCATMARK BSD__IOR('s', 7, int) /* at oob mark? */
22428 +#define WVR3_SIOCSPGRP BSD__IOW('s', 8, int) /* set process group */
22429 +#define WVR3_SIOCGPGRP BSD__IOR('s', 9, int) /* get process group */
22431 +#define WVR3_SIOCADDRT BSD__IOW('r', 10, struct rtentry) /* add route */
22432 +#define WVR3_SIOCDELRT BSD__IOW('r', 11, struct rtentry) /* delete route */
22434 +#define WVR3_SIOCSIFADDR BSD__IOW('i', 12, struct ifreq) /* set ifnet address */
22435 +#define WVR3_SIOCGIFADDR BSD__IOWR('i',13, struct ifreq) /* get ifnet address */
22436 +#define WVR3_SIOCSIFDSTADDR BSD__IOW('i', 14, struct ifreq) /* set p-p address */
22437 +#define WVR3_SIOCGIFDSTADDR BSD__IOWR('i',15, struct ifreq) /* get p-p address */
22438 +#define WVR3_SIOCSIFFLAGS BSD__IOW('i', 16, struct ifreq) /* set ifnet flags */
22439 +#define WVR3_SIOCGIFFLAGS BSD__IOWR('i',17, struct ifreq) /* get ifnet flags */
22440 +#define WVR3_SIOCGIFBRDADDR BSD__IOWR('i',18, struct ifreq) /* get broadcast addr */
22441 +#define WVR3_SIOCSIFBRDADDR BSD__IOW('i',19, struct ifreq) /* set broadcast addr */
22442 +#define WVR3_SIOCGIFCONF BSD__IOWR('i',20, struct ifconf) /* get ifnet list */
22443 +#define WVR3_SIOCGIFNETMASK BSD__IOWR('i',21, struct ifreq) /* get net addr mask */
22444 +#define WVR3_SIOCSIFNETMASK BSD__IOW('i',22, struct ifreq) /* set net addr mask */
22445 +#define WVR3_SIOCGIFMETRIC BSD__IOWR('i',23, struct ifreq) /* get IF metric */
22446 +#define WVR3_SIOCSIFMETRIC BSD__IOW('i',24, struct ifreq) /* set IF metric */
22447 +#define WVR3_SIOCSIFHADDR BSD__IOW('i', 25, struct ifreq) /* set hardware addr */
22448 +#define WVR3_SIOCGIFHADDR BSD__IOWR('i',26, struct ifreq) /* get hardware addr */
22449 +#define WVR3_SIOCRIFHADDR BSD__IOW('i', 27, struct ifreq) /* reset hardware addr */
22451 +#define WVR3_SIOCSARP BSD__IOW('i', 30, struct arpreq) /* set arp entry */
22452 +#define WVR3_SIOCGARP BSD__IOWR('i',31, struct arpreq) /* get arp entry */
22453 +#define WVR3_SIOCDARP BSD__IOW('i', 32, struct arpreq) /* delete arp entry */
22455 +#define WVR3_SIOCADDMULTI BSD__IOW('i', 33, struct ifreq) /* set multicast addr */
22456 +#define WVR3_SIOCDELMULTI BSD__IOW('i', 34, struct ifreq) /* set multicast addr */
22457 diff -uNr --exclude-from=dontdiff linux-2.4.3/include/abi/xnx.h linux/include/abi/xnx.h
22458 --- linux-2.4.3/include/abi/xnx.h Thu Jan 1 01:00:00 1970
22459 +++ linux/include/abi/xnx.h Mon Mar 12 16:35:05 2001
22462 + * include/abi/xnx.h -- xenix ibcs interface
22464 + * Copyright (C) 1993 Drew Sullivan
22465 + * Released for general use as long as this copyright remains.
22470 +typedef unsigned short excode_t;
22474 + unsigned short millitm;
22479 +extern int xnx_locking(int fd, int mode, unsigned long size);
22480 +extern int xnx_creatsem(char *sem_name, int mode);
22481 +extern int xnx_opensem(char *sem_name);
22482 +extern int xnx_sigsem(int sem_num);
22483 +extern int xnx_waitsem(int sem_num);
22484 +extern int xnx_nbwaitsem(int sem_num);
22485 +extern int xnx_rdchk(int fd);
22486 +extern int xnx_ftime(struct timeb * tp);
22487 +extern int xnx_nap(long period);
22488 +extern int xnx_sdget(char *path, int flags, long size, int mode);
22489 +extern int xnx_sdfree(char* addr);
22490 +extern int xnx_sdenter(char *addr, int flags);
22491 +extern int xnx_sdleave(char *addr);
22492 +extern int xnx_sdgetv(char *addr);
22493 +extern int xnx_sdwaitv(char *addr, int vnum);
22494 +extern int xnx_proctl(int pid, int command, char *arg);
22495 +extern int xnx_execseg(excode_t oldaddr, unsigned size);
22496 +extern int xnx_unexecseg(excode_t addr);
22497 +extern int xnx_eaccess(char *path, int mode);
22498 +extern int xnx_paccess(int pid, int cmd, int offset, int count, char *ptr);
22499 +extern int xnx_sigpending(unsigned long *set);
22500 +extern int xnx_pathconf(char *path, int name);
22501 +extern int xnx_fpathconf(int fildes, int name);
22502 diff -uNr --exclude-from=dontdiff linux-2.4.3/include/abi/xout.h linux/include/abi/xout.h
22503 --- linux-2.4.3/include/abi/xout.h Thu Jan 1 01:00:00 1970
22504 +++ linux/include/abi/xout.h Sun Mar 18 17:28:03 2001
22507 + * xout.h - Microsoft Xenix x.out binary format data structures
22509 + * Copyright (c) 1994 Mike Jagdis (jaggy@purplet.demon.co.uk)
22511 +#ifndef _ABI_XOUT_H_
22512 +#define _ABI_XOUT_H_
22515 + * This file is based on available documentation for the Xenix x.out
22516 + * format. Much is missing here. There is just enough to allow us to
22517 + * support 386 small model and not a lot more.
22524 + u_short x_magic; /* magic number */
22525 + u_short x_ext; /* size of header extension */
22528 + * For segmented binaries the following sizes are the sums
22529 + * of the segment sizes.
22531 + long x_text; /* size of text segments */
22532 + long x_data; /* size of initialized data */
22533 + long x_bss; /* size of uninitialized data */
22534 + long x_syms; /* size of symbol table */
22535 + long x_reloc; /* relocation table length */
22537 + long x_entry; /* entry point */
22538 + char x_cpu; /* cpu type and byte/word order */
22539 + char x_relsym; /* undefined */
22540 + u_short x_renv; /* run-time environment */
22544 + * X.out header extension
22548 + * These are unused.
22550 + long xe_trsize; /* ??? */
22551 + long xe_drsize; /* ??? */
22552 + long xe_tbase; /* ??? */
22553 + long xe_dbase; /* ??? */
22555 + long xe_stksize; /* stack size (if XE_FS set) */
22558 + * The following are present if XE_SEG is set.
22560 + long xe_segpos; /* offset to segment table */
22561 + long xe_segsize; /* segment table size */
22562 + long xe_mdtpos; /* offset to machdep table */
22563 + long xe_mdtsize; /* machine dependent table size */
22564 + char xe_mdttype; /* machine dependent table type */
22565 + char xe_pagesize; /* file pagesize, in 512 units */
22566 + char xe_ostype; /* operating system type */
22567 + char xe_osvers; /* operating system version */
22568 + u_short xe_eseg; /* entry segment, machdep */
22569 + u_short xe_sres; /* reserved */
22573 + * X.out segment description.
22576 + u_short xs_type; /* segment type */
22577 + u_short xs_attr; /* segment attributes */
22578 + u_short xs_seg; /* segment number */
22579 + char xs_align; /* log base 2 of alignment */
22580 + char xs_cres; /* unused */
22581 + u_long xs_filpos; /* file position */
22582 + u_long xs_psize; /* physical size (in file) */
22583 + u_long xs_vsize; /* virtual size (in core) */
22584 + u_long xs_rbase; /* relocation base addr/offset */
22585 + u_short xs_noff; /* segment name table offset */
22586 + u_short xs_sres; /* unused */
22587 + long xs_lres; /* unused */
22592 + * Magic number for an x.out header.
22594 +#define X_MAGIC 0x0206 /* indicates x.out header */
22597 + * Codes for x_cpu.
22599 +#define XC_BSWAP 0x80 /* bytes swapped */
22600 +#define XC_WSWAP 0x40 /* words swapped */
22601 +#define XC_8086 0x04 /* I8086 */
22602 +#define XC_286 0x09 /* iAPX 80286 */
22603 +#define XC_286V 0x29 /* iAPX 80286, use xe_osver for version */
22604 +#define XC_386 0x0a /* iAPX 80386 */
22605 +#define XC_186 0x0b /* iAPX 80186 */
22606 +#define XC_CPU 0x3f /* cpu mask */
22609 + * Flags for the run-time environment.
22611 +#define XE_V2 0x4000 /* version 2.x */
22612 +#define XE_V3 0x8000 /* version 3.x */
22613 +#define XE_OSV 0xc000 /* if XE_SEG use xe_osvers ... */
22614 +#define XE_V5 XE_OSV /* else assume v5.x */
22615 +#define XE_VERS 0xc000 /* version mask */
22617 +#define XE_5_3 0x2000 /* binary needs 5.3 functionality */
22618 +#define XE_LOCK 0x1000 /* Use Advisory locking */
22619 +#define XE_SEG 0x0800 /* segment table present */
22620 +#define XE_ABS 0x0400 /* absolute memory image (standalone) */
22621 +#define XE_ITER 0x0200 /* iterated text/data present */
22622 +#define XE_HDATA 0x0100 /* huge model data (never used) */
22623 +#define XE_VMOD XE_HDATA /* virtual module */
22624 +#define XE_FPH 0x0080 /* floating point hardware required */
22625 +#define XE_LTEXT 0x0040 /* large model text */
22626 +#define XE_LDATA 0x0020 /* large model data */
22627 +#define XE_OVER 0x0010 /* text overlay */
22628 +#define XE_FS 0x0008 /* fixed stack */
22629 +#define XE_PURE 0x0004 /* pure text */
22630 +#define XE_SEP 0x0002 /* separate I & D */
22631 +#define XE_EXEC 0x0001 /* executable */
22637 +#define XS_TNULL 0 /* unused segment */
22638 +#define XS_TTEXT 1 /* text segment */
22639 +#define XS_TDATA 2 /* data segment */
22640 +#define XS_TSYMS 3 /* symbol table segment */
22641 +#define XS_TREL 4 /* relocation segment */
22642 +#define XS_TSESTR 5 /* segment table's string table segment */
22643 +#define XS_TGRPS 6 /* group definitions segment */
22645 +#define XS_TIDATA 64 /* iterated data */
22646 +#define XS_TTSS 65 /* tss */
22647 +#define XS_TLFIX 66 /* lodfix */
22648 +#define XS_TDNAME 67 /* descriptor names */
22649 +#define XS_TDTEXT 68 /* debug text segment */
22650 +#define XS_TIDBG XS_TDTEXT
22651 +#define XS_TDFIX 69 /* debug relocation */
22652 +#define XS_TOVTAB 70 /* overlay table */
22654 +#define XS_TSYSTR 72 /* symbol string table */
22657 + * Segment attributes.
22659 +#define XS_AMEM 0x8000 /* is a memory image */
22662 + * For text and data segment types
22664 +#define XS_AITER 0x0001 /* contains iteration records */
22665 +#define XS_AHUGE 0x0002 /* contains huge element */
22666 +#define XS_ABSS 0x0004 /* contains implicit BSS */
22667 +#define XS_APURE 0x0008 /* read only, shareable */
22668 +#define XS_AEDOWN 0x0010 /* expands downward (stack) */
22669 +#define XS_APRIV 0x0020 /* may not be combined */
22670 +#define XS_A32BIT 0x0040 /* is 32 bit */
22673 + * File position macros, valid only if !XE_SEG.
22675 +#define XEXTPOS(xp) ((long) sizeof(struct xexec))
22676 +#define XTEXTPOS(xp) (XEXTPOS(xp) + (long) (xp)->x_ext)
22677 +#define XDATAPOS(xp) (XTEXTPOS(xp) + (xp)->x_text)
22678 +#define XBSSPOS(xp) (XDATAPOS(xp) + (xp)->x_data)
22679 +#define XSYMPOS(xp) (XDATAPOS(xp) + (xp)->x_data)
22680 +#define XRELPOS(xp) (XSYMPOS(xp) + (xp)->x_syms)
22681 +#define XENDPOS(xp) (XRELPOS(xp) + (xp)->x_reloc)
22683 +#define XRTEXTPOS(xp, ep) (XRELPOS(xp))
22684 +#define XRDATAPOS(xp, ep) (XRELPOS(xp) + (ep)->xe_trsize)
22688 + * Specials for the Linux Xenix 286 emulator.
22690 + * The base address that 286 segments are loaded above. This should be
22691 + * above memory used by the emulator overlay. Actual segment data
22692 + * starts slightly higher than this since we map the xexec and xext
22693 + * structures of the executable to this address.
22695 +#define X286_MAP_ADDR 0x4000000
22697 +#endif /* _ABI_XOUT_H_ */
22698 diff -uNr --exclude-from=dontdiff linux-2.4.3/include/asm-alpha/elf.h linux/include/asm-alpha/elf.h
22699 --- linux-2.4.3/include/asm-alpha/elf.h Fri Sep 22 23:07:43 2000
22700 +++ linux/include/asm-alpha/elf.h Fri Mar 30 17:25:23 2001
22701 @@ -126,9 +126,22 @@
22705 -#define SET_PERSONALITY(EX, IBCS2) \
22706 - set_personality(((EX).e_flags & EF_ALPHA_32BIT) \
22707 - ? PER_LINUX_32BIT : (IBCS2) ? PER_SVR4 : PER_LINUX)
22711 +#define SET_ELF_PERSONALITY(ex, interp) \
22713 + unsigned long personality = PER_LINUX; \
22715 + /* If the header identifies the binary, use that information */ \
22716 + if ((ex).e_flags & EF_ALPHA_32BIT) \
22717 + personality = PER_LINUX_32BIT; \
22719 + /* Else check the interpreter for SVR4isms */ \
22720 + else if (strcmp((interp), "/usr/lib/libc.so.1") == 0 || \
22721 + strcmp((interp), "/usr/lib/ld.so.1") == 0) \
22722 + personality = PER_SVR4; \
22724 + set_personality(personality); \
22727 +#endif /* __KERNEL__ */
22728 +#endif /* __ASM_ALPHA_ELF_H */
22729 diff -uNr --exclude-from=dontdiff linux-2.4.3/include/asm-cris/elf.h linux/include/asm-cris/elf.h
22730 --- linux-2.4.3/include/asm-cris/elf.h Fri Feb 23 20:12:50 2001
22731 +++ linux/include/asm-cris/elf.h Fri Mar 30 17:25:23 2001
22733 #define ELF_PLATFORM (NULL)
22736 -#define SET_PERSONALITY(ex, ibcs2) set_personality((ibcs2)?PER_SVR4:PER_LINUX)
22738 +#define SET_ELF_PERSONALITY(ex, interp) \
22740 + unsigned long personality = PER_LINUX; \
22742 + /* Check the interpreter for SVR4isms */ \
22743 + else if (strcmp((interp), "/usr/lib/libc.so.1") == 0 || \
22744 + strcmp((interp), "/usr/lib/ld.so.1") == 0) \
22745 + personality = PER_SVR4; \
22747 + set_personality(personality); \
22751 +#endif /* __KERNEL__ */
22752 +#endif /* __ASMCRIS_ELF_H */
22753 diff -uNr --exclude-from=dontdiff linux-2.4.3/include/asm-i386/abi.h linux/include/asm-i386/abi.h
22754 --- linux-2.4.3/include/asm-i386/abi.h Thu Jan 1 01:00:00 1970
22755 +++ linux/include/asm-i386/abi.h Fri Mar 30 17:25:23 2001
22757 +#define get_syscall_parameter(regs,n) ({ unsigned long r; \
22758 + get_user(r, ((unsigned long *)regs->esp)+((n)+1)); \
22760 +#define set_error(regs,e) { regs->eax = (e); regs->eflags |= 1; }
22761 +#define clear_error(regs) { regs->eflags &= ~1; }
22762 +#define set_result(regs,r) regs->eax = r
22763 +#define get_result(regs) regs->eax
22764 diff -uNr --exclude-from=dontdiff linux-2.4.3/include/asm-i386/elf.h linux/include/asm-i386/elf.h
22765 --- linux-2.4.3/include/asm-i386/elf.h Thu Jan 4 23:51:47 2001
22766 +++ linux/include/asm-i386/elf.h Fri Mar 30 17:31:36 2001
22769 #define ELF_PLATFORM (system_utsname.machine)
22771 +/* EF_386_UW7 is needed by elfmark(1) so it's outside __KERNEL__ */
22772 +#define EF_386_UW7 0x314B4455
22775 -#define SET_PERSONALITY(ex, ibcs2) set_personality((ibcs2)?PER_SVR4:PER_LINUX)
22779 +#define SET_ELF_PERSONALITY(ex, interp) \
22781 + unsigned long personality = PER_LINUX; \
22783 + /* If the header identifies the binary, use that information */ \
22784 + if ((ex).e_flags == EF_386_UW7) \
22785 + personality = PER_UW7; \
22787 + /* Else check the interpreter for SVR4isms */ \
22788 + else if (strcmp((interp), "/usr/lib/libc.so.1") == 0 || \
22789 + strcmp((interp), "/usr/lib/ld.so.1") == 0) \
22790 + personality = PER_SVR4; \
22792 + set_personality(personality); \
22795 +#endif /* __KERNEL__ */
22796 +#endif /* __ASMi386_ELF_H */
22797 diff -uNr --exclude-from=dontdiff linux-2.4.3/include/asm-i386/ldt.h linux/include/asm-i386/ldt.h
22798 --- linux-2.4.3/include/asm-i386/ldt.h Sun Jul 11 18:11:46 1999
22799 +++ linux/include/asm-i386/ldt.h Fri Mar 30 17:25:23 2001
22801 #define LDT_ENTRY_SIZE 8
22803 #ifndef __ASSEMBLY__
22804 -struct modify_ldt_ldt_s {
22805 +typedef struct modify_ldt_ldt_s {
22806 unsigned int entry_number;
22807 unsigned long base_addr;
22808 unsigned int limit;
22810 unsigned int limit_in_pages:1;
22811 unsigned int seg_not_present:1;
22812 unsigned int useable:1;
22816 #define MODIFY_LDT_CONTENTS_DATA 0
22817 #define MODIFY_LDT_CONTENTS_STACK 1
22818 diff -uNr --exclude-from=dontdiff linux-2.4.3/include/asm-i386/namei.h linux/include/asm-i386/namei.h
22819 --- linux-2.4.3/include/asm-i386/namei.h Mon Apr 3 00:49:07 2000
22820 +++ linux/include/asm-i386/namei.h Fri Mar 30 17:25:23 2001
22824 * linux/include/asm-i386/namei.h
22826 * Included from linux/fs/namei.c
22828 #ifndef __I386_NAMEI_H
22829 #define __I386_NAMEI_H
22831 -/* This dummy routine maybe changed to something useful
22832 - * for /usr/gnemul/ emulation stuff.
22833 - * Look at asm-sparc/namei.h for details.
22834 +//#if defined(CONFIG_ABI) || defined (CONFIG_ABI_MODULE)
22838 + * The base directory for our emulations.
22839 + * - sparc uses usr/gmemul here.
22841 +#define I386_EMUL_BASE "emul/"
22844 + * We emulate quite a lot operting systems...
22846 +#define I386_SVR4_EMUL I386_EMUL_BASE "/svr4/"
22847 +#define I386_SVR3_EMUL I386_EMUL_BASE "/svr3/"
22848 +#define I386_SCOSVR3_EMUL I386_EMUL_BASE "/sco/"
22849 +#define I386_WYSEV386_EMUL I386_EMUL_BASE "/wyse/"
22850 +#define I386_ISCR4_EMUL I386_EMUL_BASE "/isc/"
22851 +#define I386_BSD_EMUL I386_EMUL_BASE "/bsd/"
22852 +#define I386_XENIX_EMUL I386_EMUL_BASE "/xenix/"
22853 +#define I386_SOLARIS_EMUL I386_EMUL_BASE "/solaris/"
22854 +#define I386_UW7_EMUL I386_EMUL_BASE "/uw7/"
22856 -#define __emul_prefix() NULL
22857 +static inline char *__emul_prefix(void)
22859 + switch (current->personality) {
22861 + return I386_SVR4_EMUL;
22863 + return I386_SVR3_EMUL;
22864 + case PER_SCOSVR3:
22865 + return I386_SCOSVR3_EMUL;
22866 + case PER_WYSEV386:
22867 + return I386_WYSEV386_EMUL;
22869 + return I386_ISCR4_EMUL;
22871 + return I386_BSD_EMUL;
22873 + return I386_XENIX_EMUL;
22874 + case PER_SOLARIS:
22875 + return I386_SOLARIS_EMUL;
22877 + return I386_UW7_EMUL;
22885 + * No emulation, no fun :)
22887 +#define __emul_prefix() NULL
22889 +#endif /* CONFIG_ABI || CONFIG_ABI_MODULE */
22890 #endif /* __I386_NAMEI_H */
22891 diff -uNr --exclude-from=dontdiff linux-2.4.3/include/asm-ia64/elf.h linux/include/asm-ia64/elf.h
22892 --- linux-2.4.3/include/asm-ia64/elf.h Wed Jul 12 00:43:45 2000
22893 +++ linux/include/asm-ia64/elf.h Fri Mar 30 17:25:23 2001
22895 #define ELF_PLATFORM 0
22898 -#define SET_PERSONALITY(ex, ibcs2) set_personality((ibcs2)?PER_SVR4:PER_LINUX)
22901 +#define SET_ELF_PERSONALITY(ex, interp) \
22903 + unsigned long personality = PER_LINUX; \
22905 + /* Check the interpreter for SVR4isms */ \
22906 + else if (strcmp((interp), "/usr/lib/libc.so.1") == 0 || \
22907 + strcmp((interp), "/usr/lib/ld.so.1") == 0) \
22908 + personality = PER_SVR4; \
22910 + set_personality(personality); \
22913 +#endif /* __KERNEL__ */
22914 #endif /* _ASM_IA64_ELF_H */
22915 diff -uNr --exclude-from=dontdiff linux-2.4.3/include/asm-m68k/elf.h linux/include/asm-m68k/elf.h
22916 --- linux-2.4.3/include/asm-m68k/elf.h Wed Jul 12 00:43:45 2000
22917 +++ linux/include/asm-m68k/elf.h Fri Mar 30 17:25:23 2001
22919 #define ELF_PLATFORM (NULL)
22922 -#define SET_PERSONALITY(ex, ibcs2) set_personality((ibcs2)?PER_SVR4:PER_LINUX)
22924 +#define SET_ELF_PERSONALITY(ex, interp) \
22926 + unsigned long personality = PER_LINUX; \
22928 + /* Check the interpreter for SVR4isms */ \
22929 + else if (strcmp((interp), "/usr/lib/libc.so.1") == 0 || \
22930 + strcmp((interp), "/usr/lib/ld.so.1") == 0) \
22931 + personality = PER_SVR4; \
22933 + set_personality(personality); \
22937 +#endif /* __KERNEL__ */
22938 +#endif /* __ASMm68k_ELF_H */
22939 diff -uNr --exclude-from=dontdiff linux-2.4.3/include/asm-mips/elf.h linux/include/asm-mips/elf.h
22940 --- linux-2.4.3/include/asm-mips/elf.h Fri Jul 28 03:36:54 2000
22941 +++ linux/include/asm-mips/elf.h Fri Mar 30 17:25:23 2001
22942 @@ -103,7 +103,17 @@
22943 #define ELF_ET_DYN_BASE (2 * TASK_SIZE / 3)
22946 -#define SET_PERSONALITY(ex, ibcs2) set_personality((ibcs2)?PER_SVR4:PER_LINUX)
22948 +#define SET_ELF_PERSONALITY(ex, interp) \
22950 + unsigned long personality = PER_LINUX; \
22952 + /* Check the interpreter for SVR4isms */ \
22953 + else if (strcmp((interp), "/usr/lib/libc.so.1") == 0 || \
22954 + strcmp((interp), "/usr/lib/ld.so.1") == 0) \
22955 + personality = PER_SVR4; \
22957 + set_personality(personality); \
22960 +#endif /* __KERNEL__ */
22961 #endif /* __ASM_ELF_H */
22962 diff -uNr --exclude-from=dontdiff linux-2.4.3/include/asm-mips64/elf.h linux/include/asm-mips64/elf.h
22963 --- linux-2.4.3/include/asm-mips64/elf.h Fri Jul 28 03:36:54 2000
22964 +++ linux/include/asm-mips64/elf.h Fri Mar 30 17:25:23 2001
22965 @@ -97,17 +97,21 @@
22966 #define ELF_ET_DYN_BASE (2 * TASK_SIZE / 3)
22970 -#define SET_PERSONALITY(ex, ibcs2) \
22971 -do { if ((ex).e_ident[EI_CLASS] == ELFCLASS32) \
22972 - current->thread.mflags |= MF_32BIT; \
22974 - current->thread.mflags &= ~MF_32BIT; \
22976 - set_personality(PER_SVR4); \
22977 - else if (current->personality != PER_LINUX32) \
22978 - set_personality(PER_LINUX); \
22979 +#define SET_ELF_PERSONALITY(ex, interp) \
22981 + /* First do some adjustments for 32bit binary compatiblity */ \
22982 + if ((ex).e_ident[EI_CLASS] == ELFCLASS32) \
22983 + current->thread.mflags |= MF_32BIT; \
22985 + current->thread.mflags &= ~MF_32BIT; \
22987 + /* Check the interpreter for SVR4isms */ \
22988 + if (strcmp((interp), "/usr/lib/libc.so.1") == 0 || \
22989 + strcmp((interp), "/usr/lib/ld.so.1") == 0) \
22990 + set_personality(PER_SVR4); \
22991 + else if (current->personality != PER_LINUX32) \
22992 + set_personality(PER_LINUX); \
22996 +#endif /* __KERNEL__ */
22997 #endif /* _ASM_ELF_H */
22998 diff -uNr --exclude-from=dontdiff linux-2.4.3/include/asm-parisc/elf.h linux/include/asm-parisc/elf.h
22999 --- linux-2.4.3/include/asm-parisc/elf.h Fri Mar 30 14:45:52 2001
23000 +++ linux/include/asm-parisc/elf.h Fri Mar 30 17:25:23 2001
23002 #define ELF_PLATFORM ("PARISC\0" /*+((boot_cpu_data.x86-3)*5) */)
23005 -#define SET_PERSONALITY(ex, ibcs2) \
23006 - current->personality = PER_LINUX
23010 +#define SET_ELF_PERSONALITY(ex, interp) \
23012 + __set_personality(PER_LINUX); \
23015 +#endif /* __KERNEL__ */
23016 +#endif /* __ASMPARISC_ELF_H */
23017 diff -uNr --exclude-from=dontdiff linux-2.4.3/include/asm-ppc/elf.h linux/include/asm-ppc/elf.h
23018 --- linux-2.4.3/include/asm-ppc/elf.h Sat Feb 3 14:51:14 2001
23019 +++ linux/include/asm-ppc/elf.h Fri Mar 30 17:25:23 2001
23022 #define ELF_PLATFORM (NULL)
23024 -#define SET_PERSONALITY(ex, ibcs2) set_personality((ibcs2)?PER_SVR4:PER_LINUX)
23027 * We need to put in some extra aux table entries to tell glibc what
23028 * the cache block size is, so it can use the dcbz instruction safely.
23030 NEW_AUX_ENT(2, AT_UCACHEBSIZE, ucache_bsize); \
23033 +#define SET_ELF_PERSONALITY(ex, interp) \
23035 + unsigned long personality = PER_LINUX; \
23037 + /* Check the interpreter for SVR4isms */ \
23038 + else if (strcmp((interp), "/usr/lib/libc.so.1") == 0 || \
23039 + strcmp((interp), "/usr/lib/ld.so.1") == 0) \
23040 + personality = PER_SVR4; \
23042 + set_personality(personality); \
23045 #endif /* __KERNEL__ */
23047 +#endif /* __PPC_ELF_H */
23048 diff -uNr --exclude-from=dontdiff linux-2.4.3/include/asm-s390/elf.h linux/include/asm-s390/elf.h
23049 --- linux-2.4.3/include/asm-s390/elf.h Fri Feb 23 20:12:50 2001
23050 +++ linux/include/asm-s390/elf.h Fri Mar 30 17:25:23 2001
23052 #define ELF_PLATFORM (NULL)
23055 -#define SET_PERSONALITY(ex, ibcs2) set_personality((ibcs2)?PER_SVR4:PER_LINUX)
23059 +#define SET_ELF_PERSONALITY(ex, interp) \
23061 + unsigned long personality = PER_LINUX; \
23063 + /* Check the interpreter for SVR4isms */ \
23064 + else if (strcmp((interp), "/usr/lib/libc.so.1") == 0 || \
23065 + strcmp((interp), "/usr/lib/ld.so.1") == 0) \
23066 + personality = PER_SVR4; \
23068 + set_personality(personality); \
23071 +#endif /* __KERNEL__ */
23072 +#endif /* __ASMS390_ELF_H */
23073 diff -uNr --exclude-from=dontdiff linux-2.4.3/include/asm-s390x/elf.h linux/include/asm-s390x/elf.h
23074 --- linux-2.4.3/include/asm-s390x/elf.h Fri Feb 23 20:12:51 2001
23075 +++ linux/include/asm-s390x/elf.h Fri Mar 30 17:25:23 2001
23077 #define ELF_PLATFORM (NULL)
23080 -#define SET_PERSONALITY(ex, ibcs2) set_personality((ibcs2)?PER_SVR4:PER_LINUX)
23084 +#define SET_ELF_PERSONALITY(ex, interp) \
23086 + unsigned long personality = PER_LINUX; \
23088 + /* Check the interpreter for SVR4isms */ \
23089 + else if (strcmp((interp), "/usr/lib/libc.so.1") == 0 || \
23090 + strcmp((interp), "/usr/lib/ld.so.1") == 0) \
23091 + personality = PER_SVR4; \
23093 + set_personality(personality); \
23096 +#endif /* __KERNEL__ */
23097 +#endif /* __ASMS390_ELF_H */
23098 diff -uNr --exclude-from=dontdiff linux-2.4.3/include/asm-sh/elf.h linux/include/asm-sh/elf.h
23099 --- linux-2.4.3/include/asm-sh/elf.h Wed Jul 12 00:43:45 2000
23100 +++ linux/include/asm-sh/elf.h Fri Mar 30 17:25:23 2001
23102 _r->sr = SR_FD; } while (0)
23105 -#define SET_PERSONALITY(ex, ibcs2) set_personality(PER_LINUX_32BIT)
23108 +#define SET_ELF_PERSONALITY(ex, interp) \
23110 + __set_personality(PER_LINUX_32BIT); \
23113 +#endif /* __KERNEL__ */
23114 #endif /* __ASM_SH_ELF_H */
23115 diff -uNr --exclude-from=dontdiff linux-2.4.3/include/asm-sparc/abi.h linux/include/asm-sparc/abi.h
23116 --- linux-2.4.3/include/asm-sparc/abi.h Thu Jan 1 01:00:00 1970
23117 +++ linux/include/asm-sparc/abi.h Fri Mar 30 17:25:23 2001
23119 +#define get_syscall_parameter(regs,n) (regs)->u_regs [(n)+8]
23120 +#define set_error(regs,e) (regs)->u_regs [8] = -(e)
23121 +#define set_result(regs,r) regs->u_regs [8] = r
23122 +#define clear_error(regs)
23123 +#define get_result(regs) regs->u_regs [8]
23124 diff -uNr --exclude-from=dontdiff linux-2.4.3/include/asm-sparc/elf.h linux/include/asm-sparc/elf.h
23125 --- linux-2.4.3/include/asm-sparc/elf.h Wed Jul 12 04:02:37 2000
23126 +++ linux/include/asm-sparc/elf.h Fri Mar 30 17:25:23 2001
23127 @@ -105,7 +105,18 @@
23128 #define ELF_PLATFORM (NULL)
23131 -#define SET_PERSONALITY(ex, ibcs2) set_personality((ibcs2)?PER_SVR4:PER_LINUX)
23134 +#define SET_ELF_PERSONALITY(ex, interp) \
23136 + unsigned long personality = PER_LINUX; \
23138 + /* Check the interpreter for SVR4isms */ \
23139 + else if (strcmp((interp), "/usr/lib/libc.so.1") == 0 || \
23140 + strcmp((interp), "/usr/lib/ld.so.1") == 0) \
23141 + personality = PER_SVR4; \
23143 + set_personality(personality); \
23146 +#endif /* __KERNEL__ */
23147 #endif /* !(__ASMSPARC_ELF_H) */
23148 diff -uNr --exclude-from=dontdiff linux-2.4.3/include/asm-sparc64/elf.h linux/include/asm-sparc64/elf.h
23149 --- linux-2.4.3/include/asm-sparc64/elf.h Fri Mar 30 14:48:47 2001
23150 +++ linux/include/asm-sparc64/elf.h Fri Mar 30 17:25:23 2001
23151 @@ -56,10 +56,10 @@
23152 instruction set this cpu supports. */
23154 /* On Ultra, we support all of the v8 capabilities. */
23155 -#define ELF_HWCAP ((HWCAP_SPARC_FLUSH | HWCAP_SPARC_STBAR | \
23156 - HWCAP_SPARC_SWAP | HWCAP_SPARC_MULDIV | \
23157 - HWCAP_SPARC_V9) | \
23158 - ((tlb_type == cheetah) ? HWCAP_SPARC_ULTRA3 : 0))
23159 +#define ELF_HWCAP ((HWCAP_SPARC_FLUSH | HWCAP_SPARC_STBAR | \
23160 + HWCAP_SPARC_SWAP | HWCAP_SPARC_MULDIV | \
23161 + HWCAP_SPARC_V9) | \
23162 + ((tlb_type == cheetah) ? HWCAP_SPARC_ULTRA3 : 0))
23164 /* This yields a string that ld.so will use to load implementation
23165 specific libraries for optimization. This is more specific in
23166 @@ -68,39 +68,51 @@
23167 #define ELF_PLATFORM (NULL)
23170 -#define SET_PERSONALITY(ex, ibcs2) \
23171 -do { unsigned char flags = current->thread.flags; \
23172 - if ((ex).e_ident[EI_CLASS] == ELFCLASS32) \
23173 - flags |= SPARC_FLAG_32BIT; \
23175 - flags &= ~SPARC_FLAG_32BIT; \
23176 - if (flags != current->thread.flags) { \
23177 - unsigned long pgd_cache = 0UL; \
23178 - if (flags & SPARC_FLAG_32BIT) { \
23179 - pgd_t *pgd0 = ¤t->mm->pgd[0]; \
23180 - if (pgd_none (*pgd0)) { \
23181 - pmd_t *page = pmd_alloc_one_fast(NULL, 0); \
23183 - page = pmd_alloc_one(NULL, 0); \
23184 - pgd_set(pgd0, page); \
23186 - pgd_cache = pgd_val(*pgd0) << 11UL; \
23188 - __asm__ __volatile__( \
23189 - "stxa\t%0, [%1] %2\n\t" \
23191 - : /* no outputs */ \
23192 - : "r" (pgd_cache), \
23194 - "i" (ASI_DMMU)); \
23195 - current->thread.flags = flags; \
23199 - set_personality(PER_SVR4); \
23200 - else if (current->personality != PER_LINUX32) \
23201 - set_personality(PER_LINUX); \
23203 +#define SET_ELF_PERSONALITY(ex, interp) \
23205 + unsigned long personality = PER_LINUX; \
23206 + unsigned char flags = current->thread.flags; \
23208 + if ((ex).e_ident[EI_CLASS] == ELFCLASS32) \
23209 + flags |= SPARC_FLAG_32BIT; \
23211 + flags &= ~SPARC_FLAG_32BIT; \
23213 + if (flags != current->thread.flags) { \
23214 + unsigned long pgd_cache = 0UL; \
23216 + if (flags & SPARC_FLAG_32BIT) { \
23217 + pgd_t *pgd0 = ¤t->mm->pgd[0]; \
23219 + if (pgd_none (*pgd0)) { \
23220 + pmd_t *page = pmd_alloc_one_fast(NULL, 0); \
23223 + page = pmd_alloc_one(NULL, 0); \
23224 + pgd_set(pgd0, page); \
23227 + pgd_cache = pgd_val(*pgd0) << 11UL; \
23229 + __asm__ __volatile__( \
23230 + "stxa\t%0, [%1] %2\n\t" \
23232 + : /* no outputs */ \
23233 + : "r" (pgd_cache), \
23235 + "i" (ASI_DMMU)); \
23237 + current->thread.flags = flags; \
23240 + /* Check the interpreter for SVR4isms */ \
23241 + if (strcmp((interp), "/usr/lib/libc.so.1") == 0 || \
23242 + strcmp((interp), "/usr/lib/ld.so.1") == 0) \
23243 + set_personality(PER_SVR4); \
23244 + else if (current->personality != PER_LINUX32) \
23245 + set_personality(PER_LINUX); \
23249 +#endif /* __KERNEL__ */
23250 #endif /* !(__ASM_SPARC64_ELF_H) */
23251 diff -uNr --exclude-from=dontdiff linux-2.4.3/include/linux/major.h linux/include/linux/major.h
23252 --- linux-2.4.3/include/linux/major.h Fri Mar 30 14:45:55 2001
23253 +++ linux/include/linux/major.h Fri Mar 30 17:25:23 2001
23255 #define ACSI_MAJOR 28
23256 #define AZTECH_CDROM_MAJOR 29
23257 #define GRAPHDEV_MAJOR 29 /* SparcLinux & Linux/68k /dev/fb */
23258 +#define SOCKSYS_MAJOR 30 /* iBCS needs this for STREAMS-based TCP/IP */
23259 #define SHMIQ_MAJOR 85 /* Linux/mips, SGI /dev/shmiq */
23260 #define CM206_CDROM_MAJOR 32
23261 #define IDE2_MAJOR 33
23262 diff -uNr --exclude-from=dontdiff linux-2.4.3/include/linux/personality.h linux/include/linux/personality.h
23263 --- linux-2.4.3/include/linux/personality.h Mon Dec 11 21:49:54 2000
23264 +++ linux/include/linux/personality.h Fri Mar 30 17:27:44 2001
23266 #include <asm/current.h>
23268 /* Flags for bug emulation. These occupy the top three bytes. */
23269 -#define STICKY_TIMEOUTS 0x4000000
23270 -#define WHOLE_SECONDS 0x2000000
23271 +#define MMAP_PAGE_ZERO 0x0100000
23272 #define ADDR_LIMIT_32BIT 0x0800000
23273 +#define SHORT_INODE 0x1000000
23274 +#define WHOLE_SECONDS 0x2000000
23275 +#define STICKY_TIMEOUTS 0x4000000
23277 /* Personality types. These go in the low byte. Avoid using the top bit,
23278 * it will conflict with error returns.
23279 @@ -16,20 +18,28 @@
23280 #define PER_MASK (0x00ff)
23281 #define PER_LINUX (0x0000)
23282 #define PER_LINUX_32BIT (0x0000 | ADDR_LIMIT_32BIT)
23283 -#define PER_SVR4 (0x0001 | STICKY_TIMEOUTS)
23284 -#define PER_SVR3 (0x0002 | STICKY_TIMEOUTS)
23285 -#define PER_SCOSVR3 (0x0003 | STICKY_TIMEOUTS | WHOLE_SECONDS)
23286 -#define PER_WYSEV386 (0x0004 | STICKY_TIMEOUTS)
23287 +#define PER_SVR4 (0x0001 | STICKY_TIMEOUTS | MMAP_PAGE_ZERO)
23288 +#define PER_SVR3 (0x0002 | STICKY_TIMEOUTS | SHORT_INODE)
23289 +#define PER_SCOSVR3 (0x0003 | STICKY_TIMEOUTS | WHOLE_SECONDS | SHORT_INODE)
23290 +#define PER_WYSEV386 (0x0004 | STICKY_TIMEOUTS | SHORT_INODE)
23291 #define PER_ISCR4 (0x0005 | STICKY_TIMEOUTS)
23292 #define PER_BSD (0x0006)
23293 #define PER_SUNOS (PER_BSD | STICKY_TIMEOUTS)
23294 -#define PER_XENIX (0x0007 | STICKY_TIMEOUTS)
23295 +#define PER_XENIX (0x0007 | STICKY_TIMEOUTS | SHORT_INODE)
23296 #define PER_LINUX32 (0x0008)
23297 #define PER_IRIX32 (0x0009 | STICKY_TIMEOUTS) /* IRIX5 32-bit */
23298 #define PER_IRIXN32 (0x000a | STICKY_TIMEOUTS) /* IRIX6 new 32-bit */
23299 #define PER_IRIX64 (0x000b | STICKY_TIMEOUTS) /* IRIX6 64-bit */
23300 #define PER_RISCOS (0x000c)
23301 #define PER_SOLARIS (0x000d | STICKY_TIMEOUTS)
23302 +#define PER_UW7 (0x000e | STICKY_TIMEOUTS | MMAP_PAGE_ZERO)
23304 +static __inline__ int
23305 +personality(int pers)
23307 + return (pers & PER_MASK);
23311 /* Prototype for an lcall7 syscall handler. */
23312 typedef void (*lcall7_func)(int, struct pt_regs *);
23314 unsigned char pers_low, pers_high;
23315 unsigned long * signal_map;
23316 unsigned long * signal_invmap;
23317 + struct map_segment * err_map;
23318 + struct map_segment * socktype_map;
23319 + struct map_segment * sockopt_map;
23320 + struct map_segment * af_map;
23321 struct module * module;
23322 struct exec_domain *next;
23325 #define get_exec_domain(it) \
23326 if (it && it->module) __MOD_INC_USE_COUNT(it->module);
23327 extern void __set_personality(unsigned long personality);
23328 -#define set_personality(pers) do { \
23329 - if (current->personality != pers) \
23330 - __set_personality(pers); \
23331 +#define set_personality(pers) do { \
23332 + if (current->personality != pers) { \
23333 + __set_personality(pers); \
23334 + printk(KERN_DEBUG "[%s:%d]: set personality to %lx\n", \
23335 + current->comm, current->pid, pers); \
23338 asmlinkage long sys_personality(unsigned long personality);
23340 diff -uNr --exclude-from=dontdiff linux-2.4.3/kernel/ksyms.c linux/kernel/ksyms.c
23341 --- linux-2.4.3/kernel/ksyms.c Fri Mar 30 14:48:47 2001
23342 +++ linux/kernel/ksyms.c Fri Mar 30 17:25:23 2001
23345 extern void *sys_call_table;
23347 +extern int max_threads;
23349 extern int request_dma(unsigned int dmanr, char * deviceID);
23350 extern void free_dma(unsigned int dmanr);
23351 @@ -576,3 +576,6 @@
23353 EXPORT_SYMBOL(tasklist_lock);
23354 EXPORT_SYMBOL(pidhash);
23356 +EXPORT_SYMBOL(max_threads);