summaryrefslogtreecommitdiff
path: root/sysdeps/unix
diff options
context:
space:
mode:
authorIgor Pashev <pashev.igor@gmail.com>2012-06-05 02:09:04 +0400
committerIgor Pashev <pashev.igor@gmail.com>2012-06-05 02:09:04 +0400
commit415ee7d6e47dcb3e0906a7bebc6d52ab8ed899da (patch)
treef7773ad82023c8616b339d84faa4bb7643af0311 /sysdeps/unix
parent3cc0cd4c5b3bed6f7d9aff26322d505785e11aa9 (diff)
downloadglibc-415ee7d6e47dcb3e0906a7bebc6d52ab8ed899da.tar.gz
Merged changes from kopensolaris-gnu project
http://git.csclub.uwaterloo.ca/?p=kopensolaris-gnu/glibc.git Commits from 9157319 to bad8ac8. This is only partial patch, some changes to not apply and will be resovled and committed next.
Diffstat (limited to 'sysdeps/unix')
-rw-r--r--sysdeps/unix/inet/syscalls.list2
-rw-r--r--sysdeps/unix/make-syscalls.sh2
-rw-r--r--sysdeps/unix/opendir.c2
-rw-r--r--sysdeps/unix/sysv/linux/getdents.c4
-rw-r--r--sysdeps/unix/sysv/linux/proc_service.h87
-rw-r--r--sysdeps/unix/sysv/linux/thread_db.h459
-rw-r--r--sysdeps/unix/sysv/linux/ttyname.c3
-rw-r--r--sysdeps/unix/sysv/linux/ttyname_r.c4
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/Implies4
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/Makefile160
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/Subdirs1
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/Versions146
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/_G_config.h101
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/_fgetuserattr.c84
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/_getauthattr.c45
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/_getauthnam.c44
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/_getauuserent.c45
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/_getauusernam.c44
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/_getexecattr.c45
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/_getexecprof.c29
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/_getprofattr.c45
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/_getprofnam.c44
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/_getuserattr.c45
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/_getusernam.c44
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/_lgrp_home_fast.S6
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/_link_aton.c38
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/_link_ntoa.c48
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/_sbrk_grow_aligned.c61
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/accept.c38
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/access.c96
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/aio_sigqueue.c35
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/allocids.c37
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/ascftime.c34
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/atomic.c220
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/atomic.h4
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/auditP.h74
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/audit_user-lookup.c23
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/auth_attr-lookup.c23
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/auth_attrP.h44
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/automount-lookup.c23
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bind.c35
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/confname.h675
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/dirent.h53
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/elfclass.h79
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/errno.h184
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/fcntl.h267
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/in.h194
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/ioctl-types.h87
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/ioctls.h305
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/ipc.h54
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/local_lim.h99
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/mman.h186
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/msq.h68
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/netdb.h61
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/poll.h43
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/posix_opt.h82
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/resource.h240
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/sched.h153
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/sem.h74
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/shm.h77
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/sigaction.h94
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/sigcontext.h24
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/siginfo.h497
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/signum.h90
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/sigset.h139
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/sigstack.h78
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/socket.h336
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/stat.h230
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/statfs.h68
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/statvfs.h134
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/stropts.h256
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/syslog-path.h29
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/termios.h241
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/time.h207
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/types.h350
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/typesizes.h67
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/uio.h93
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/utmp.h125
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/utmpx.h126
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/utsname.h26
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/waitflags.h35
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/waitstatus.h116
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/xtitypes.h1
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bootparams-lookup.c23
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/brk.c91
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/cftime.c34
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/check_fds.c25
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/check_pf.c12
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/clock.c1
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/clock_gettime.S5
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/clock_nanosleep.c25
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/clock_settime.S4
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/closefrom.c37
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/cmsg_nxthdr.c1
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/configure9
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/configure.in6
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/connect.c39
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/deflt.c119
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/deflt.h41
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/defltP.h27
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/dl-execstack.c52
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/dl-sysdep.c35
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/dl-sysdep.h39
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/door.c261
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/door.h47
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/doorP.h30
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/dup2.c38
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/euidaccess.c37
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/exec_attr-lookup.c23
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/exec_attrP.h46
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/exit-thread.S23
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/faccessat.c107
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/fattach.c31
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/fcntl.c79
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/fdatasync.c31
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/fdetach.c28
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/fdwalk.c69
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/fexecve.c1
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/files-audit_user.c43
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/files-auth_attr.c46
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/files-bootparams.c1
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/files-exec_attr.c48
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/files-netmasks.c1
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/files-printers.c1
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/files-prof_attr.c45
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/files-project.c47
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/files-user_attr.c39
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/fork.c45
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/fstab.c1
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/fstatfs.c7
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/fstatfs64.c7
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/fsync.c32
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/ftime.c1
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/ftruncate.c36
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/ftruncate64.c36
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/futimes.c46
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/fxstat.c39
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/fxstat64.c39
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/fxstatat.c40
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/fxstatat64.c43
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/gai_sigqueue.c34
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/get_child_max.c28
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/getclktck.c36
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/getcwd.c86
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/getdents.c32
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/getdents64.c34
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/getdirentries.c1
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/getdirentries64.c1
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/getdomain.c31
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/getdtsz.c29
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/getexecname.c28
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/gethostent.c50
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/gethostid.c1
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/gethostname.c33
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/gethrtime.S6
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/gethrvtime.S6
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/getipv4sourcefilter.c64
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/getloadavg.c41
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/getpagesize.c39
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/getpeername.c35
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/getpriority.c47
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/getpt.c37
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/getrusage.c52
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/getsockname.c36
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/getsockopt.c35
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/getsourcefilter.c72
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/getsysstats.c54
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/grantpt.c86
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/htonll.c37
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/i386/Implies1
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/i386/Makefile3
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/i386/__door_return.S77
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/i386/getcontext.S72
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/i386/lsee64.S38
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/i386/makecontext.c50
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/i386/profil-counter.h27
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/i386/swapcontext.S86
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/i386/sys/trap.h61
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/i386/syscall.S51
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/i386/sysdep.S40
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/i386/sysdep.h324
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/i386/ucontext_i.sym31
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/i386/vfork.S59
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/if_index.c165
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/ifreq.c56
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/inet_ntoa_r.c34
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/init-first.c133
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/inline-syscall.h35
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/iopopen.c90
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/ipsecalg.c42
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/kernel-features.h38
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/klogctl.c31
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/ldsodefs.h53
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/linux/posix_types.h1
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/listen.c33
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/lltostr.c30
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/lseek64.S16
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/lxstat.c39
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/lxstat64.c39
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/madvise.c29
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/malloc-machine.h28
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/meminfo.c38
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/mknodat.c52
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/mlock.c26
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/mlockall.c27
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/mntent.h100
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/mntent_sun.c119
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/mnttab.c121
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/msync.c37
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/munlock.c26
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/munlockall.c26
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/net/if.h574
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/net/if_dl.h37
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/netinet/tcp.h217
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/netinet/udp.h75
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/netmask.c29
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/netmasks-lookup.c23
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/not-cancel.h98
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/open-func.c112
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/open.c35
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/open64.c34
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/openat.c35
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/openat64.c35
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/openpty.c30
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/paths.h74
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/pcsample.h31
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/pipe.c51
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/poll.c43
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/port.c127
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/port.h35
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/posix_fallocate.c33
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/posix_fallocate64.c33
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/posix_madvise.c27
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/printers-lookup.c23
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/priocntl.c79
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/priorityP.h55
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/priv.c326
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/priv.h75
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/privP.c285
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/privP.h48
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/priv_str.c104
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/proc_service.h106
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/procfs.h30
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/prof_attr-lookup.c23
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/prof_attrP.h43
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/profil.S7
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/project-lookup.c23
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/projectP.h44
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/pselect.c140
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/pset_getloadavg.c42
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/ptsname.c100
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/putmsg.c35
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/putpmsg.c37
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/rctl.c198
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/rctl.h48
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/readdir64.c1
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/readdir64_r.c1
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/reboot.c55
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/recvmsg.c36
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/remove.c42
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/res_init.c2
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/rtld_db.h147
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sa_len.c41
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/schedP.c183
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/schedP.h63
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sched_getp.c37
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sched_gets.c38
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sched_primax.c42
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sched_primin.c42
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sched_rr_gi.c68
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sched_setp.c37
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sched_sets.c39
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/select.c46
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/send.c49
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sendfile.c37
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sendfile64.c37
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sendfilev.c35
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sendfilev64.c35
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sendmsg.c45
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sendto.c50
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/setdomain.c31
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sethostid.c1
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sethostname.c31
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/setipv4sourcefilter.c62
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/setpriority.c48
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/setsockopt.c37
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/setsourcefilter.c69
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/settaskid.c36
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/shutdown.c31
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sig2str.c88
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sigaction.c155
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/siglist.h25
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/signal.c43
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sigprocmask.c69
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sigqueue.c33
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sigreturn.c1
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sigsend.c30
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sigset-cvt-mask.h45
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sigstack.c3
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sigsuspend.S7
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sigtimedwait.c68
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sigwait.c52
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sigwaitinfo.c34
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sleep.c35
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/socket.c35
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/socketP.h33
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/socketpair.c73
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/speed.c89
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/stack_getbounds.c34
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/statfs.c8
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/statfs64.c7
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/statfs_common.c52
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/swapoff.c32
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/swapon.c33
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/acct.h62
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/acctctl.h155
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/acl.h207
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/atomic.h74
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/auxv.h53
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/byteorder.h47
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/corectl.h76
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/dirent.h1
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/door.h143
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/elf.h77
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/exacct.h134
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/fault.h42
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/feature_tests.h79
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/fork.h36
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/fsid.h29
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/fstyp.h36
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/instance.h34
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/int_types.h1
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/inttypes.h1
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/ioccom.h1
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/klog.h34
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/link.h45
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/loadavg.h31
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/machelf.h88
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/machtypes.h25
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/mkdev.h47
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/mntio.h52
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/mnttab.h82
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/mount.h69
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/old_procfs.h339
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/param.h139
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/port.h77
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/port_impl.h40
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/priocntl.h119
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/priv.h115
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/priv_names.h101
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/processor.h83
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/procfs.h487
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/procset.h79
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/pset.h67
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/ptms.h37
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/rctl.h93
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/rctl_impl.h52
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/reboot.h52
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/reg.h1
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/sendfile.h91
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/sid.h28
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/siginfo.h25
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/sockio.h1
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/swap.h78
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/syscall.h301
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/sysconfig.h66
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/sysmacros.h107
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/systeminfo.h53
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/task.h44
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/termio.h1
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/time_impl.h1
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/timex.h155
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/tsol/label.h44
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/ttold.h35
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/tty.h25
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/ttydefaults.h101
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/types32.h66
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/uadmin.h65
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/ucontext.h65
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/utime.h37
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/utssys.h81
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/vfstab.h58
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/wait.h172
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/zone.h166
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/syscallP.h243
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/syscalls.list240
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sysconf.c106
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/system.c81
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/tcdrain.c41
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/tcgetattr.c31
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/tcsetattr.c44
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/termio.h6
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/thr_sighndlrinfo.c30
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/thread_db.h454
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/time.c32
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/truncate.c41
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/truncate64.c40
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/ttyname.c49
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/ttyname_r.c3
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/ualarm.c1
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/ucred.c328
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/ucred.h54
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/ucredP.h43
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/ulimit.h50
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/ulltostr.c30
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/umount.c28
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/uname.c48
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/unlockpt.c40
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/user_attr-lookup.c23
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/user_attrP.h43
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/usleep.c1
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/ustat.c34
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/vfstab.c117
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/wait.c3
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/wait3.c1
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/wait4.c60
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/waitpid.c92
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/x86/Makefile6
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/x86/Versions5
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/x86/bits/machtypes.h53
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/x86/bits/regset.h139
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/x86/door-offsets.sym6
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/x86/sys/isa_defs.h73
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/x86/sys/procfs_isa.h81
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/x86/sys/regset.h97
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/x86/sys/stack.h27
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/x86/syscalls.list3
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/x86_64/Implies1
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/x86_64/Makefile3
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/x86_64/syscall.S51
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/x86_64/vfork.S56
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/xmknod.c49
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/xstat.c39
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/xstat64.c39
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/zone.c101
-rw-r--r--sysdeps/unix/sysv/solaris2/kopensolaris-gnu/zone.h56
436 files changed, 29370 insertions, 2 deletions
diff --git a/sysdeps/unix/inet/syscalls.list b/sysdeps/unix/inet/syscalls.list
index aafafd1df7..7727da2015 100644
--- a/sysdeps/unix/inet/syscalls.list
+++ b/sysdeps/unix/inet/syscalls.list
@@ -9,7 +9,7 @@ getpeername - getpeername i:ibN __getpeername getpeername
getsockname - getsockname i:ibN __getsockname getsockname
getsockopt - getsockopt i:iiiBN getsockopt
listen - listen i:ii __listen listen
-recv - recv Ci:ibni __libc_recv recv
+recv - recv Ci:ibni __libc_recv __recv recv
recvfrom - recvfrom Ci:ibniBN __libc_recvfrom __recvfrom recvfrom
recvmsg - recvmsg Ci:ipi __libc_recvmsg __recvmsg recvmsg
send - send Ci:ibni __libc_send __send send
diff --git a/sysdeps/unix/make-syscalls.sh b/sysdeps/unix/make-syscalls.sh
index 2bc7cc02a8..a700c167af 100644
--- a/sysdeps/unix/make-syscalls.sh
+++ b/sysdeps/unix/make-syscalls.sh
@@ -171,7 +171,7 @@ while read file srcfile caller syscall args strong weak; do
# Make sure only the first syscall rule is used, if multiple dirs
# define the same syscall.
echo ''
- echo "#### CALL=$file NUMBER=$callnum ARGS=$args SOURCE=$srcfile"
+ echo "#### CALL=$file NUMBER=$callnum SUBNUMBER=$subcallnum ARGS=$args SOURCE=$srcfile"
# If there are versioned aliases the entry is only generated for the
# shared library, unless it is a default version.
diff --git a/sysdeps/unix/opendir.c b/sysdeps/unix/opendir.c
index e093142f62..de3ecf3c8d 100644
--- a/sysdeps/unix/opendir.c
+++ b/sysdeps/unix/opendir.c
@@ -160,6 +160,7 @@ weak_alias (__opendir, opendir)
#ifdef __ASSUME_O_CLOEXEC
# define check_have_o_cloexec(fd) 1
#else
+#ifdef O_CLOEXEC
static int
check_have_o_cloexec (int fd)
{
@@ -168,6 +169,7 @@ check_have_o_cloexec (int fd)
return __have_o_cloexec > 0;
}
#endif
+#endif
DIR *
diff --git a/sysdeps/unix/sysv/linux/getdents.c b/sysdeps/unix/sysv/linux/getdents.c
index ac4979efb2..9af50eff92 100644
--- a/sysdeps/unix/sysv/linux/getdents.c
+++ b/sysdeps/unix/sysv/linux/getdents.c
@@ -56,6 +56,7 @@ extern int __have_no_getdents64 attribute_hidden;
Here is the kernel definition of `struct dirent' as of 2.1.20: */
+#ifndef __KERNEL_DIRENT
struct kernel_dirent
{
long int d_ino;
@@ -64,6 +65,7 @@ struct kernel_dirent
char d_name[256];
};
+# ifdef __NR_getdents64
struct kernel_dirent64
{
uint64_t d_ino;
@@ -72,6 +74,8 @@ struct kernel_dirent64
unsigned char d_type;
char d_name[256];
};
+# endif
+#endif
#ifndef __GETDENTS
# define __GETDENTS __getdents
diff --git a/sysdeps/unix/sysv/linux/proc_service.h b/sysdeps/unix/sysv/linux/proc_service.h
new file mode 100644
index 0000000000..d49e87ab30
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/proc_service.h
@@ -0,0 +1,87 @@
+/* Callback interface for libthread_db, functions users must define.
+ Copyright (C) 1999,2002,2003 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+/* The definitions in this file must correspond to those in the debugger. */
+#include <sys/procfs.h>
+
+/* Functions in this interface return one of these status codes. */
+typedef enum
+{
+ PS_OK, /* Generic "call succeeded". */
+ PS_ERR, /* Generic error. */
+ PS_BADPID, /* Bad process handle. */
+ PS_BADLID, /* Bad LWP identifier. */
+ PS_BADADDR, /* Bad address. */
+ PS_NOSYM, /* Could not find given symbol. */
+ PS_NOFREGS /* FPU register set not available for given LWP. */
+} ps_err_e;
+
+
+/* This type is opaque in this interface.
+ It's defined by the user of libthread_db. */
+struct ps_prochandle;
+
+
+/* Read or write process memory at the given address. */
+extern ps_err_e ps_pdread (struct ps_prochandle *,
+ psaddr_t, void *, size_t);
+extern ps_err_e ps_pdwrite (struct ps_prochandle *,
+ psaddr_t, const void *, size_t);
+extern ps_err_e ps_ptread (struct ps_prochandle *,
+ psaddr_t, void *, size_t);
+extern ps_err_e ps_ptwrite (struct ps_prochandle *,
+ psaddr_t, const void *, size_t);
+
+
+/* Get and set the given LWP's general or FPU register set. */
+extern ps_err_e ps_lgetregs (struct ps_prochandle *,
+ lwpid_t, prgregset_t);
+extern ps_err_e ps_lsetregs (struct ps_prochandle *,
+ lwpid_t, const prgregset_t);
+extern ps_err_e ps_lgetfpregs (struct ps_prochandle *,
+ lwpid_t, prfpregset_t *);
+extern ps_err_e ps_lsetfpregs (struct ps_prochandle *,
+ lwpid_t, const prfpregset_t *);
+
+/* Return the PID of the process. */
+extern pid_t ps_getpid (struct ps_prochandle *);
+
+/* Fetch the special per-thread address associated with the given LWP.
+ This call is only used on a few platforms (most use a normal register).
+ The meaning of the `int' parameter is machine-dependent. */
+extern ps_err_e ps_get_thread_area (const struct ps_prochandle *,
+ lwpid_t, int, psaddr_t *);
+
+
+/* Look up the named symbol in the named DSO in the symbol tables
+ associated with the process being debugged, filling in *SYM_ADDR
+ with the corresponding run-time address. */
+extern ps_err_e ps_pglobal_lookup (struct ps_prochandle *,
+ const char *object_name,
+ const char *sym_name,
+ psaddr_t *sym_addr);
+
+
+/* Stop or continue the entire process. */
+extern ps_err_e ps_pstop (const struct ps_prochandle *);
+extern ps_err_e ps_pcontinue (const struct ps_prochandle *);
+
+/* Stop or continue the given LWP alone. */
+extern ps_err_e ps_lstop (const struct ps_prochandle *, lwpid_t);
+extern ps_err_e ps_lcontinue (const struct ps_prochandle *, lwpid_t);
diff --git a/sysdeps/unix/sysv/linux/thread_db.h b/sysdeps/unix/sysv/linux/thread_db.h
new file mode 100644
index 0000000000..433b54fd5d
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/thread_db.h
@@ -0,0 +1,459 @@
+/* thread_db.h -- interface to libthread_db.so library for debugging -lpthread
+ Copyright (C) 1999,2001,2002,2003 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _THREAD_DB_H
+#define _THREAD_DB_H 1
+
+/* This is the debugger interface for the NPTL library. It is
+ modelled closely after the interface with same names in Solaris
+ with the goal to share the same code in the debugger. */
+#include <pthread.h>
+#include <stdint.h>
+#include <sys/types.h>
+#include <sys/procfs.h>
+
+
+/* Error codes of the library. */
+typedef enum
+{
+ TD_OK, /* No error. */
+ TD_ERR, /* No further specified error. */
+ TD_NOTHR, /* No matching thread found. */
+ TD_NOSV, /* No matching synchronization handle found. */
+ TD_NOLWP, /* No matching light-weighted process found. */
+ TD_BADPH, /* Invalid process handle. */
+ TD_BADTH, /* Invalid thread handle. */
+ TD_BADSH, /* Invalid synchronization handle. */
+ TD_BADTA, /* Invalid thread agent. */
+ TD_BADKEY, /* Invalid key. */
+ TD_NOMSG, /* No event available. */
+ TD_NOFPREGS, /* No floating-point register content available. */
+ TD_NOLIBTHREAD, /* Application not linked with thread library. */
+ TD_NOEVENT, /* Requested event is not supported. */
+ TD_NOCAPAB, /* Capability not available. */
+ TD_DBERR, /* Internal debug library error. */
+ TD_NOAPLIC, /* Operation is not applicable. */
+ TD_NOTSD, /* No thread-specific data available. */
+ TD_MALLOC, /* Out of memory. */
+ TD_PARTIALREG, /* Not entire register set was read or written. */
+ TD_NOXREGS, /* X register set not available for given thread. */
+ TD_TLSDEFER, /* Thread has not yet allocated TLS for given module. */
+ TD_NOTALLOC = TD_TLSDEFER,
+ TD_VERSION, /* Version if libpthread and libthread_db do not match. */
+ TD_NOTLS /* There is no TLS segment in the given module. */
+} td_err_e;
+
+
+/* Possible thread states. TD_THR_ANY_STATE is a pseudo-state used to
+ select threads regardless of state in td_ta_thr_iter(). */
+typedef enum
+{
+ TD_THR_ANY_STATE,
+ TD_THR_UNKNOWN,
+ TD_THR_STOPPED,
+ TD_THR_RUN,
+ TD_THR_ACTIVE,
+ TD_THR_ZOMBIE,
+ TD_THR_SLEEP,
+ TD_THR_STOPPED_ASLEEP
+} td_thr_state_e;
+
+/* Thread type: user or system. TD_THR_ANY_TYPE is a pseudo-type used
+ to select threads regardless of type in td_ta_thr_iter(). */
+typedef enum
+{
+ TD_THR_ANY_TYPE,
+ TD_THR_USER,
+ TD_THR_SYSTEM
+} td_thr_type_e;
+
+
+/* Types of the debugging library. */
+
+/* Handle for a process. This type is opaque. */
+typedef struct td_thragent td_thragent_t;
+
+/* The actual thread handle type. This is also opaque. */
+typedef struct td_thrhandle
+{
+ td_thragent_t *th_ta_p;
+ psaddr_t th_unique;
+} td_thrhandle_t;
+
+
+/* Forward declaration of a type defined by and for the dynamic linker. */
+struct link_map;
+
+
+/* Flags for `td_ta_thr_iter'. */
+#define TD_THR_ANY_USER_FLAGS 0xffffffff
+#define TD_THR_LOWEST_PRIORITY -20
+#define TD_SIGNO_MASK NULL
+
+
+#define TD_EVENTSIZE 2
+#define BT_UISHIFT 5 /* log base 2 of BT_NBIPUI, to extract word index */
+#define BT_NBIPUI (1 << BT_UISHIFT) /* n bits per uint */
+#define BT_UIMASK (BT_NBIPUI - 1) /* to extract bit index */
+
+/* Bitmask of enabled events. */
+typedef struct td_thr_events
+{
+ uint32_t event_bits[TD_EVENTSIZE];
+} td_thr_events_t;
+
+/* Event set manipulation macros. */
+#define __td_eventmask(n) \
+ (UINT32_C (1) << (((n) - 1) & BT_UIMASK))
+#define __td_eventword(n) \
+ ((UINT32_C ((n) - 1)) >> BT_UISHIFT)
+
+#define td_event_emptyset(setp) \
+ do { \
+ int __i; \
+ for (__i = TD_EVENTSIZE; __i > 0; --__i) \
+ (setp)->event_bits[__i - 1] = 0; \
+ } while (0)
+
+#define td_event_fillset(setp) \
+ do { \
+ int __i; \
+ for (__i = TD_EVENTSIZE; __i > 0; --__i) \
+ (setp)->event_bits[__i - 1] = UINT32_C (0xffffffff); \
+ } while (0)
+
+#define td_event_addset(setp, n) \
+ (((setp)->event_bits[__td_eventword (n)]) |= __td_eventmask (n))
+#define td_event_delset(setp, n) \
+ (((setp)->event_bits[__td_eventword (n)]) &= ~__td_eventmask (n))
+#define td_eventismember(setp, n) \
+ (__td_eventmask (n) & ((setp)->event_bits[__td_eventword (n)]))
+#if TD_EVENTSIZE == 2
+# define td_eventisempty(setp) \
+ (!((setp)->event_bits[0]) && !((setp)->event_bits[1]))
+#else
+# error "td_eventisempty must be changed to match TD_EVENTSIZE"
+#endif
+
+/* Events reportable by the thread implementation. */
+typedef enum
+{
+ TD_ALL_EVENTS, /* Pseudo-event number. */
+ TD_EVENT_NONE = TD_ALL_EVENTS, /* Depends on context. */
+ TD_READY, /* Is executable now. */
+ TD_SLEEP, /* Blocked in a synchronization obj. */
+ TD_SWITCHTO, /* Now assigned to a process. */
+ TD_SWITCHFROM, /* Not anymore assigned to a process. */
+ TD_LOCK_TRY, /* Trying to get an unavailable lock. */
+ TD_CATCHSIG, /* Signal posted to the thread. */
+ TD_IDLE, /* Process getting idle. */
+ TD_CREATE, /* New thread created. */
+ TD_DEATH, /* Thread terminated. */
+ TD_PREEMPT, /* Preempted. */
+ TD_PRI_INHERIT, /* Inherited elevated priority. */
+ TD_REAP, /* Reaped. */
+ TD_CONCURRENCY, /* Number of processes changing. */
+ TD_TIMEOUT, /* Conditional variable wait timed out. */
+ TD_MIN_EVENT_NUM = TD_READY,
+ TD_MAX_EVENT_NUM = TD_TIMEOUT,
+ TD_EVENTS_ENABLE = 31 /* Event reporting enabled. */
+} td_event_e;
+
+/* Values representing the different ways events are reported. */
+typedef enum
+{
+ NOTIFY_BPT, /* User must insert breakpoint at u.bptaddr. */
+ NOTIFY_AUTOBPT, /* Breakpoint at u.bptaddr is automatically
+ inserted. */
+ NOTIFY_SYSCALL /* System call u.syscallno will be invoked. */
+} td_notify_e;
+
+/* Description how event type is reported. */
+typedef struct td_notify
+{
+ td_notify_e type; /* Way the event is reported. */
+ union
+ {
+ psaddr_t bptaddr; /* Address of breakpoint. */
+ int syscallno; /* Number of system call used. */
+ } u;
+} td_notify_t;
+
+/* Structure used to report event. */
+typedef struct td_event_msg
+{
+ td_event_e event; /* Event type being reported. */
+ const td_thrhandle_t *th_p; /* Thread reporting the event. */
+ union
+ {
+# if 0
+ td_synchandle_t *sh; /* Handle of synchronization object. */
+#endif
+ uintptr_t data; /* Event specific data. */
+ } msg;
+} td_event_msg_t;
+
+/* Structure containing event data available in each thread structure. */
+typedef struct
+{
+ td_thr_events_t eventmask; /* Mask of enabled events. */
+ td_event_e eventnum; /* Number of last event. */
+ void *eventdata; /* Data associated with event. */
+} td_eventbuf_t;
+
+
+/* Gathered statistics about the process. */
+typedef struct td_ta_stats
+{
+ int nthreads; /* Total number of threads in use. */
+ int r_concurrency; /* Concurrency level requested by user. */
+ int nrunnable_num; /* Average runnable threads, numerator. */
+ int nrunnable_den; /* Average runnable threads, denominator. */
+ int a_concurrency_num; /* Achieved concurrency level, numerator. */
+ int a_concurrency_den; /* Achieved concurrency level, denominator. */
+ int nlwps_num; /* Average number of processes in use,
+ numerator. */
+ int nlwps_den; /* Average number of processes in use,
+ denominator. */
+ int nidle_num; /* Average number of idling processes,
+ numerator. */
+ int nidle_den; /* Average number of idling processes,
+ denominator. */
+} td_ta_stats_t;
+
+
+/* Since Sun's library is based on Solaris threads we have to define a few
+ types to map them to POSIX threads. */
+typedef pthread_t thread_t;
+typedef pthread_key_t thread_key_t;
+
+
+/* Callback for iteration over threads. */
+typedef int td_thr_iter_f (const td_thrhandle_t *, void *);
+
+/* Callback for iteration over thread local data. */
+typedef int td_key_iter_f (thread_key_t, void (*) (void *), void *);
+
+
+
+/* Forward declaration. This has to be defined by the user. */
+struct ps_prochandle;
+
+
+/* Information about the thread. */
+typedef struct td_thrinfo
+{
+ td_thragent_t *ti_ta_p; /* Process handle. */
+ unsigned int ti_user_flags; /* Unused. */
+ thread_t ti_tid; /* Thread ID returned by
+ pthread_create(). */
+ char *ti_tls; /* Pointer to thread-local data. */
+ psaddr_t ti_startfunc; /* Start function passed to
+ pthread_create(). */
+ psaddr_t ti_stkbase; /* Base of thread's stack. */
+ long int ti_stksize; /* Size of thread's stack. */
+ psaddr_t ti_ro_area; /* Unused. */
+ int ti_ro_size; /* Unused. */
+ td_thr_state_e ti_state; /* Thread state. */
+ unsigned char ti_db_suspended; /* Nonzero if suspended by debugger. */
+ td_thr_type_e ti_type; /* Type of the thread (system vs
+ user thread). */
+ intptr_t ti_pc; /* Unused. */
+ intptr_t ti_sp; /* Unused. */
+ short int ti_flags; /* Unused. */
+ int ti_pri; /* Thread priority. */
+ lwpid_t ti_lid; /* Kernel PID for this thread. */
+ sigset_t ti_sigmask; /* Signal mask. */
+ unsigned char ti_traceme; /* Nonzero if event reporting
+ enabled. */
+ unsigned char ti_preemptflag; /* Unused. */
+ unsigned char ti_pirecflag; /* Unused. */
+ sigset_t ti_pending; /* Set of pending signals. */
+ td_thr_events_t ti_events; /* Set of enabled events. */
+} td_thrinfo_t;
+
+
+
+/* Prototypes for exported library functions. */
+
+/* Initialize the thread debug support library. */
+extern td_err_e td_init (void);
+
+/* Historical relict. Should not be used anymore. */
+extern td_err_e td_log (void);
+
+/* Return list of symbols the library can request. */
+extern const char **td_symbol_list (void);
+
+/* Generate new thread debug library handle for process PS. */
+extern td_err_e td_ta_new (struct ps_prochandle *__ps, td_thragent_t **__ta);
+
+/* Free resources allocated for TA. */
+extern td_err_e td_ta_delete (td_thragent_t *__ta);
+
+/* Get number of currently running threads in process associated with TA. */
+extern td_err_e td_ta_get_nthreads (const td_thragent_t *__ta, int *__np);
+
+/* Return process handle passed in `td_ta_new' for process associated with
+ TA. */
+extern td_err_e td_ta_get_ph (const td_thragent_t *__ta,
+ struct ps_prochandle **__ph);
+
+/* Map thread library handle PT to thread debug library handle for process
+ associated with TA and store result in *TH. */
+extern td_err_e td_ta_map_id2thr (const td_thragent_t *__ta, pthread_t __pt,
+ td_thrhandle_t *__th);
+
+/* Map process ID LWPID to thread debug library handle for process
+ associated with TA and store result in *TH. */
+extern td_err_e td_ta_map_lwp2thr (const td_thragent_t *__ta, lwpid_t __lwpid,
+ td_thrhandle_t *__th);
+
+
+/* Call for each thread in a process associated with TA the callback function
+ CALLBACK. */
+extern td_err_e td_ta_thr_iter (const td_thragent_t *__ta,
+ td_thr_iter_f *__callback, void *__cbdata_p,
+ td_thr_state_e __state, int __ti_pri,
+ sigset_t *__ti_sigmask_p,
+ unsigned int __ti_user_flags);
+
+/* Call for each defined thread local data entry the callback function KI. */
+extern td_err_e td_ta_tsd_iter (const td_thragent_t *__ta, td_key_iter_f *__ki,
+ void *__p);
+
+
+/* Get event address for EVENT. */
+extern td_err_e td_ta_event_addr (const td_thragent_t *__ta,
+ td_event_e __event, td_notify_t *__ptr);
+
+/* Enable EVENT in global mask. */
+extern td_err_e td_ta_set_event (const td_thragent_t *__ta,
+ td_thr_events_t *__event);
+
+/* Disable EVENT in global mask. */
+extern td_err_e td_ta_clear_event (const td_thragent_t *__ta,
+ td_thr_events_t *__event);
+
+/* Return information about last event. */
+extern td_err_e td_ta_event_getmsg (const td_thragent_t *__ta,
+ td_event_msg_t *__msg);
+
+
+/* Set suggested concurrency level for process associated with TA. */
+extern td_err_e td_ta_setconcurrency (const td_thragent_t *__ta, int __level);
+
+
+/* Enable collecting statistics for process associated with TA. */
+extern td_err_e td_ta_enable_stats (const td_thragent_t *__ta, int __enable);
+
+/* Reset statistics. */
+extern td_err_e td_ta_reset_stats (const td_thragent_t *__ta);
+
+/* Retrieve statistics from process associated with TA. */
+extern td_err_e td_ta_get_stats (const td_thragent_t *__ta,
+ td_ta_stats_t *__statsp);
+
+
+/* Validate that TH is a thread handle. */
+extern td_err_e td_thr_validate (const td_thrhandle_t *__th);
+
+/* Return information about thread TH. */
+extern td_err_e td_thr_get_info (const td_thrhandle_t *__th,
+ td_thrinfo_t *__infop);
+
+/* Retrieve floating-point register contents of process running thread TH. */
+extern td_err_e td_thr_getfpregs (const td_thrhandle_t *__th,
+ prfpregset_t *__regset);
+
+/* Retrieve general register contents of process running thread TH. */
+extern td_err_e td_thr_getgregs (const td_thrhandle_t *__th,
+ prgregset_t __gregs);
+
+/* Retrieve extended register contents of process running thread TH. */
+extern td_err_e td_thr_getxregs (const td_thrhandle_t *__th, void *__xregs);
+
+/* Get size of extended register set of process running thread TH. */
+extern td_err_e td_thr_getxregsize (const td_thrhandle_t *__th, int *__sizep);
+
+/* Set floating-point register contents of process running thread TH. */
+extern td_err_e td_thr_setfpregs (const td_thrhandle_t *__th,
+ const prfpregset_t *__fpregs);
+
+/* Set general register contents of process running thread TH. */
+extern td_err_e td_thr_setgregs (const td_thrhandle_t *__th,
+ prgregset_t __gregs);
+
+/* Set extended register contents of process running thread TH. */
+extern td_err_e td_thr_setxregs (const td_thrhandle_t *__th,
+ const void *__addr);
+
+
+/* Get address of the given module's TLS storage area for the given thread. */
+extern td_err_e td_thr_tlsbase (const td_thrhandle_t *__th,
+ unsigned long int __modid,
+ psaddr_t *__base);
+
+/* Get address of thread local variable. */
+extern td_err_e td_thr_tls_get_addr (const td_thrhandle_t *__th,
+ psaddr_t __map_address, size_t __offset,
+ psaddr_t *__address);
+
+
+/* Enable reporting for EVENT for thread TH. */
+extern td_err_e td_thr_event_enable (const td_thrhandle_t *__th, int __event);
+
+/* Enable EVENT for thread TH. */
+extern td_err_e td_thr_set_event (const td_thrhandle_t *__th,
+ td_thr_events_t *__event);
+
+/* Disable EVENT for thread TH. */
+extern td_err_e td_thr_clear_event (const td_thrhandle_t *__th,
+ td_thr_events_t *__event);
+
+/* Get event message for thread TH. */
+extern td_err_e td_thr_event_getmsg (const td_thrhandle_t *__th,
+ td_event_msg_t *__msg);
+
+
+/* Set priority of thread TH. */
+extern td_err_e td_thr_setprio (const td_thrhandle_t *__th, int __prio);
+
+
+/* Set pending signals for thread TH. */
+extern td_err_e td_thr_setsigpending (const td_thrhandle_t *__th,
+ unsigned char __n, const sigset_t *__ss);
+
+/* Set signal mask for thread TH. */
+extern td_err_e td_thr_sigsetmask (const td_thrhandle_t *__th,
+ const sigset_t *__ss);
+
+
+/* Return thread local data associated with key TK in thread TH. */
+extern td_err_e td_thr_tsd (const td_thrhandle_t *__th,
+ const thread_key_t __tk, void **__data);
+
+
+/* Suspend execution of thread TH. */
+extern td_err_e td_thr_dbsuspend (const td_thrhandle_t *__th);
+
+/* Resume execution of thread TH. */
+extern td_err_e td_thr_dbresume (const td_thrhandle_t *__th);
+
+#endif /* thread_db.h */
diff --git a/sysdeps/unix/sysv/linux/ttyname.c b/sysdeps/unix/sysv/linux/ttyname.c
index 3dacd40c23..e804ab323c 100644
--- a/sysdeps/unix/sysv/linux/ttyname.c
+++ b/sysdeps/unix/sysv/linux/ttyname.c
@@ -108,8 +108,10 @@ getttyname (const char *dev, dev_t mydev, ino64_t myino, int save, int *dostat)
}
+#ifndef __ASSUME_PROC_SELF_FD_NOT_SYMLINK
/* Static buffer in `ttyname'. */
libc_freeres_ptr (static char *ttyname_buf);
+#endif
/* Return the pathname of the terminal FD is open on, or NULL on errors.
@@ -167,6 +169,7 @@ ttyname (int fd)
len - UNREACHABLE_LEN);
len -= UNREACHABLE_LEN;
}
+#endif /* __ASSUME_PROC_SELF_FD_NOT_SYMLINK */
/* readlink need not terminate the string. */
ttyname_buf[len] = '\0';
diff --git a/sysdeps/unix/sysv/linux/ttyname_r.c b/sysdeps/unix/sysv/linux/ttyname_r.c
index 2dd6781348..259d727a54 100644
--- a/sysdeps/unix/sysv/linux/ttyname_r.c
+++ b/sysdeps/unix/sysv/linux/ttyname_r.c
@@ -96,10 +96,13 @@ getttyname_r (char *buf, size_t buflen, dev_t mydev, ino64_t myino,
int
__ttyname_r (int fd, char *buf, size_t buflen)
{
+#ifndef __ASSUME_PROC_SELF_FD_NOT_SYMLINK
char procname[30];
+#endif
struct stat64 st, st1;
int dostat = 0;
int save = errno;
+ ssize_t ret;
/* Test for the absolute minimal size. This makes life easier inside
the loop. */
@@ -149,6 +152,7 @@ __ttyname_r (int fd, char *buf, size_t buflen)
memmove (buf, buf + UNREACHABLE_LEN, ret - UNREACHABLE_LEN);
ret -= UNREACHABLE_LEN;
}
+#endif /* __ASSUME_PROC_SELF_FD_NOT_SYMLINK */
/* readlink need not terminate the string. */
buf[ret] = '\0';
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/Implies b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/Implies
new file mode 100644
index 0000000000..1799af40b8
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/Implies
@@ -0,0 +1,4 @@
+gnu
+unix/common
+unix/mman
+unix/inet
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/Makefile b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/Makefile
new file mode 100644
index 0000000000..980e2f7a89
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/Makefile
@@ -0,0 +1,160 @@
+#
+# additional routines and headers for libc
+#
+
+ifeq ($(subdir),csu)
+sysdep_routines += errno-loc
+endif
+
+ifeq ($(subdir),io)
+sysdep_routines += sys_open sys_open64 sys_openat sys_openat64 \
+ sys_fstat sys_fstat64 sys_fstatat sys_fstatat64 sys_lstat \
+ sys_lstat64 sys_stat sys_stat64 sys_sendfilev sys_sendfilev64 \
+ sys_getcwd sys_pipe sys_mknod sys_access sys_accessat
+headers := $(filter-out sys/vfs.h, $(headers))
+endif
+
+ifeq ($(subdir),misc)
+sysdep_routines += gethrtime mount umount umount2 systeminfo resolvepath \
+ getpagesizes memcntl meminfo uadmin getpflags setpflags issetugid ucred \
+ priv processor_bind processor_info p_online pset_create pset_destroy \
+ pset_assign pset_info pset_bind pset_getloadavg pset_list pset_setattr \
+ pset_getattr swapctl getustack setustack gethrvtime uucopy uucopystr \
+ zone_add_datalink zone_boot zone_check_datalink zone_destroy zone_enter \
+ zone_getattr zone_list zone_list_datalink zone_remove_datalink \
+ zone_setattr zone_shutdown zone_version core_get_default_content \
+ core_get_default_path core_get_global_content core_get_global_path \
+ core_get_options core_get_process_content core_get_process_path \
+ core_set_default_content core_set_default_path core_set_global_content \
+ core_set_global_path core_set_options core_set_process_content \
+ core_set_process_path getacct putacct wracct sysfs acct allocids \
+ idmap_reg idmap_unreg acctctl pcsample settaskid gettaskid getprojid \
+ utssys zone port sendfilev sendfilev64 sig2str _so_accept _so_bind \
+ _so_connect _so_getpeername _so_getsockname _so_getsockopt _so_listen \
+ _so_recvmsg _so_send _so_sendmsg _so_sendto _so_setsockopt _so_shutdown \
+ _so_socket _so_socketpair _sysconfig rctl atomic door __door_return \
+ getexecname is_system_labeled privP modctl acl facl lltostr ulltostr \
+ _getauthnam _getauthattr deflt _getprofnam _getprofattr _getusernam \
+ _getuserattr _getauuserent _getauusernam _getexecattr vfstab fdwalk \
+ closefrom ipsecalg gethostent sigsendset sigsend stack_getbounds \
+ thr_sighndlrinfo _getexecprof _fgetuserattr priv_str _sbrk_grow_aligned \
+ cftime ascftime inet_ntoa_r mnttab inst_sync autofssys cladm lgrpsys \
+ _lgrp_home_fast
+sysdep_routines += sys_fdsync sys_brk sys_fcntl sys_utssys sys_lwp_private \
+ sys_uname sys_getloadavg sys_utimes sys_getpeerucred sys_ucred_get \
+ sys_privsys sys_putmsg sys_putpmsg sys_meminfo sys_pset_getloadavg \
+ sys_zone_create sys_allocids sys_settaskid sys_zone_lookup sys_port \
+ sys_door klogctl
+sysdep_headers += sys/feature_tests.h sys/dirent.h sys/utime.h sys/machelf.h \
+ sys/systeminfo.h sys/link.h sys/procfs_isa.h sys/ttold.h sys/procset.h \
+ sys/synch.h sys/fork.h sys/sockio.h sys/ioccom.h sys/tty.h sys/priocntl.h \
+ sys/trap.h sys/sysconfig.h sys/ptms.h sys/stack.h sys/regset.h \
+ bits/regset.h sys/priv.h sys/priv_names.h sys/uadmin.h sys/vfstab.h \
+ sys/fault.h sys/door.h sys/mount.h sys/procfs.h sys/old_procfs.h \
+ sys/reg.h sys/siginfo.h sys/types32.h sys/isa_defs.h sys/int_types.h \
+ sys/inttypes.h sys/atomic.h sys/machtypes.h sys/elf.h sys/mkdev.h \
+ sys/klog.h sys/zone.h sys/processor.h sys/pset.h sys/task.h sys/exacct.h \
+ sys/acct.h sys/acctctl.h sys/utssys.h sys/corectl.h sys/loadavg.h \
+ sys/port.h sys/port_impl.h sys/acl.h sys/tsol/label.h sys/fsid.h \
+ sys/fstyp.h sys/rctl.h sys/rctl_impl.h sys/sid.h sys/mnttab.h sys/mntio.h \
+ sys/instance.h sys/byteorder.h
+sysdep_headers += rtld_db.h pcsample.h atomic.h bits/machtypes.h door.h \
+ ucred.h priv.h zone.h port.h deflt.h procfs.h rctl.h
+headers := $(filter-out sys/sysinfo.h sys/xattr.h, $(headers))
+endif
+
+ifeq ($(subdir),dirent)
+sysdep_routines += sys_getdents sys_getdents64
+endif
+
+ifeq ($(subdir),inet)
+sysdep_routines += _link_aton _link_ntoa htonll
+endif
+
+ifeq ($(subdir),posix)
+sysdep_routines += exit-thread schedP
+endif
+
+ifeq ($(subdir),resource)
+sysdep_routines += priocntl getvmusage
+sysdep_routines += sys_rusagesys sys_priocntlsys sys_rctlsys
+endif
+
+ifeq ($(subdir),signal)
+sysdep_routines += sys_lwp_sigmask sys_sigqueue sys_sigtimedwait \
+ sys_sigaction
+endif
+
+ifeq ($(subdir),socket)
+sysdep_routines += cmsg_nxthdr sa_len
+sysdep_routines += netmask
+sysdep_headers += net/if_dl.h
+headers := $(filter-out sys/socketvar.h, $(headers))
+endif
+
+ifeq ($(subdir),time)
+sysdep_routines += ntp_adjtime ntp_gettime sys_time sys_stime
+sysdep_headers += sys/timex.h sys/time_impl.h
+endif
+
+ifeq ($(subdir),termios)
+sysdep_headers += termio.h
+sysdep_headers += sys/termio.h
+endif
+
+#
+# Additional sysdeps for ld.so
+#
+ifeq ($(subdir),elf)
+sysdep-rtld-routines += _sysconfig
+endif
+
+ifeq ($(subdir),nss)
+databases += audit_user auth_attr bootparams exec_attr netmasks printers \
+ prof_attr project user_attr
+CFLAGS-files-audit_user.c = -Inss_files
+CFLAGS-files-auth_attr.c = -Inss_files
+CFLAGS-files-bootparams.c = -Inss_files
+CFLAGS-files-exec_attr.c = -Inss_files
+CFLAGS-files-netmasks.c = -Inss_files
+CFLAGS-files-printers.c = -Inss_files
+CFLAGS-files-prof_attr.c = -Inss_files
+CFLAGS-files-project.c = -Inss_files
+CFLAGS-files-user_attr.c = -Inss_files
+endif
+
+ifeq ($(subdir),nptl)
+libpthread-sysdep_routines += sys_fcntl sys_fdsync sys_sigaction sys_open \
+ sys_open64 sys_priocntlsys schedP priocntl syscall
+endif
+
+ifeq ($(subdir),nptl_db)
+sysdep_headers += proc_service.h
+endif
+
+ifeq ($(subdir),resolv)
+libresolv-routines += sys_sigqueue
+endif
+
+ifeq ($(subdir),rt)
+librt-routines += sys_sigqueue
+endif
+
+CFLAGS-accept.c = -fexceptions -fasynchronous-unwind-tables
+CFLAGS-connect.c = -fexceptions -fasynchronous-unwind-tables
+CFLAGS-fsync.c = -fexceptions -fasynchronous-unwind-tables
+CFLAGS-fdatasync.c = -fexceptions -fasynchronous-unwind-tables
+CFLAGS-fsync.c = -fexceptions -fasynchronous-unwind-tables
+CFLAGS-msgrcv.c = -fexceptions -fasynchronous-unwind-tables
+CFLAGS-msync.c = -fexceptions -fasynchronous-unwind-tables
+CFLAGS-open.c = -fexceptions -fasynchronous-unwind-tables
+CFLAGS-open64.c = -fexceptions -fasynchronous-unwind-tables
+CFLAGS-openat.c = -fexceptions -fasynchronous-unwind-tables
+CFLAGS-openat64.c = -fexceptions -fasynchronous-unwind-tables
+CFLAGS-recvmsg.c = -fexceptions -fasynchronous-unwind-tables
+CFLAGS-pselect.c = -fexceptions -fasynchronous-unwind-tables
+CFLAGS-select.c = -fexceptions -fasynchronous-unwind-tables
+CFLAGS-send.c = -fexceptions -fasynchronous-unwind-tables
+CFLAGS-sendmsg.c = -fexceptions -fasynchronous-unwind-tables
+CFLAGS-sendto.c = -fexceptions -fasynchronous-unwind-tables
+CFLAGS-tcdrain.c = -fexceptions -fasynchronous-unwind-tables
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/Subdirs b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/Subdirs
new file mode 100644
index 0000000000..8b6ae42e05
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/Subdirs
@@ -0,0 +1 @@
+rtld_db
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/Versions b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/Versions
new file mode 100644
index 0000000000..3e5c2dc0a9
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/Versions
@@ -0,0 +1,146 @@
+libc {
+ GLIBC_2.7 {
+ __errno_location;
+ __register_atfork;
+
+ # TODO
+ getnetmaskbyaddr;
+
+ # a
+ acct; acctctl; acl; allocids; ascftime; _autofssys;
+
+ # atomic
+ atomic_add_8; atomic_add_char; atomic_add_16; atomic_add_short;
+ atomic_add_32; atomic_add_int; atomic_add_long; atomic_add_64;
+ atomic_add_ptr; atomic_add_8_nv; atomic_add_char_nv; atomic_add_16_nv;
+ atomic_add_short_nv; atomic_add_32_nv; atomic_add_int_nv;
+ atomic_add_long_nv; atomic_add_64_nv; atomic_add_ptr_nv;
+ atomic_dec_8; atomic_dec_uchar; atomic_dec_16; atomic_dec_ushort;
+ atomic_dec_32; atomic_dec_uint; atomic_dec_ulong; atomic_dec_64;
+ atomic_dec_ptr; atomic_dec_8_nv; atomic_dec_uchar_nv; atomic_dec_16_nv;
+ atomic_dec_ushort_nv; atomic_dec_32_nv; atomic_dec_uint_nv;
+ atomic_dec_ulong_nv; atomic_dec_64_nv; atomic_dec_ptr_nv;
+
+ # c
+ cftime; closefrom; _cladm; __cmsg_nxthdr; core_get_default_content;
+ core_get_default_path; core_get_global_content; core_get_global_path;
+ core_get_options; core_get_process_content; core_get_process_path;
+ core_set_default_content; core_set_default_path; core_set_global_content;
+ core_set_global_path; core_set_options; core_set_process_content;
+ core_set_process_path;
+
+ # d
+ _delete; defcntl; defopen; defread; door_bind; door_call; door_cred;
+ door_create; door_getparam; door_info; door_return; door_revoke;
+ door_server_create; door_setparam; door_ucred; door_unbind;
+
+ # e
+ _endauuser; _endauthattr; _endexecattr; _endprofattr; _enduserattr;
+
+ # f
+ facl; fdwalk; _fgetuserattr; __fini_daemon_priv; fork1; freehostent;
+ freeipsecalgent;
+
+ # g
+ getacct; _getauuserent; _getauusernam; _getauthattr; _getauthnam; getcpuid;
+ _getexecattr; getexecname; _getexecprof; getextmntent; gethrtime;
+ gethrvtime; getipnodebyaddr; getipnodebyname; getipsecalgbyname;
+ getipsecalgbynum; getmntany; __getmntent_sun; getpagesizes; getpagesizes2;
+ getpeerucred; getpflags; getppriv; getprivimplinfo; _getprofattr;
+ _getprofnam; getprojid; getrctl; gettaskid; _getuserattr; _getusernam;
+ getustack; getvfsany; getvfsent; getvfsfile; getvfsspec; getvmusage;
+ getzoneid; getzoneidbyname; getzonenamebyid;
+
+ # h
+ __hasmntopt_sun; htonll;
+
+ # i
+ idmap_reg; idmap_unreg; inet_ntoa_r; __init_daemon_priv; __init_suid_priv;
+ _insert; inst_sync; issetugid; is_system_labeled;
+
+ # l
+ _lgrp_home_fast; _lgrpsys; _link_aton; _link_ntoa; llseek; lltostr;
+
+ # m
+ membar_enter; membar_exit; membar_producer; membar_consumer; memcntl;
+ meminfo; modctl; mount;
+
+ # n
+ ntohll; ntp_adjtime; ntp_gettime;
+
+ # p
+ pc_sample; p_online; priocntl; priocntlset; __priv_bracket;
+ __priv_free_info; __priv_parse_info; __priv_relinquish; processor_bind;
+ processor_info; port_alert; port_associate; port_create; port_dissociate;
+ port_get; port_getn; port_send; port_sendn; priv_allocset; priv_addset;
+ priv_copyset; priv_delset; priv_emptyset; priv_fillset; priv_freeset;
+ priv_getbyname; priv_getbynum; priv_getsetbyname; priv_getsetbynum;
+ priv_gettext; priv_ineffect; priv_intersect; priv_inverse; priv_isemptyset;
+ priv_isequalset; priv_isfullset; priv_ismember; priv_issubset; priv_set;
+ priv_set_to_str; priv_str_to_set; priv_union; pset_assign; pset_bind;
+ pset_create; pset_destroy; pset_getattr; pset_getloadavg; pset_info;
+ pset_list; pset_setattr; putacct;
+
+ # r
+ rctlblk_get_firing_time; rctlblk_get_global_action;
+ rctlblk_get_global_flags; rctlblk_get_local_action;
+ rctlblk_get_local_flags; rctlblk_get_privilege; rctlblk_get_recipient_pid;
+ rctlblk_get_value; rctlblk_get_enforced_value; rctlblk_set_local_action;
+ rctlblk_set_local_flags; rctlblk_set_privilege; rctlblk_set_value;
+ rctlblk_set_recipient_pid; rctlblk_size; rctllist; rctl_walk; resetmnttab;
+ res_nclose; resolvepath;
+
+ # s
+ _sbrk_grow_aligned; sendfilev; sendfilev64; _setauuser; _setauthattr;
+ _setexecattr; setpflags; setppriv; _setprofattr; setprojrctl; setrctl;
+ settaskid; _setuserattr; setustack; sig2str; _sigoff; _sigon; sigsend;
+ sigsendset; _so_accept; _so_bind; _so_connect; _so_getpeername;
+ _so_getsockname; _so_getsockopt; _so_listen; _so_recv; _so_recvfrom;
+ _so_recvmsg; _so_send; _so_sendmsg; _so_sendto; _so_setsockopt;
+ _so_shutdown; _so_socket; _so_socketpair; stack_getbounds; str2sig;
+ swapctl; _sysconf; __systemcall; sysfs; systeminfo;
+
+ # t
+ thr_sighndlrinfo; _ttyname_dev;
+
+ # u
+ uadmin; _ucred_alloc; ucred_free; ucred_get; ucred_getamask; ucred_getauid;
+ ucred_getasid; ucred_getatid; ucred_getegid; ucred_geteuid; ucred_getgroups;
+ ucred_getlabel; ucred_getpflags; ucred_getpid; ucred_getprivset;
+ ucred_getprojid; ucred_getrgid; ucred_getruid; ucred_getsgid;
+ ucred_getsuid; ucred_getzoneid; ucred_size; ulltostr; umount; umount2;
+ utssys;
+
+ # w
+ wracct;
+
+ # z
+ zone_add_datalink; zone_boot; zone_check_datalink; zone_create;
+ zone_destroy; zone_enter; zone_get_id; zone_getattr; zone_list;
+ zone_list_datalink; zone_remove_datalink; zone_setattr; zone_shutdown;
+ zonept; zone_version;
+ }
+ GLIBC_PRIVATE {
+ _nss_files_parse_userattr;
+ }
+}
+
+libnsl {
+ GLIBC_2.7 {
+ setnetconfig; endnetconfig; getnetconfig; getnetconfigent;
+ freenetconfigent; setnetpath; endnetpath; getnetpath; nc_perror;
+ nc_sperror;
+ }
+}
+
+libnss_files {
+ GLIBC_PRIVATE {
+ _nss_files_getauthattr_r; _nss_files_getauthnam_r;
+ _nss_files_getexecattr_r; _nss_files_getexecprof_r;
+ _nss_files_getprofattr_r; _nss_files_getprofnam_r;
+ _nss_files_getuserattr_r; _nss_files_getusernam_r;
+ _nss_files_parse_auuser; _nss_files_parse_authattr;
+ _nss_files_parse_execattr; _nss_files_parse_profattr;
+ _nss_files_parse_proj; _nss_files_parse_userattr;
+ }
+}
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/_G_config.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/_G_config.h
new file mode 100644
index 0000000000..12e7da6f7e
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/_G_config.h
@@ -0,0 +1,101 @@
+/* This file is needed by libio to define various configuration parameters.
+ These are always the same in the GNU C library. */
+
+#ifndef _G_config_h
+#define _G_config_h 1
+
+/* Define types for libio in terms of the standard internal type names. */
+
+#include <bits/types.h>
+#define __need_size_t
+#if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
+# define __need_wchar_t
+#endif
+#define __need_NULL
+#include <stddef.h>
+#define __need_mbstate_t
+#if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
+# define __need_wint_t
+#endif
+#include <wchar.h>
+#define _G_size_t size_t
+typedef struct
+{
+ __off_t __pos;
+ __mbstate_t __state;
+} _G_fpos_t;
+typedef struct
+{
+ __off64_t __pos;
+ __mbstate_t __state;
+} _G_fpos64_t;
+#define _G_ssize_t __ssize_t
+#define _G_off_t __off_t
+#define _G_off64_t __off64_t
+#define _G_pid_t __pid_t
+#define _G_uid_t __uid_t
+#define _G_wchar_t wchar_t
+#define _G_wint_t wint_t
+#define _G_stat64 stat64
+#if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
+# include <gconv.h>
+typedef union
+{
+ struct __gconv_info __cd;
+ struct
+ {
+ struct __gconv_info __cd;
+ struct __gconv_step_data __data;
+ } __combined;
+} _G_iconv_t;
+#endif
+
+typedef int _G_int16_t __attribute__ ((__mode__ (__HI__)));
+typedef int _G_int32_t __attribute__ ((__mode__ (__SI__)));
+typedef unsigned int _G_uint16_t __attribute__ ((__mode__ (__HI__)));
+typedef unsigned int _G_uint32_t __attribute__ ((__mode__ (__SI__)));
+
+#define _G_HAVE_BOOL 1
+
+
+/* These library features are always available in the GNU C library. */
+#define _G_HAVE_ATEXIT 1
+#define _G_HAVE_SYS_CDEFS 1
+#define _G_HAVE_SYS_WAIT 1
+#define _G_NEED_STDARG_H 1
+#define _G_va_list __gnuc_va_list
+
+#define _G_HAVE_PRINTF_FP 1
+#define _G_HAVE_MMAP 1
+/* #define _G_HAVE_MREMAP 1 */
+#define _G_HAVE_LONG_DOUBLE_IO 1
+#define _G_HAVE_IO_FILE_OPEN 1
+#define _G_HAVE_IO_GETLINE_INFO 1
+
+#define _G_IO_IO_FILE_VERSION 0x20001
+
+#define _G_OPEN64 __open64
+#define _G_LSEEK64 __lseek64
+#define _G_MMAP64 __mmap64
+#define _G_FSTAT64(fd,buf) __fxstat64 (_STAT_VER, fd, buf)
+
+/* This is defined by <bits/stat.h> if `st_blksize' exists. */
+#define _G_HAVE_ST_BLKSIZE defined (_STATBUF_ST_BLKSIZE)
+
+#define _G_BUFSIZ 8192
+
+/* These are the vtbl details for ELF. */
+#define _G_NAMES_HAVE_UNDERSCORE 0
+#define _G_VTABLE_LABEL_HAS_LENGTH 1
+#define _G_USING_THUNKS 1
+#define _G_VTABLE_LABEL_PREFIX "__vt_"
+#define _G_VTABLE_LABEL_PREFIX_ID __vt_
+
+
+#if defined __cplusplus || defined __STDC__
+# define _G_ARGS(ARGLIST) ARGLIST
+#else
+# define _G_ARGS(ARGLIST) ()
+#endif
+
+#endif /* _G_config.h */
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/_fgetuserattr.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/_fgetuserattr.c
new file mode 100644
index 0000000000..9fcf639e68
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/_fgetuserattr.c
@@ -0,0 +1,84 @@
+/* Copyright (C) 1991, 1996, 1997, 1998, 1999, 2008
+ Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <ctype.h>
+#include <errno.h>
+#include <stdio.h>
+#include <user_attrP.h>
+
+#ifdef USE_IN_LIBIO
+# define flockfile(s) _IO_flockfile (s)
+# define funlockfile(s) _IO_funlockfile (s)
+#endif
+
+/* Define a line parsing function using the common code
+ used in the nss_files module. */
+
+#define STRUCTURE userstr_s
+#define ENTNAME userattr
+struct userattr_data {};
+
+#include <nss/nss_files/files-parse.c>
+LINE_PARSER
+(,
+ STRING_FIELD (result->name, ISCOLON, 0);
+ STRING_FIELD (result->qualifier, ISCOLON, 0);
+ STRING_FIELD (result->res1, ISCOLON, 0);
+ STRING_FIELD (result->res2, ISCOLON, 0);
+ STRING_FIELD (result->attr, ISCOLON, 0);
+ )
+
+
+/* Read one entry from the given stream. */
+userstr_t *
+_fgetuserattr (FILE *stream, struct userstr_s *resbuf, char *buffer,
+ size_t buflen)
+{
+ char *p;
+
+ flockfile (stream);
+ do
+ {
+ buffer[buflen - 1] = '\xff';
+ p = fgets_unlocked (buffer, buflen, stream);
+ if (p == NULL && feof_unlocked (stream))
+ {
+ funlockfile (stream);
+ __set_errno (ENOENT);
+ return NULL;
+ }
+ if (p == NULL || buffer[buflen - 1] != '\xff')
+ {
+ funlockfile (stream);
+ __set_errno (ERANGE);
+ return NULL;
+ }
+
+ /* Skip leading blanks. */
+ while (isspace (*p))
+ ++p;
+ } while (*p == '\0' || *p == '#' || /* Ignore empty and comment lines. */
+ /* Parse the line. If it is invalid, loop to
+ get the next line of the file to parse. */
+ ! parse_line (p, resbuf, (void *) buffer, buflen, &errno));
+
+ funlockfile (stream);
+
+ return resbuf;
+}
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/_getauthattr.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/_getauthattr.c
new file mode 100644
index 0000000000..469b5823e5
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/_getauthattr.c
@@ -0,0 +1,45 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <auth_attrP.h>
+
+#define LOOKUP_TYPE authstr_t
+#define SETFUNC_NAME setauthattr
+#define GETFUNC_NAME getauthattr
+#define ENDFUNC_NAME endauthattr
+#define DATABASE_NAME passwd
+#define BUFLEN NSS_BUFLEN_AUTHATTR
+
+#include <nss/getXXent_r.c>
+
+extern int getauthattr_r (authstr_t *, char *, size_t, authstr_t **);
+
+
+authstr_t * _getauthattr (authstr_t *psbuf, char *buf, int buflen, int *errnop)
+{
+ authstr_t *psbufp;
+ int errval = getauthattr_r (psbuf, buf, buflen, &psbufp);
+ if (errval && errnop)
+ *errnop = errval;
+
+ return errval ? NULL : psbuf;
+}
+
+strong_alias (setauthattr, _setauthattr)
+strong_alias (endauthattr, _endauthattr)
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/_getauthnam.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/_getauthnam.c
new file mode 100644
index 0000000000..e61c8ceabf
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/_getauthnam.c
@@ -0,0 +1,44 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <auth_attrP.h>
+
+#define LOOKUP_TYPE authstr_t
+#define FUNCTION_NAME getauthnam
+#define DATABASE_NAME passwd
+#define ADD_PARAMS const char *name
+#define ADD_VARIABLES name
+#define BUFLEN NSS_BUFLEN_AUTHATTR
+
+#include <nss/getXXbyYY_r.c>
+
+extern int getauthnam_r (const char *, authstr_t *, char *, size_t,
+ authstr_t **);
+
+
+authstr_t * _getauthnam (const char *name, authstr_t *psbuf, char *buf,
+ int buflen, int *errnop)
+{
+ authstr_t *psbufp;
+ int errval = getauthnam_r (name, psbuf, buf, buflen, &psbufp);
+ if (errval && errnop)
+ *errnop = errval;
+
+ return errval ? NULL : psbuf;
+}
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/_getauuserent.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/_getauuserent.c
new file mode 100644
index 0000000000..815601bff4
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/_getauuserent.c
@@ -0,0 +1,45 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <auditP.h>
+
+#define LOOKUP_TYPE au_user_str_t
+#define SETFUNC_NAME setauuser
+#define GETFUNC_NAME getauuserent
+#define ENDFUNC_NAME endauuser
+#define DATABASE_NAME passwd
+#define BUFLEN NSS_BUFLEN_AUDITUSER
+
+#include <nss/getXXent_r.c>
+
+extern int getauuserent_r (au_user_str_t *, char *, size_t, au_user_str_t **);
+
+
+au_user_str_t * _getauuserent (au_user_str_t *psbuf, char *buf, int buflen, int *errnop)
+{
+ au_user_str_t *psbufp;
+ int errval = getauuserent_r (psbuf, buf, buflen, &psbufp);
+ if (errval && errnop)
+ *errnop = errval;
+
+ return errval ? NULL : psbuf;
+}
+
+strong_alias (setauuser, _setauuser)
+strong_alias (endauuser, _endauuser)
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/_getauusernam.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/_getauusernam.c
new file mode 100644
index 0000000000..a501b89f89
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/_getauusernam.c
@@ -0,0 +1,44 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <auditP.h>
+
+#define LOOKUP_TYPE au_user_str_t
+#define FUNCTION_NAME getauusernam
+#define DATABASE_NAME passwd
+#define ADD_PARAMS const char *name
+#define ADD_VARIABLES name
+#define BUFLEN NSS_BUFLEN_AUDITUSER
+
+#include <nss/getXXbyYY_r.c>
+
+extern int getauusernam_r (const char *, au_user_str_t *, char *, size_t,
+ au_user_str_t **);
+
+
+au_user_str_t * _getauusernam (const char *name, au_user_str_t *psbuf, char *buf,
+ int buflen, int *errnop)
+{
+ au_user_str_t *psbufp;
+ int errval = getauusernam_r (name, psbuf, buf, buflen, &psbufp);
+ if (errval && errnop)
+ *errnop = errval;
+
+ return errval ? NULL : psbuf;
+}
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/_getexecattr.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/_getexecattr.c
new file mode 100644
index 0000000000..86b2d18827
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/_getexecattr.c
@@ -0,0 +1,45 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <exec_attrP.h>
+
+#define LOOKUP_TYPE execstr_t
+#define SETFUNC_NAME setexecattr
+#define GETFUNC_NAME getexecattr
+#define ENDFUNC_NAME endexecattr
+#define DATABASE_NAME prof_attr
+#define BUFLEN NSS_BUFLEN_EXECATTR
+
+#include <nss/getXXent_r.c>
+
+extern int getexecattr_r (execstr_t *, char *, size_t, execstr_t **);
+
+
+execstr_t * _getexecattr (execstr_t *esbuf, char *buf, int buflen, int *errnop)
+{
+ execstr_t *esbufp;
+ int errval = getexecattr_r (esbuf, buf, buflen, &esbufp);
+ if (errval && errnop)
+ *errnop = errval;
+
+ return errval ? NULL : esbuf;
+}
+
+strong_alias (setexecattr, _setexecattr)
+strong_alias (endexecattr, _endexecattr)
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/_getexecprof.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/_getexecprof.c
new file mode 100644
index 0000000000..bb0af89e8d
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/_getexecprof.c
@@ -0,0 +1,29 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <exec_attrP.h>
+#include <assert.h>
+#include <stddef.h>
+
+execstr_t * _getexecprof(char *name, char *type, int search_flag,
+ execstr_t *result, char *buffer, int buflen, int *errnop)
+{
+ assert (!"_getexecprof not implmemented");
+ return NULL;
+}
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/_getprofattr.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/_getprofattr.c
new file mode 100644
index 0000000000..abff89c31a
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/_getprofattr.c
@@ -0,0 +1,45 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <prof_attrP.h>
+
+#define LOOKUP_TYPE profstr_t
+#define SETFUNC_NAME setprofattr
+#define GETFUNC_NAME getprofattr
+#define ENDFUNC_NAME endprofattr
+#define DATABASE_NAME prof_attr
+#define BUFLEN NSS_BUFLEN_PROFATTR
+
+#include <nss/getXXent_r.c>
+
+extern int getprofattr_r (profstr_t *, char *, size_t, profstr_t **);
+
+
+profstr_t * _getprofattr (profstr_t *psbuf, char *buf, int buflen, int *errnop)
+{
+ profstr_t *psbufp;
+ int errval = getprofattr_r (psbuf, buf, buflen, &psbufp);
+ if (errval && errnop)
+ *errnop = errval;
+
+ return errval ? NULL : psbuf;
+}
+
+strong_alias (setprofattr, _setprofattr)
+strong_alias (endprofattr, _endprofattr)
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/_getprofnam.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/_getprofnam.c
new file mode 100644
index 0000000000..a9effed552
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/_getprofnam.c
@@ -0,0 +1,44 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <prof_attrP.h>
+
+#define LOOKUP_TYPE profstr_t
+#define FUNCTION_NAME getprofnam
+#define DATABASE_NAME prof_attr
+#define ADD_PARAMS const char *name
+#define ADD_VARIABLES name
+#define BUFLEN NSS_BUFLEN_PROFATTR
+
+#include <nss/getXXbyYY_r.c>
+
+extern int getprofnam_r (const char *, profstr_t *, char *, size_t,
+ profstr_t **);
+
+
+profstr_t * _getprofnam (const char *name, profstr_t *psbuf, char *buf,
+ int buflen, int *errnop)
+{
+ profstr_t *psbufp;
+ int errval = getprofnam_r (name, psbuf, buf, buflen, &psbufp);
+ if (errval && errnop)
+ *errnop = errval;
+
+ return errval ? NULL : psbuf;
+}
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/_getuserattr.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/_getuserattr.c
new file mode 100644
index 0000000000..0caf55185d
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/_getuserattr.c
@@ -0,0 +1,45 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <user_attrP.h>
+
+#define LOOKUP_TYPE userstr_t
+#define SETFUNC_NAME setuserattr
+#define GETFUNC_NAME getuserattr
+#define ENDFUNC_NAME enduserattr
+#define DATABASE_NAME user_attr
+#define BUFLEN NSS_BUFLEN_PROFATTR
+
+#include <nss/getXXent_r.c>
+
+extern int getuserattr_r (userstr_t *, char *, size_t, userstr_t **);
+
+
+userstr_t * _getuserattr (userstr_t *psbuf, char *buf, int buflen, int *errnop)
+{
+ userstr_t *psbufp;
+ int errval = getuserattr_r (psbuf, buf, buflen, &psbufp);
+ if (errval && errnop)
+ *errnop = errval;
+
+ return errval ? NULL : psbuf;
+}
+
+strong_alias (setuserattr, _setuserattr)
+strong_alias (enduserattr, _enduserattr)
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/_getusernam.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/_getusernam.c
new file mode 100644
index 0000000000..f1ffe85f65
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/_getusernam.c
@@ -0,0 +1,44 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <user_attrP.h>
+
+#define LOOKUP_TYPE userstr_t
+#define FUNCTION_NAME getusernam
+#define DATABASE_NAME user_attr
+#define ADD_PARAMS const char *name
+#define ADD_VARIABLES name
+#define BUFLEN NSS_BUFLEN_USERATTR
+
+#include <nss/getXXbyYY_r.c>
+
+extern int getusernam_r (const char *, userstr_t *, char *, size_t,
+ userstr_t **);
+
+
+userstr_t * _getusernam (const char *name, userstr_t *psbuf, char *buf,
+ int buflen, int *errnop)
+{
+ userstr_t *psbufp;
+ int errval = getusernam_r (name, psbuf, buf, buflen, &psbufp);
+ if (errval && errnop)
+ *errnop = errval;
+
+ return errval ? NULL : psbuf;
+}
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/_lgrp_home_fast.S b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/_lgrp_home_fast.S
new file mode 100644
index 0000000000..d3e0db7b61
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/_lgrp_home_fast.S
@@ -0,0 +1,6 @@
+#include <sysdep.h>
+#include <sys/trap.h>
+
+PSEUDO_FASTTRAP (_lgrp_home_fast, GETLGRP, 0)
+ ret
+PSEUDO_END (_lgrp_home_fast)
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/_link_aton.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/_link_aton.c
new file mode 100644
index 0000000000..6f899bc467
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/_link_aton.c
@@ -0,0 +1,38 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <netinet/ether.h>
+#include <stdlib.h>
+#include <string.h>
+
+unsigned char * _link_aton (const char *ascaddr, int *maclen)
+{
+ struct ether_addr addr;
+ if (ether_aton_r (ascaddr, &addr) == NULL)
+ return NULL;
+
+ unsigned char *retaddr = malloc (sizeof (addr));
+ if (!retaddr)
+ return NULL;
+ memcpy (retaddr, &addr, sizeof (addr));
+ if (maclen)
+ *maclen = sizeof (addr);
+
+ return retaddr;
+}
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/_link_ntoa.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/_link_ntoa.c
new file mode 100644
index 0000000000..01727fd804
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/_link_ntoa.c
@@ -0,0 +1,48 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <netinet/ether.h>
+#include <stdlib.h>
+#include <string.h>
+
+char * _link_ntoa (const unsigned char *macaddr, char *str, int size,
+ int mactype)
+{
+ if (size != sizeof (struct ether_addr))
+ return NULL;
+
+ char *ret = str;
+ if (!ret)
+ {
+ /* 2 chars + 1 colon per byte. */
+ ret = malloc (3 * size);
+ if (!ret)
+ return NULL;
+ }
+
+ struct ether_addr addr;
+ if (ether_ntoa_r (&addr, ret) == NULL)
+ {
+ if (!str)
+ free (ret);
+ return NULL;
+ }
+
+ return ret;
+}
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/_sbrk_grow_aligned.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/_sbrk_grow_aligned.c
new file mode 100644
index 0000000000..7249b1579d
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/_sbrk_grow_aligned.c
@@ -0,0 +1,61 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+/* Grow the break. First align the current break to low_align, then
+ add min_size and finally align on high_align. Return the low-aligned
+ break value and set actual_size to the difference of the resulting break
+ value and the low-aligned break value. */
+
+#include <unistd.h>
+#include <errno.h>
+
+extern void *__curbrk;
+
+void *_sbrk_grow_aligned (size_t min_size, size_t low_align, size_t high_align,
+ size_t *actual_size)
+{
+ if (!__curbrk)
+ {
+ /* Try to initialize the break. */
+ if (sbrk (0) == (void *)-1)
+ {
+ __set_errno (ENOTSUP);
+ return (void *)-1;
+ }
+ }
+
+ /* low_align and high_align must be powers of 2. */
+ if ((low_align & (low_align - 1)) != 0 ||
+ (high_align & (high_align - 1)) != 0)
+ {
+ __set_errno (EINVAL);
+ return (void *)-1;
+ }
+
+ uintptr_t lowbrk = ((uintptr_t)__curbrk + (low_align - 1)) & ~(low_align - 1);
+ uintptr_t highbrk = (lowbrk + min_size + (high_align - 1)) & ~(high_align - 1);
+
+ if (brk ((void *)highbrk) != 0)
+ return (void *)-1;
+
+ if (actual_size)
+ *actual_size = (size_t)(highbrk - lowbrk);
+
+ return (void *)lowbrk;
+}
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/accept.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/accept.c
new file mode 100644
index 0000000000..3b64f4768d
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/accept.c
@@ -0,0 +1,38 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sysdep-cancel.h>
+#include <inline-syscall.h>
+#include <sys/socket.h>
+
+extern int _so_accept(int sock, __SOCKADDR_ARG addr, unsigned int *addrlen,
+ int version);
+
+int
+__libc_accept (fd, addr, addr_len)
+ int fd;
+ __SOCKADDR_ARG addr;
+ socklen_t *addr_len;
+{
+ return _so_accept (fd, addr, addr_len, SOV_XPG4_2);
+}
+
+weak_alias (__libc_accept, accept)
+libc_hidden_def (accept)
+LIBC_CANCEL_HANDLED (); /* sys_accept handles cancellation */
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/access.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/access.c
new file mode 100644
index 0000000000..a91091cb9c
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/access.c
@@ -0,0 +1,96 @@
+/* Copyright (C) 1991, 1995, 1996, 1997, 2009 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ OpenSolaris bits contributed by David Bartley
+ <dtbartle@csclub.uwaterloo.ca>, 2009.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <stddef.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <sys/stat.h>
+#include <inline-syscall.h>
+
+DECLARE_INLINE_SYSCALL (int, access, const char *, int);
+
+#define E_OK 010
+
+/* Test for access to FILE. */
+int
+__access (file, type)
+ const char *file;
+ int type;
+{
+ if (file == NULL || (type & ~(R_OK|W_OK|X_OK|F_OK|E_OK)) != 0)
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ int res = INLINE_SYSCALL (access, 2, file, type);
+
+ /* XXX: This should really be fixed in the kernel. */
+ if (res == 0 && (type & X_OK))
+ {
+ uid_t uid;
+ gid_t gid;
+
+ uid = (type & E_OK) ? geteuid () : getuid ();
+ gid = (type & E_OK) ? getegid () : getgid ();
+ if (uid == 0 || gid == 0)
+ {
+ struct stat buf;
+
+ if (stat (file, &buf) != 0)
+ return -1;
+
+ /* Test user bit. */
+ if (uid == buf.st_uid)
+ {
+ if ((buf.st_mode & S_IXUSR) == 0)
+ {
+ __set_errno (EACCES);
+ return -1;
+ }
+ return 0;
+ }
+
+ /* Test gid bit. */
+ if (gid == buf.st_gid)
+ {
+ if ((buf.st_mode & S_IXGRP) == 0)
+ {
+ __set_errno (EACCES);
+ return -1;
+ }
+ return 0;
+ }
+
+ /* Test other bit. */
+ if ((buf.st_mode & S_IXOTH) == 0)
+ {
+ __set_errno (EACCES);
+ return -1;
+ }
+ return 0;
+ }
+ }
+
+ return res;
+}
+
+weak_alias (__access, access)
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/aio_sigqueue.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/aio_sigqueue.c
new file mode 100644
index 0000000000..8dc0240333
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/aio_sigqueue.c
@@ -0,0 +1,35 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <inline-syscall.h>
+#include <aio.h>
+#include <aio_misc.h>
+#include <signal.h>
+
+DECLARE_INLINE_SYSCALL (int, sigqueue, pid_t pid, int sig,
+ const union sigval value, int si_code, int block);
+
+int
+__aio_sigqueue (sig, val, caller_pid)
+ int sig;
+ const union sigval val;
+ pid_t caller_pid;
+{
+ return INLINE_SYSCALL (sigqueue, 5, caller_pid, sig, val, SI_ASYNCIO, 1);
+}
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/allocids.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/allocids.c
new file mode 100644
index 0000000000..db2a4495ef
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/allocids.c
@@ -0,0 +1,37 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <inline-syscall.h>
+
+DECLARE_INLINE_SYSCALL (int, allocids, int flag, int nuids, int ngids);
+
+int
+allocids (int flag, int nuids, uid_t *suid, int ngids, gid_t *sgid)
+{
+ rval_t ret;
+ ret.rval64 = INLINE_SYSCALL (allocids, 3, flag, nuids, ngids);
+ if (ret.rval64 != 0)
+ return -1;
+
+ if (suid)
+ *suid = (uid_t)ret.rval1;
+ if (sgid)
+ *sgid = (gid_t)ret.rval2;
+ return 0;
+}
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/ascftime.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/ascftime.c
new file mode 100644
index 0000000000..2be8ee1d46
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/ascftime.c
@@ -0,0 +1,34 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <time.h>
+#include <stdlib.h>
+#include <limits.h>
+
+int ascftime (char *s, const char *format, const struct tm *timeptr)
+{
+ /* If format is null use CFTIME or %C. */
+ if (!format || *format == '\0' || !(format = getenv ("CFTIME")) ||
+ *format == '\0')
+ format = "%C";
+
+ /* The caller is responsible for ensuring that the buffer is large enough.
+ We just set max to INT_MAX (basically a really large number). */
+ return ((int)strftime (s, INT_MAX, format, timeptr));
+}
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/atomic.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/atomic.c
new file mode 100644
index 0000000000..675a6d6ea7
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/atomic.c
@@ -0,0 +1,220 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sys/atomic.h>
+#include <stdint.h>
+
+/* This pulls in include/atomic.h rather than sysdeps/.../atomic.h. */
+#include <atomic.h>
+
+/* membar_* */
+
+void membar_enter (void)
+{
+ atomic_full_barrier ();
+}
+
+void membar_exit (void)
+{
+ atomic_full_barrier ();
+}
+
+void membar_producer (void)
+{
+ atomic_write_barrier ();
+}
+
+void membar_consumer (void)
+{
+ atomic_read_barrier ();
+}
+
+/* atomic_add_* */
+
+void atomic_add_8 (volatile uint8_t *target, int8_t delta)
+{
+ atomic_add (target, delta);
+}
+
+void atomic_add_char (volatile unsigned char *target, signed char delta)
+{
+ atomic_add (target, delta);
+}
+
+void atomic_add_16 (volatile uint16_t *target, int16_t delta)
+{
+ atomic_add (target, delta);
+}
+
+void atomic_add_short (volatile unsigned short *target, short delta)
+{
+ atomic_add (target, delta);
+}
+
+void atomic_add_32 (volatile uint32_t *target, int32_t delta)
+{
+ atomic_add (target, delta);
+}
+
+void atomic_add_int (volatile unsigned int *target, int delta)
+{
+ atomic_add (target, delta);
+}
+
+void atomic_add_long (volatile unsigned long *target, long delta)
+{
+ atomic_add (target, delta);
+}
+
+void atomic_add_64 (volatile uint64_t *target, int64_t delta)
+{
+ atomic_add (target, delta);
+}
+
+void atomic_add_ptr (volatile void *target, ssize_t delta)
+{
+ atomic_add ((char **)target, delta);
+}
+
+uint8_t atomic_add_8_nv (volatile uint8_t *target, int8_t delta)
+{
+ return atomic_exchange_and_add (target, delta) + 1;
+}
+
+unsigned char atomic_add_char_nv (volatile unsigned char *target, signed char delta)
+{
+ return atomic_exchange_and_add (target, delta) + 1;
+}
+
+uint16_t atomic_add_16_nv (volatile uint16_t *target, int16_t delta)
+{
+ return atomic_exchange_and_add (target, delta) + 1;
+}
+
+unsigned short atomic_add_short_nv (volatile unsigned short *target, short delta)
+{
+ return atomic_exchange_and_add (target, delta) + 1;
+}
+
+uint32_t atomic_add_32_nv (volatile uint32_t *target, int32_t delta)
+{
+ return atomic_exchange_and_add (target, delta) + 1;
+}
+
+unsigned int atomic_add_int_nv (volatile unsigned int *target, int delta)
+{
+ return atomic_exchange_and_add (target, delta) + 1;
+}
+
+unsigned long atomic_add_long_nv (volatile unsigned long *target, long delta)
+{
+ return atomic_exchange_and_add (target, delta) + 1;
+}
+
+uint64_t atomic_add_64_nv (volatile uint64_t *target, int64_t delta)
+{
+ return atomic_exchange_and_add (target, delta) + 1;
+}
+
+void *atomic_add_ptr_nv (volatile void *target, ssize_t delta)
+{
+ return atomic_exchange_and_add ((char **)target, delta) + 1;
+}
+
+/* atomic_dec_* */
+
+void atomic_dec_8 (volatile uint8_t *target)
+{
+ atomic_decrement (target);
+}
+
+void atomic_dec_uchar (volatile unsigned char *target)
+{
+ atomic_decrement (target);
+}
+
+void atomic_dec_16 (volatile uint16_t *target)
+{
+ atomic_decrement (target);
+}
+
+void atomic_dec_ushort (volatile unsigned short *target)
+{
+ atomic_decrement (target);
+}
+
+void atomic_dec_32 (volatile uint32_t *target)
+{
+ atomic_decrement (target);
+}
+
+void atomic_dec_uint (volatile unsigned int *target)
+{
+ atomic_decrement (target);
+}
+
+void atomic_dec_ulong (volatile unsigned long *target)
+{
+ atomic_decrement (target);
+}
+
+void atomic_dec_64 (volatile uint64_t *target)
+{
+ atomic_decrement (target);
+}
+
+uint8_t atomic_dec_8_nv (volatile uint8_t *target)
+{
+ return atomic_decrement_val (target) - 1;
+}
+
+unsigned char atomic_dec_uchar_nv (volatile unsigned char *target)
+{
+ return atomic_decrement_val (target) - 1;
+}
+
+uint16_t atomic_dec_16_nv (volatile uint16_t *target)
+{
+ return atomic_decrement_val (target) - 1;
+}
+
+unsigned short atomic_dec_ushort_nv (volatile unsigned short *target)
+{
+ return atomic_decrement_val (target) - 1;
+}
+
+uint32_t atomic_dec_32_nv (volatile uint32_t *target)
+{
+ return atomic_decrement_val (target) - 1;
+}
+
+unsigned int atomic_dec_uint_nv (volatile unsigned int *target)
+{
+ return atomic_decrement_val (target) - 1;
+}
+
+unsigned long atomic_dec_ulong_nv (volatile unsigned long *target)
+{
+ return atomic_decrement_val (target) - 1;
+}
+
+uint64_t atomic_dec_64_nv (volatile uint64_t *target)
+{
+ return atomic_decrement_val (target) - 1;
+}
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/atomic.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/atomic.h
new file mode 100644
index 0000000000..6a07cda497
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/atomic.h
@@ -0,0 +1,4 @@
+#ifndef _ATOMIC_H
+#define _ATOMIC_H
+#include <sys/atomic.h>
+#endif /* _ATOMIC_H */
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/auditP.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/auditP.h
new file mode 100644
index 0000000000..24f9769b0d
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/auditP.h
@@ -0,0 +1,74 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _AUDITP_H
+#define _AUDITP_H
+
+#include <sys/types.h>
+#include <nss/nss.h>
+#include <ucred.h>
+
+#define NSS_BUFLEN_AUDITUSER 1024
+
+typedef uid_t au_id_t;
+typedef pid_t au_asid_t;
+
+typedef struct au_port_s
+ {
+ uint32_t at_major;
+ uint32_t at_minor;
+ } au_port_t;
+
+typedef struct au_tid_addr64
+ {
+ au_port_t at_port;
+ unsigned int at_type;
+ unsigned int at_addr[4];
+ } au_tid64_addr_t;
+
+typedef struct au_mask
+ {
+ unsigned int am_success;
+ unsigned int am_failure;
+ } au_mask_t;
+
+typedef struct auditinfo_addr64
+ {
+ au_id_t ai_auid;
+ au_mask_t ai_mask;
+ au_tid64_addr_t ai_termid;
+ au_asid_t ai_asid;
+ } auditinfo64_addr_t;
+
+typedef struct au_user_str_s
+ {
+ char *au_name;
+ char *au_always;
+ char *au_never;
+ } au_user_str_t;
+
+#define AU_NOAUDITID ((au_id_t)-2)
+
+struct parser_data;
+extern int _nss_files_parse_auuser (char *line, struct au_user_str_s *result,
+ struct parser_data *data,
+ size_t datalen, int *errnop);
+libnss_files_hidden_proto (_nss_files_parse_auuser)
+
+#endif /* _AUDITP_H */
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/audit_user-lookup.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/audit_user-lookup.c
new file mode 100644
index 0000000000..3e3a05aed2
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/audit_user-lookup.c
@@ -0,0 +1,23 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#define DATABASE_NAME audit_user
+#define DEFAULT_CONFIG "files nis"
+
+#include "XXX-lookup.c"
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/auth_attr-lookup.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/auth_attr-lookup.c
new file mode 100644
index 0000000000..77ed34961d
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/auth_attr-lookup.c
@@ -0,0 +1,23 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#define DATABASE_NAME auth_attr
+#define DEFAULT_CONFIG "files nis"
+
+#include "XXX-lookup.c"
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/auth_attrP.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/auth_attrP.h
new file mode 100644
index 0000000000..8e956b01bf
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/auth_attrP.h
@@ -0,0 +1,44 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _AUTH_ATTRP_H
+#define _AUTH_ATTRP_H
+
+#include <sys/types.h>
+#include <nss/nss.h>
+
+#define NSS_BUFLEN_AUTHATTR 1024
+
+typedef struct authstr_s
+ {
+ char *name;
+ char *res1;
+ char *res2;
+ char *short_desc;
+ char *long_desc;
+ char *attr;
+ } authstr_t;
+
+struct parser_data;
+extern int _nss_files_parse_authattr (char *line, struct authstr_s *result,
+ struct parser_data *data,
+ size_t datalen, int *errnop);
+libnss_files_hidden_proto (_nss_files_parse_authattr)
+
+#endif /* _AUTH_ATTRP_H */
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/automount-lookup.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/automount-lookup.c
new file mode 100644
index 0000000000..7fb809f3aa
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/automount-lookup.c
@@ -0,0 +1,23 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#define DATABASE_NAME automount
+#define DEFAULT_CONFIG "files nis"
+
+#include "XXX-lookup.c"
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bind.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bind.c
new file mode 100644
index 0000000000..52dafbbadf
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bind.c
@@ -0,0 +1,35 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <inline-syscall.h>
+#include <sys/socket.h>
+
+extern int _so_bind (int sock, __CONST_SOCKADDR_ARG name, socklen_t namelen,
+ int version);
+
+int
+__bind (fd, addr, len)
+ int fd;
+ __CONST_SOCKADDR_ARG addr;
+ socklen_t len;
+{
+ return _so_bind (fd, addr, len, SOV_XPG4_2);
+}
+
+weak_alias (__bind, bind)
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/confname.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/confname.h
new file mode 100644
index 0000000000..46f7a58313
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/confname.h
@@ -0,0 +1,675 @@
+/* `sysconf', `pathconf', and `confstr' NAME values. OpenSolaris version.
+ Copyright (C) 1993,1995-1998,2000,2001,2003,2004,2007,2008
+ Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _UNISTD_H
+# error "Never use <bits/confname.h> directly; include <unistd.h> instead."
+#endif
+
+/* Values for the NAME argument to `pathconf' and `fpathconf'. */
+enum
+ {
+ _PC_LINK_MAX = 1,
+#define _PC_LINK_MAX _PC_LINK_MAX
+ _PC_MAX_CANON = 2,
+#define _PC_MAX_CANON _PC_MAX_CANON
+ _PC_MAX_INPUT = 3,
+#define _PC_MAX_INPUT _PC_MAX_INPUT
+ _PC_NAME_MAX = 4,
+#define _PC_NAME_MAX _PC_NAME_MAX
+ _PC_PATH_MAX = 5,
+#define _PC_PATH_MAX _PC_PATH_MAX
+ _PC_PIPE_BUF = 6,
+#define _PC_PIPE_BUF _PC_PIPE_BUF
+ _PC_NO_TRUNC = 7,
+#define _PC_NO_TRUNC _PC_NO_TRUNC
+ _PC_VDISABLE = 8,
+#define _PC_VDISABLE _PC_VDISABLE
+ _PC_CHOWN_RESTRICTED = 9,
+#define _PC_CHOWN_RESTRICTED _PC_CHOWN_RESTRICTED
+ _PC_ASYNC_IO = 10,
+#define _PC_ASYNC_IO _PC_ASYNC_IO
+ _PC_PRIO_IO = 11,
+#define _PC_PRIO_IO _PC_PRIO_IO
+ _PC_SYNC_IO = 12,
+#define _PC_SYNC_IO _PC_SYNC_IO
+ _PC_ALLOC_SIZE_MIN = 13,
+#define _PC_ALLOC_SIZE_MIN _PC_ALLOC_SIZE_MIN
+ _PC_REC_INCR_XFER_SIZE = 14,
+#define _PC_REC_INCR_XFER_SIZE _PC_REC_INCR_XFER_SIZE
+ _PC_REC_MAX_XFER_SIZE = 15,
+#define _PC_REC_MAX_XFER_SIZE _PC_REC_MAX_XFER_SIZE
+ _PC_REC_MIN_XFER_SIZE = 16,
+#define _PC_REC_MIN_XFER_SIZE _PC_REC_MIN_XFER_SIZE
+ _PC_REC_XFER_ALIGN = 17,
+#define _PC_REC_XFER_ALIGN _PC_REC_XFER_ALIGN
+ _PC_SYMLINK_MAX = 18,
+#define _PC_SYMLINK_MAX _PC_SYMLINK_MAX
+ _PC_2_SYMLINKS = 19,
+#define _PC_2_SYMLINKS _PC_2_SYMLINKS
+
+/* OpenSolaris extensions. */
+ _PC_ACL_ENABLED = 20,
+#define _PC_ACL_ENABLED _PC_ACL_ENABLED
+ _PC_MIN_HOLE_SIZE = 21,
+#define _PC_MIN_HOLE_SIZE _PC_MIN_HOLE_SIZE
+ _PC_CASE_BEHAVIOR = 22,
+#define _PC_CASE_BEHAVIOR _PC_CASE_BEHAVIOR
+ _PC_SATTR_ENABLED = 23,
+#define _PC_SATTR_ENABLED _PC_SATTR_ENABLED
+ _PC_SATTR_EXISTS = 24,
+#define _PC_SATTR_EXISTS _PC_SATTR_EXISTS
+
+ _PC_FILESIZEBITS = 67,
+#define _PC_FILESIZEBITS _PC_FILESIZEBITS
+
+ _PC_XATTR_ENABLED = 100,
+#define PC_XATTR_ENABLED PC_XATTR_ENABLED
+ _PC_XATTR_EXISTS = 101,
+#define _PC_XATTR_EXISTS _PC_XATTR_EXISTS
+
+/* These are found in GNU libc but not OpenSolaris. */
+
+ _PC_SOCK_MAXBUF = 5501,
+#define _PC_SOCK_MAXBUF _PC_SOCK_MAXBUF
+ };
+
+/* Values for the argument to `sysconf'. */
+enum
+ {
+ _SC_ARG_MAX = 1,
+#define _SC_ARG_MAX _SC_ARG_MAX
+ _SC_CHILD_MAX = 2,
+#define _SC_CHILD_MAX _SC_CHILD_MAX
+ _SC_CLK_TCK = 3,
+#define _SC_CLK_TCK _SC_CLK_TCK
+ _SC_NGROUPS_MAX = 4,
+#define _SC_NGROUPS_MAX _SC_NGROUPS_MAX
+ _SC_OPEN_MAX = 5,
+#define _SC_OPEN_MAX _SC_OPEN_MAX
+ _SC_JOB_CONTROL = 6,
+#define _SC_JOB_CONTROL _SC_JOB_CONTROL
+ _SC_SAVED_IDS = 7,
+#define _SC_SAVED_IDS _SC_SAVED_IDS
+ _SC_VERSION = 8,
+#define _SC_VERSION _SC_VERSION
+ _SC_PASS_MAX = 9,
+#define _SC_PASS_MAX _SC_PASS_MAX
+ _SC_LOGNAME_MAX = 10,
+#define _SC_LOGNAME_MAX _SC_LOGNAME_MAX
+ _SC_PAGESIZE = 11,
+#define _SC_PAGESIZE _SC_PAGESIZE
+#define _SC_PAGE_SIZE _SC_PAGESIZE
+ _SC_XOPEN_VERSION = 12,
+#define _SC_XOPEN_VERSION _SC_XOPEN_VERSION
+/* _SC_NACLS_MAX = 13 */
+ _SC_NPROCESSORS_CONF = 14,
+#define _SC_NPROCESSORS_CONF _SC_NPROCESSORS_CONF
+ _SC_NPROCESSORS_ONLN = 15,
+#define _SC_NPROCESSORS_ONLN _SC_NPROCESSORS_ONLN
+ _SC_STREAM_MAX = 16,
+#define _SC_STREAM_MAX _SC_STREAM_MAX
+ _SC_TZNAME_MAX = 17,
+#define _SC_TZNAME_MAX _SC_TZNAME_MAX
+ _SC_AIO_LISTIO_MAX = 18,
+#define _SC_AIO_LISTIO_MAX _SC_AIO_LISTIO_MAX
+ _SC_AIO_MAX = 19,
+#define _SC_AIO_MAX _SC_AIO_MAX
+ _SC_AIO_PRIO_DELTA_MAX = 20,
+#define _SC_AIO_PRIO_DELTA_MAX _SC_AIO_PRIO_DELTA_MAX
+ _SC_ASYNCHRONOUS_IO = 21,
+#define _SC_ASYNCHRONOUS_IO _SC_ASYNCHRONOUS_IO
+ _SC_DELAYTIMER_MAX = 22,
+#define _SC_DELAYTIMER_MAX _SC_DELAYTIMER_MAX
+ _SC_FSYNC = 23,
+#define _SC_FSYNC _SC_FSYNC
+ _SC_MAPPED_FILES = 24,
+#define _SC_MAPPED_FILES _SC_MAPPED_FILES
+ _SC_MEMLOCK = 25,
+#define _SC_MEMLOCK _SC_MEMLOCK
+ _SC_MEMLOCK_RANGE = 26,
+#define _SC_MEMLOCK_RANGE _SC_MEMLOCK_RANGE
+ _SC_MEMORY_PROTECTION = 27,
+#define _SC_MEMORY_PROTECTION _SC_MEMORY_PROTECTION
+ _SC_MESSAGE_PASSING = 28,
+#define _SC_MESSAGE_PASSING _SC_MESSAGE_PASSING
+ _SC_MQ_OPEN_MAX = 29,
+#define _SC_MQ_OPEN_MAX _SC_MQ_OPEN_MAX
+ _SC_MQ_PRIO_MAX = 30,
+#define _SC_MQ_PRIO_MAX _SC_MQ_PRIO_MAX
+ _SC_PRIORITIZED_IO = 31,
+#define _SC_PRIORITIZED_IO _SC_PRIORITIZED_IO
+ _SC_PRIORITY_SCHEDULING = 32,
+#define _SC_PRIORITY_SCHEDULING _SC_PRIORITY_SCHEDULING
+ _SC_REALTIME_SIGNALS = 33,
+#define _SC_REALTIME_SIGNALS _SC_REALTIME_SIGNALS
+ _SC_RTSIG_MAX = 34,
+#define _SC_RTSIG_MAX _SC_RTSIG_MAX
+ _SC_SEMAPHORES = 35,
+#define _SC_SEMAPHORES _SC_SEMAPHORES
+ _SC_SEM_NSEMS_MAX = 36,
+#define _SC_SEM_NSEMS_MAX _SC_SEM_NSEMS_MAX
+ _SC_SEM_VALUE_MAX = 37,
+#define _SC_SEM_VALUE_MAX _SC_SEM_VALUE_MAX
+ _SC_SHARED_MEMORY_OBJECTS = 38,
+#define _SC_SHARED_MEMORY_OBJECTS _SC_SHARED_MEMORY_OBJECTS
+ _SC_SIGQUEUE_MAX = 39,
+#define _SC_SIGQUEUE_MAX _SC_SIGQUEUE_MAX
+ _SC_SIGRT_MIN = 40,
+#define _SC_SIGRT_MIN _SC_SIGRT_MIN
+ _SC_SIGRT_MAX = 41,
+#define _SC_SIGRT_MAX _SC_SIGRT_MAX
+ _SC_SYNCHRONIZED_IO = 42,
+#define _SC_SYNCHRONIZED_IO _SC_SYNCHRONIZED_IO
+ _SC_TIMERS = 43,
+#define _SC_TIMERS _SC_TIMERS
+ _SC_TIMER_MAX = 44,
+#define _SC_TIMER_MAX _SC_TIMER_MAX
+ _SC_2_C_BIND = 45,
+#define _SC_2_C_BIND _SC_2_C_BIND
+ _SC_2_C_DEV = 46,
+#define _SC_2_C_DEV _SC_2_C_DEV
+ _SC_2_C_VERSION = 47,
+#define _SC_2_C_VERSION _SC_2_C_VERSION
+ _SC_2_FORT_DEV = 48,
+#define _SC_2_FORT_DEV _SC_2_FORT_DEV
+ _SC_2_FORT_RUN = 49,
+#define _SC_2_FORT_RUN _SC_2_FORT_RUN
+ _SC_2_LOCALEDEF = 50,
+#define _SC_2_LOCALEDEF _SC_2_LOCALEDEF
+ _SC_2_SW_DEV = 51,
+#define _SC_2_SW_DEV _SC_2_SW_DEV
+ _SC_2_UPE = 52,
+#define _SC_2_UPE _SC_2_UPE
+ _SC_2_VERSION = 53,
+#define _SC_2_VERSION _SC_2_VERSION
+ _SC_BC_BASE_MAX = 54,
+#define _SC_BC_BASE_MAX _SC_BC_BASE_MAX
+ _SC_BC_DIM_MAX = 55,
+#define _SC_BC_DIM_MAX _SC_BC_DIM_MAX
+ _SC_BC_SCALE_MAX = 56,
+#define _SC_BC_SCALE_MAX _SC_BC_SCALE_MAX
+ _SC_BC_STRING_MAX = 57,
+#define _SC_BC_STRING_MAX _SC_BC_STRING_MAX
+ _SC_COLL_WEIGHTS_MAX = 58,
+#define _SC_COLL_WEIGHTS_MAX _SC_COLL_WEIGHTS_MAX
+ _SC_EXPR_NEST_MAX = 59,
+#define _SC_EXPR_NEST_MAX _SC_EXPR_NEST_MAX
+ _SC_LINE_MAX = 60,
+#define _SC_LINE_MAX _SC_LINE_MAX
+ _SC_RE_DUP_MAX = 61,
+#define _SC_RE_DUP_MAX _SC_RE_DUP_MAX
+ _SC_XOPEN_CRYPT = 62,
+#define _SC_XOPEN_CRYPT _SC_XOPEN_CRYPT
+ _SC_XOPEN_ENH_I18N = 63,
+#define _SC_XOPEN_ENH_I18N _SC_XOPEN_ENH_I18N
+ _SC_XOPEN_SHM = 64,
+#define _SC_XOPEN_SHM _SC_XOPEN_SHM
+
+ _SC_2_CHAR_TERM = 66,
+#define _SC_2_CHAR_TERM _SC_2_CHAR_TERM
+ _SC_XOPEN_XCU_VERSION = 67,
+#define _SC_XOPEN_XCU_VERSION _SC_XOPEN_XCU_VERSION
+
+ _SC_ATEXIT_MAX,
+#define _SC_ATEXIT_MAX _SC_ATEXIT_MAX
+ _SC_IOV_MAX = 77,
+#define _SC_IOV_MAX _SC_IOV_MAX
+ _SC_UIO_MAXIOV = _SC_IOV_MAX,
+#define _SC_UIO_MAXIOV _SC_UIO_MAXIOV
+ _SC_XOPEN_UNIX = 78,
+#define _SC_XOPEN_UNIX _SC_XOPEN_UNIX
+ _SC_T_IOV_MAX = 79,
+#define _SC_T_IOV_MAX _SC_T_IOV_MAX
+
+ _SC_PHYS_PAGES = 500,
+#define _SC_PHYS_PAGES _SC_PHYS_PAGES
+ _SC_AVPHYS_PAGES = 501,
+#define _SC_AVPHYS_PAGES _SC_AVPHYS_PAGES
+
+/* These are found in OpenSolaris but not GNU libc. */
+ _SC_COHER_BLKSZ = 503,
+#define _SC_COHER_BLKSZ _SC_COHER_BLKSZ
+ _SC_SPLIT_CACHE = 504,
+#define _SC_SPLIT_CACHE _SC_SPLIT_CACHE
+ _SC_ICACHE_SZ = 505,
+#define _SC_ICACHE_SZ _SC_ICACHE_SZ
+ _SC_DCACHE_SZ = 506,
+#define _SC_DCACHE_SZ _SC_DCACHE_SZ
+ _SC_ICACHE_LINESZ = 507,
+#define _SC_ICACHE_LINESZ _SC_ICACHE_LINESZ
+ _SC_DCACHE_LINESZ = 508,
+#define _SC_DCACHE_LINESZ _SC_DCACHE_LINESZ
+ _SC_ICACHE_BLKSZ = 509,
+#define _SC_ICACHE_BLKSZ _SC_ICACHE_BLKSZ
+ _SC_DCACHE_BLKSZ = 510,
+#define _SC_DCACHE_BLKSZ _SC_DCACHE_BLKSZ
+ _SC_DCACHE_TBLKSZ = 511,
+#define _SC_DCACHE_TBLKSZ _SC_DCACHE_TBLKSZ
+ _SC_ICACHE_ASSOC = 512,
+#define _SC_ICACHE_ASSOC _SC_ICACHE_ASSOC
+ _SC_DCACHE_ASSOC = 513,
+#define _SC_DCACHE_ASSOC _SC_DCACHE_ASSOC
+ _SC_MAXPID = 514,
+#define _SC_MAXPID _SC_MAXPID
+ _SC_STACK_PROT = 515,
+#define _SC_STACK_PROT _SC_STACK_PROT
+ _SC_NPROCESSORS_MAX = 516,
+#define _SC_NPROCESSORS_MAX _SC_NPROCESSORS_MAX
+ _SC_CPUID_MAX = 517,
+#define _SC_CPUID_MAX _SC_CPUID_MAX
+ _SC_EPHID_MAX = 518,
+#define _SC_EPHID_MAX _SC_EPHID_MAX
+
+ _SC_THREAD_DESTRUCTOR_ITERATIONS = 568,
+#define _SC_THREAD_DESTRUCTOR_ITERATIONS _SC_THREAD_DESTRUCTOR_ITERATIONS
+ _SC_GETGR_R_SIZE_MAX = 569,
+#define _SC_GETGR_R_SIZE_MAX _SC_GETGR_R_SIZE_MAX
+ _SC_GETPW_R_SIZE_MAX = 570,
+#define _SC_GETPW_R_SIZE_MAX _SC_GETPW_R_SIZE_MAX
+ _SC_LOGIN_NAME_MAX = 571,
+#define _SC_LOGIN_NAME_MAX _SC_LOGIN_NAME_MAX
+ _SC_THREAD_KEYS_MAX = 572,
+#define _SC_THREAD_KEYS_MAX _SC_THREAD_KEYS_MAX
+ _SC_THREAD_STACK_MIN = 573,
+#define _SC_THREAD_STACK_MIN _SC_THREAD_STACK_MIN
+ _SC_THREAD_THREADS_MAX = 574,
+#define _SC_THREAD_THREADS_MAX _SC_THREAD_THREADS_MAX
+ _SC_TTY_NAME_MAX = 575,
+#define _SC_TTY_NAME_MAX _SC_TTY_NAME_MAX
+ _SC_THREADS = 576,
+#define _SC_THREADS _SC_THREADS
+ _SC_THREAD_ATTR_STACKADDR = 577,
+#define _SC_THREAD_ATTR_STACKADDR _SC_THREAD_ATTR_STACKADDR
+ _SC_THREAD_ATTR_STACKSIZE = 578,
+#define _SC_THREAD_ATTR_STACKSIZE _SC_THREAD_ATTR_STACKSIZE
+ _SC_THREAD_PRIORITY_SCHEDULING = 579,
+#define _SC_THREAD_PRIORITY_SCHEDULING _SC_THREAD_PRIORITY_SCHEDULING
+ _SC_THREAD_PRIO_INHERIT = 580,
+#define _SC_THREAD_PRIO_INHERIT _SC_THREAD_PRIO_INHERIT
+ _SC_THREAD_PRIO_PROTECT = 581,
+#define _SC_THREAD_PRIO_PROTECT _SC_THREAD_PRIO_PROTECT
+ _SC_THREAD_PROCESS_SHARED = 582,
+#define _SC_THREAD_PROCESS_SHARED _SC_THREAD_PROCESS_SHARED
+ _SC_THREAD_SAFE_FUNCTIONS = 583,
+#define _SC_THREAD_SAFE_FUNCTIONS _SC_THREAD_SAFE_FUNCTIONS
+
+ _SC_XOPEN_LEGACY = 717,
+#define _SC_XOPEN_LEGACY _SC_XOPEN_LEGACY
+ _SC_XOPEN_REALTIME = 718,
+#define _SC_XOPEN_REALTIME _SC_XOPEN_REALTIME
+ _SC_XOPEN_REALTIME_THREADS = 719,
+#define _SC_XOPEN_REALTIME_THREADS _SC_XOPEN_REALTIME_THREADS
+ _SC_XBS5_ILP32_OFF32 = 720,
+#define _SC_XBS5_ILP32_OFF32 _SC_XBS5_ILP32_OFF32
+ _SC_XBS5_ILP32_OFFBIG = 721,
+#define _SC_XBS5_ILP32_OFFBIG _SC_XBS5_ILP32_OFFBIG
+ _SC_XBS5_LP64_OFF64 = 722,
+#define _SC_XBS5_LP64_OFF64 _SC_XBS5_LP64_OFF64
+ _SC_XBS5_LPBIG_OFFBIG = 723,
+#define _SC_XBS5_LPBIG_OFFBIG _SC_XBS5_LPBIG_OFFBIG
+ _SC_2_PBS = 724,
+#define _SC_2_PBS _SC_2_PBS
+ _SC_2_PBS_ACCOUNTING = 725,
+#define _SC_2_PBS_ACCOUNTING _SC_2_PBS_ACCOUNTING
+ _SC_2_PBS_CHECKPOINT = 726,
+#define _SC_2_PBS_CHECKPOINT _SC_2_PBS_CHECKPOINT
+/* 727 */
+ _SC_2_PBS_LOCATE = 728,
+#define _SC_2_PBS_LOCATE _SC_2_PBS_LOCATE
+ _SC_2_PBS_MESSAGE = 729,
+#define _SC_2_PBS_MESSAGE _SC_2_PBS_MESSAGE
+ _SC_2_PBS_TRACK = 730,
+#define _SC_2_PBS_TRACK _SC_2_PBS_TRACK
+ _SC_ADVISORY_INFO = 731,
+#define _SC_ADVISORY_INFO _SC_ADVISORY_INFO
+ _SC_BARRIERS = 732,
+#define _SC_BARRIERS _SC_BARRIERS
+ _SC_CLOCK_SELECTION = 733,
+#define _SC_CLOCK_SELECTION _SC_CLOCK_SELECTION
+ _SC_CPUTIME = 734,
+#define _SC_CPUTIME _SC_CPUTIME
+ _SC_HOST_NAME_MAX = 735,
+#define _SC_HOST_NAME_MAX _SC_HOST_NAME_MAX
+ _SC_MONOTONIC_CLOCK = 736,
+#define _SC_MONOTONIC_CLOCK _SC_MONOTONIC_CLOCK
+ _SC_READER_WRITER_LOCKS = 737,
+#define _SC_READER_WRITER_LOCKS _SC_READER_WRITER_LOCKS
+ _SC_REGEXP = 738,
+#define _SC_REGEXP _SC_REGEXP
+ _SC_SHELL = 739,
+#define _SC_SHELL _SC_SHELL
+ _SC_SPAWN = 740,
+#define _SC_SPAWN _SC_SPAWN
+ _SC_SPIN_LOCKS = 741,
+#define _SC_SPIN_LOCKS _SC_SPIN_LOCKS
+ _SC_SPORADIC_SERVER = 742,
+#define _SC_SPORADIC_SERVER _SC_SPORADIC_SERVER
+ _SC_SS_REPL_MAX = 743,
+#define _SC_SS_REPL_MAX _SC_SS_REPL_MAX /* OpenSolaris */
+ _SC_SYMLOOP_MAX = 744,
+#define _SC_SYMLOOP_MAX _SC_SYMLOOP_MAX
+ _SC_THREAD_CPUTIME = 745,
+#define _SC_THREAD_CPUTIME _SC_THREAD_CPUTIME
+ _SC_THREAD_SPORADIC_SERVER = 746,
+#define _SC_THREAD_SPORADIC_SERVER _SC_THREAD_SPORADIC_SERVER
+ _SC_TIMEOUTS = 747,
+#define _SC_TIMEOUTS _SC_TIMEOUTS
+ _SC_TRACE = 748,
+#define _SC_TRACE _SC_TRACE
+ _SC_TRACE_EVENT_FILTER = 749,
+#define _SC_TRACE_EVENT_FILTER _SC_TRACE_EVENT_FILTER
+ _SC_TRACE_EVENT_NAME_MAX = 750,
+#define _SC_TRACE_EVENT_NAME_MAX _SC_TRACE_EVENT_NAME_MAX /* OpenSolaris */
+ _SC_TRACE_INHERIT = 751,
+#define _SC_TRACE_INHERIT _SC_TRACE_INHERIT
+ _SC_TRACE_LOG = 752,
+#define _SC_TRACE_LOG _SC_TRACE_LOG
+ _SC_TRACE_NAME_MAX = 753,
+#define _SC_TRACE_NAME_MAX _SC_TRACE_NAME_MAX /* OpenSolaris */
+ _SC_TRACE_SYS_MAX = 754,
+#define _SC_TRACE_SYS_MAX _SC_TRACE_SYS_MAX /* OpenSolaris */
+ _SC_TRACE_USER_EVENT_MAX = 755,
+#define _SC_TRACE_USER_EVENT_MAX _SC_TRACE_USER_EVENT_MAX /* OpenSolaris */
+ _SC_TYPED_MEMORY_OBJECTS = 756,
+#define _SC_TYPED_MEMORY_OBJECTS _SC_TYPED_MEMORY_OBJECTS
+ _SC_V6_ILP32_OFF32 = 757,
+#define _SC_V6_ILP32_OFF32 _SC_V6_ILP32_OFF32
+ _SC_V6_ILP32_OFFBIG = 758,
+#define _SC_V6_ILP32_OFFBIG _SC_V6_ILP32_OFFBIG
+ _SC_V6_LP64_OFF64 = 759,
+#define _SC_V6_LP64_OFF64 _SC_V6_LP64_OFF64
+ _SC_V6_LPBIG_OFFBIG = 760,
+#define _SC_V6_LPBIG_OFFBIG _SC_V6_LPBIG_OFFBIG
+ _SC_XOPEN_STREAMS = 761,
+#define _SC_XOPEN_STREAMS _SC_XOPEN_STREAMS /* OpenSolaris */
+ _SC_IPV6 = 762,
+#define _SC_IPV6 _SC_IPV6
+ _SC_RAW_SOCKETS = 763,
+#define _SC_RAW_SOCKETS _SC_RAW_SOCKETS
+
+/* These are found in GNU libc but not OpenSolaris. */
+
+ _SC_EQUIV_CLASS_MAX = 5601,
+#define _SC_EQUIV_CLASS_MAX _SC_EQUIV_CLASS_MAX
+ _SC_CHARCLASS_NAME_MAX,
+#define _SC_CHARCLASS_NAME_MAX _SC_CHARCLASS_NAME_MAX
+
+ _SC_PII,
+#define _SC_PII _SC_PII
+ _SC_PII_XTI,
+#define _SC_PII_XTI _SC_PII_XTI
+ _SC_PII_SOCKET,
+#define _SC_PII_SOCKET _SC_PII_SOCKET
+ _SC_PII_INTERNET,
+#define _SC_PII_INTERNET _SC_PII_INTERNET
+ _SC_PII_OSI,
+#define _SC_PII_OSI _SC_PII_OSI
+ _SC_POLL,
+#define _SC_POLL _SC_POLL
+ _SC_SELECT,
+#define _SC_SELECT _SC_SELECT
+ _SC_PII_INTERNET_STREAM,
+#define _SC_PII_INTERNET_STREAM _SC_PII_INTERNET_STREAM
+ _SC_PII_INTERNET_DGRAM,
+#define _SC_PII_INTERNET_DGRAM _SC_PII_INTERNET_DGRAM
+ _SC_PII_OSI_COTS,
+#define _SC_PII_OSI_COTS _SC_PII_OSI_COTS
+ _SC_PII_OSI_CLTS,
+#define _SC_PII_OSI_CLTS _SC_PII_OSI_CLTS
+ _SC_PII_OSI_M,
+#define _SC_PII_OSI_M _SC_PII_OSI_M
+
+ _SC_XOPEN_XPG2,
+#define _SC_XOPEN_XPG2 _SC_XOPEN_XPG2
+ _SC_XOPEN_XPG3,
+#define _SC_XOPEN_XPG3 _SC_XOPEN_XPG3
+ _SC_XOPEN_XPG4,
+#define _SC_XOPEN_XPG4 _SC_XOPEN_XPG4
+
+ _SC_CHAR_BIT,
+#define _SC_CHAR_BIT _SC_CHAR_BIT
+ _SC_CHAR_MAX,
+#define _SC_CHAR_MAX _SC_CHAR_MAX
+ _SC_CHAR_MIN,
+#define _SC_CHAR_MIN _SC_CHAR_MIN
+ _SC_INT_MAX,
+#define _SC_INT_MAX _SC_INT_MAX
+ _SC_INT_MIN,
+#define _SC_INT_MIN _SC_INT_MIN
+ _SC_LONG_BIT,
+#define _SC_LONG_BIT _SC_LONG_BIT
+ _SC_WORD_BIT,
+#define _SC_WORD_BIT _SC_WORD_BIT
+ _SC_MB_LEN_MAX,
+#define _SC_MB_LEN_MAX _SC_MB_LEN_MAX
+ _SC_NZERO,
+#define _SC_NZERO _SC_NZERO
+ _SC_SSIZE_MAX,
+#define _SC_SSIZE_MAX _SC_SSIZE_MAX
+ _SC_SCHAR_MAX,
+#define _SC_SCHAR_MAX _SC_SCHAR_MAX
+ _SC_SCHAR_MIN,
+#define _SC_SCHAR_MIN _SC_SCHAR_MIN
+ _SC_SHRT_MAX,
+#define _SC_SHRT_MAX _SC_SHRT_MAX
+ _SC_SHRT_MIN,
+#define _SC_SHRT_MIN _SC_SHRT_MIN
+ _SC_UCHAR_MAX,
+#define _SC_UCHAR_MAX _SC_UCHAR_MAX
+ _SC_UINT_MAX,
+#define _SC_UINT_MAX _SC_UINT_MAX
+ _SC_ULONG_MAX,
+#define _SC_ULONG_MAX _SC_ULONG_MAX
+ _SC_USHRT_MAX,
+#define _SC_USHRT_MAX _SC_USHRT_MAX
+
+ _SC_NL_ARGMAX,
+#define _SC_NL_ARGMAX _SC_NL_ARGMAX
+ _SC_NL_LANGMAX,
+#define _SC_NL_LANGMAX _SC_NL_LANGMAX
+ _SC_NL_MSGMAX,
+#define _SC_NL_MSGMAX _SC_NL_MSGMAX
+ _SC_NL_NMAX,
+#define _SC_NL_NMAX _SC_NL_NMAX
+ _SC_NL_SETMAX,
+#define _SC_NL_SETMAX _SC_NL_SETMAX
+ _SC_NL_TEXTMAX,
+#define _SC_NL_TEXTMAX _SC_NL_TEXTMAX
+
+ _SC_BASE,
+#define _SC_BASE _SC_BASE
+ _SC_C_LANG_SUPPORT,
+#define _SC_C_LANG_SUPPORT _SC_C_LANG_SUPPORT
+ _SC_C_LANG_SUPPORT_R,
+#define _SC_C_LANG_SUPPORT_R _SC_C_LANG_SUPPORT_R
+ _SC_DEVICE_IO,
+#define _SC_DEVICE_IO _SC_DEVICE_IO
+ _SC_DEVICE_SPECIFIC,
+#define _SC_DEVICE_SPECIFIC _SC_DEVICE_SPECIFIC
+ _SC_DEVICE_SPECIFIC_R,
+#define _SC_DEVICE_SPECIFIC_R _SC_DEVICE_SPECIFIC_R
+ _SC_FD_MGMT,
+#define _SC_FD_MGMT _SC_FD_MGMT
+ _SC_FIFO,
+#define _SC_FIFO _SC_FIFO
+ _SC_PIPE,
+#define _SC_PIPE _SC_PIPE
+ _SC_FILE_ATTRIBUTES,
+#define _SC_FILE_ATTRIBUTES _SC_FILE_ATTRIBUTES
+ _SC_FILE_LOCKING,
+#define _SC_FILE_LOCKING _SC_FILE_LOCKING
+ _SC_FILE_SYSTEM,
+#define _SC_FILE_SYSTEM _SC_FILE_SYSTEM
+ _SC_MULTI_PROCESS,
+#define _SC_MULTI_PROCESS _SC_MULTI_PROCESS
+ _SC_SINGLE_PROCESS,
+#define _SC_SINGLE_PROCESS _SC_SINGLE_PROCESS
+ _SC_NETWORKING,
+#define _SC_NETWORKING _SC_NETWORKING
+ _SC_REGEX_VERSION,
+#define _SC_REGEX_VERSION _SC_REGEX_VERSION
+ _SC_SIGNALS,
+#define _SC_SIGNALS _SC_SIGNALS
+ _SC_SYSTEM_DATABASE,
+#define _SC_SYSTEM_DATABASE _SC_SYSTEM_DATABASE
+ _SC_SYSTEM_DATABASE_R,
+#define _SC_SYSTEM_DATABASE_R _SC_SYSTEM_DATABASE_R
+ _SC_USER_GROUPS,
+#define _SC_USER_GROUPS _SC_USER_GROUPS
+ _SC_USER_GROUPS_R,
+#define _SC_USER_GROUPS_R _SC_USER_GROUPS_R
+ _SC_STREAMS,
+#define _SC_STREAMS _SC_STREAMS
+
+ _SC_LEVEL1_ICACHE_SIZE,
+#define _SC_LEVEL1_ICACHE_SIZE _SC_LEVEL1_ICACHE_SIZE
+ _SC_LEVEL1_ICACHE_ASSOC,
+#define _SC_LEVEL1_ICACHE_ASSOC _SC_LEVEL1_ICACHE_ASSOC
+ _SC_LEVEL1_ICACHE_LINESIZE,
+#define _SC_LEVEL1_ICACHE_LINESIZE _SC_LEVEL1_ICACHE_LINESIZE
+ _SC_LEVEL1_DCACHE_SIZE,
+#define _SC_LEVEL1_DCACHE_SIZE _SC_LEVEL1_DCACHE_SIZE
+ _SC_LEVEL1_DCACHE_ASSOC,
+#define _SC_LEVEL1_DCACHE_ASSOC _SC_LEVEL1_DCACHE_ASSOC
+ _SC_LEVEL1_DCACHE_LINESIZE,
+#define _SC_LEVEL1_DCACHE_LINESIZE _SC_LEVEL1_DCACHE_LINESIZE
+ _SC_LEVEL2_CACHE_SIZE,
+#define _SC_LEVEL2_CACHE_SIZE _SC_LEVEL2_CACHE_SIZE
+ _SC_LEVEL2_CACHE_ASSOC,
+#define _SC_LEVEL2_CACHE_ASSOC _SC_LEVEL2_CACHE_ASSOC
+ _SC_LEVEL2_CACHE_LINESIZE,
+#define _SC_LEVEL2_CACHE_LINESIZE _SC_LEVEL2_CACHE_LINESIZE
+ _SC_LEVEL3_CACHE_SIZE,
+#define _SC_LEVEL3_CACHE_SIZE _SC_LEVEL3_CACHE_SIZE
+ _SC_LEVEL3_CACHE_ASSOC,
+#define _SC_LEVEL3_CACHE_ASSOC _SC_LEVEL3_CACHE_ASSOC
+ _SC_LEVEL3_CACHE_LINESIZE,
+#define _SC_LEVEL3_CACHE_LINESIZE _SC_LEVEL3_CACHE_LINESIZE
+ _SC_LEVEL4_CACHE_SIZE,
+#define _SC_LEVEL4_CACHE_SIZE _SC_LEVEL4_CACHE_SIZE
+ _SC_LEVEL4_CACHE_ASSOC,
+#define _SC_LEVEL4_CACHE_ASSOC _SC_LEVEL4_CACHE_ASSOC
+ _SC_LEVEL4_CACHE_LINESIZE,
+#define _SC_LEVEL4_CACHE_LINESIZE _SC_LEVEL4_CACHE_LINESIZE
+ };
+
+/* Values for the NAME argument to `confstr'. */
+enum
+ {
+ _CS_PATH = 65, /* The default search path. */
+#define _CS_PATH _CS_PATH
+
+ _CS_LFS_CFLAGS = 68,
+#define _CS_LFS_CFLAGS _CS_LFS_CFLAGS
+ _CS_LFS_LDFLAGS = 69,
+#define _CS_LFS_LDFLAGS _CS_LFS_LDFLAGS
+ _CS_LFS_LIBS = 70,
+#define _CS_LFS_LIBS _CS_LFS_LIBS
+ _CS_LFS_LINTFLAGS = 71,
+#define _CS_LFS_LINTFLAGS _CS_LFS_LINTFLAGS
+ _CS_LFS64_CFLAGS = 72,
+#define _CS_LFS64_CFLAGS _CS_LFS64_CFLAGS
+ _CS_LFS64_LDFLAGS = 73,
+#define _CS_LFS64_LDFLAGS _CS_LFS64_LDFLAGS
+ _CS_LFS64_LIBS = 74,
+#define _CS_LFS64_LIBS _CS_LFS64_LIBS
+ _CS_LFS64_LINTFLAGS = 75,
+#define _CS_LFS64_LINTFLAGS _CS_LFS64_LINTFLAGS
+
+ _CS_XBS5_ILP32_OFF32_CFLAGS = 700,
+#define _CS_XBS5_ILP32_OFF32_CFLAGS _CS_XBS5_ILP32_OFF32_CFLAGS
+ _CS_XBS5_ILP32_OFF32_LDFLAGS = 701,
+#define _CS_XBS5_ILP32_OFF32_LDFLAGS _CS_XBS5_ILP32_OFF32_LDFLAGS
+ _CS_XBS5_ILP32_OFF32_LIBS = 702,
+#define _CS_XBS5_ILP32_OFF32_LIBS _CS_XBS5_ILP32_OFF32_LIBS
+ _CS_XBS5_ILP32_OFF32_LINTFLAGS = 703,
+#define _CS_XBS5_ILP32_OFF32_LINTFLAGS _CS_XBS5_ILP32_OFF32_LINTFLAGS
+/* 704 */
+ _CS_XBS5_ILP32_OFFBIG_CFLAGS = 705,
+#define _CS_XBS5_ILP32_OFFBIG_CFLAGS _CS_XBS5_ILP32_OFFBIG_CFLAGS
+ _CS_XBS5_ILP32_OFFBIG_LDFLAGS = 706,
+#define _CS_XBS5_ILP32_OFFBIG_LDFLAGS _CS_XBS5_ILP32_OFFBIG_LDFLAGS
+ _CS_XBS5_ILP32_OFFBIG_LIBS = 707,
+#define _CS_XBS5_ILP32_OFFBIG_LIBS _CS_XBS5_ILP32_OFFBIG_LIBS
+ _CS_XBS5_ILP32_OFFBIG_LINTFLAGS = 708,
+#define _CS_XBS5_ILP32_OFFBIG_LINTFLAGS _CS_XBS5_ILP32_OFFBIG_LINTFLAGS
+ _CS_XBS5_LP64_OFF64_CFLAGS = 709,
+#define _CS_XBS5_LP64_OFF64_CFLAGS _CS_XBS5_LP64_OFF64_CFLAGS
+ _CS_XBS5_LP64_OFF64_LDFLAGS = 710,
+#define _CS_XBS5_LP64_OFF64_LDFLAGS _CS_XBS5_LP64_OFF64_LDFLAGS
+ _CS_XBS5_LP64_OFF64_LIBS = 711,
+#define _CS_XBS5_LP64_OFF64_LIBS _CS_XBS5_LP64_OFF64_LIBS
+ _CS_XBS5_LP64_OFF64_LINTFLAGS = 712,
+#define _CS_XBS5_LP64_OFF64_LINTFLAGS _CS_XBS5_LP64_OFF64_LINTFLAGS
+ _CS_XBS5_LPBIG_OFFBIG_CFLAGS = 713,
+#define _CS_XBS5_LPBIG_OFFBIG_CFLAGS _CS_XBS5_LPBIG_OFFBIG_CFLAGS
+ _CS_XBS5_LPBIG_OFFBIG_LDFLAGS = 714,
+#define _CS_XBS5_LPBIG_OFFBIG_LDFLAGS _CS_XBS5_LPBIG_OFFBIG_LDFLAGS
+ _CS_XBS5_LPBIG_OFFBIG_LIBS = 715,
+#define _CS_XBS5_LPBIG_OFFBIG_LIBS _CS_XBS5_LPBIG_OFFBIG_LIBS
+ _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS = 716,
+#define _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS
+
+ _CS_POSIX_V6_ILP32_OFF32_CFLAGS = 800,
+#define _CS_POSIX_V6_ILP32_OFF32_CFLAGS _CS_POSIX_V6_ILP32_OFF32_CFLAGS
+ _CS_POSIX_V6_ILP32_OFF32_LDFLAGS = 801,
+#define _CS_POSIX_V6_ILP32_OFF32_LDFLAGS _CS_POSIX_V6_ILP32_OFF32_LDFLAGS
+ _CS_POSIX_V6_ILP32_OFF32_LIBS = 802,
+#define _CS_POSIX_V6_ILP32_OFF32_LIBS _CS_POSIX_V6_ILP32_OFF32_LIBS
+ _CS_POSIX_V6_ILP32_OFF32_LINTFLAGS = 803,
+#define _CS_POSIX_V6_ILP32_OFF32_LINTFLAGS _CS_POSIX_V6_ILP32_OFF32_LINTFLAGS
+ _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS = 804,
+#define _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS
+ _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS = 805,
+#define _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS
+ _CS_POSIX_V6_ILP32_OFFBIG_LIBS = 806,
+#define _CS_POSIX_V6_ILP32_OFFBIG_LIBS _CS_POSIX_V6_ILP32_OFFBIG_LIBS
+ _CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS = 807,
+#define _CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS _CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS
+ _CS_POSIX_V6_LP64_OFF64_CFLAGS = 808,
+#define _CS_POSIX_V6_LP64_OFF64_CFLAGS _CS_POSIX_V6_LP64_OFF64_CFLAGS
+ _CS_POSIX_V6_LP64_OFF64_LDFLAGS = 809,
+#define _CS_POSIX_V6_LP64_OFF64_LDFLAGS _CS_POSIX_V6_LP64_OFF64_LDFLAGS
+ _CS_POSIX_V6_LP64_OFF64_LIBS = 810,
+#define _CS_POSIX_V6_LP64_OFF64_LIBS _CS_POSIX_V6_LP64_OFF64_LIBS
+ _CS_POSIX_V6_LP64_OFF64_LINTFLAGS = 811,
+#define _CS_POSIX_V6_LP64_OFF64_LINTFLAGS _CS_POSIX_V6_LP64_OFF64_LINTFLAGS
+ _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS = 812,
+#define _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS
+ _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS = 813,
+#define _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS
+ _CS_POSIX_V6_LPBIG_OFFBIG_LIBS = 814,
+#define _CS_POSIX_V6_LPBIG_OFFBIG_LIBS _CS_POSIX_V6_LPBIG_OFFBIG_LIBS
+ _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS = 815,
+#define _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS
+ _CS_V6_WIDTH_RESTRICTED_ENVS = 816,
+#define _CS_V6_WIDTH_RESTRICTED_ENVS _CS_V6_WIDTH_RESTRICTED_ENVS
+#define _CS_POSIX_V6_WIDTH_RESTRICTED_ENVS _CS_V6_WIDTH_RESTRICTED_ENVS
+
+/* These are found in GNU libc but not OpenSolaris. */
+
+ _CS_GNU_LIBC_VERSION = 5701,
+#define _CS_GNU_LIBC_VERSION _CS_GNU_LIBC_VERSION
+ _CS_GNU_LIBPTHREAD_VERSION
+#define _CS_GNU_LIBPTHREAD_VERSION _CS_GNU_LIBPTHREAD_VERSION
+ };
+
+#define _ACL_ACLENT_ENABLED 1
+#define _ACL_ACE_ENABLED 2
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/dirent.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/dirent.h
new file mode 100644
index 0000000000..eaa6ac6118
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/dirent.h
@@ -0,0 +1,53 @@
+/* Copyright (C) 1996, 1997, 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _DIRENT_H
+# error "Never use <bits/dirent.h> directly; include <dirent.h> instead."
+#endif
+
+typedef struct dirent
+ {
+#ifndef __USE_FILE_OFFSET64
+ __ino_t d_ino;
+ __off_t d_off;
+#else
+ __ino64_t d_ino;
+ __off64_t d_off;
+#endif
+ unsigned short int d_reclen;
+ unsigned char d_type;
+ char d_name[256]; /* We must not include limits.h! */
+ } dirent_t;
+
+#ifdef __USE_LARGEFILE64
+typedef struct dirent64
+ {
+ __ino64_t d_ino;
+ __off64_t d_off;
+ unsigned short int d_reclen;
+ unsigned char d_type;
+ char d_name[256]; /* We must not include limits.h! */
+ } dirent64_t;
+#endif
+
+#define d_fileno d_ino /* Backwards compatibility. */
+
+#undef _DIRENT_HAVE_D_NAMLEN
+#define _DIRENT_HAVE_D_RECLEN
+#define _DIRENT_HAVE_D_OFF
+#define _DIRENT_HAVE_D_TYPE
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/elfclass.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/elfclass.h
new file mode 100644
index 0000000000..04a76f59b3
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/elfclass.h
@@ -0,0 +1,79 @@
+/* This file specifies the native word size of the machine, which indicates
+ the ELF file class used for executables and shared objects on this
+ machine. */
+
+#ifndef _LINK_H
+# error "Never use <bits/elfclass.h> directly; include <link.h> instead."
+#endif
+
+#include <bits/wordsize.h>
+
+#define __ELF_NATIVE_CLASS __WORDSIZE
+
+/* The entries in the .hash table always have a size of 32 bits. */
+typedef uint32_t Elf_Symndx;
+
+typedef struct
+ {
+ Elf32_Sword eb_tag;
+ union
+ {
+ Elf32_Word eb_val;
+ Elf32_Addr eb_ptr;
+ Elf32_Off eb_off;
+ } eb_un;
+ } Elf32_Boot;
+
+typedef struct
+ {
+ Elf64_Xword eb_tag;
+ union
+ {
+ Elf64_Xword eb_val;
+ Elf64_Addr eb_ptr;
+ Elf64_Off eb_off;
+ } eb_un;
+ } Elf64_Boot;
+
+typedef uint64_t Elf32_Lword;
+typedef uint64_t Elf64_Lword;
+
+#define DT_SUNW_AUXILIARY 0x6000000d
+#define DT_SUNW_RTLDINF 0x6000000e
+#define DT_SUNW_FILTER 0x6000000f
+#define DT_SUNW_CAP 0x60000010
+#define DT_SUNW_SYMTAB 0x60000011
+#define DT_SUNW_SYMSZ 0x60000012
+#define DT_SUNW_ENCODING 0x60000013
+#define DT_SUNW_SORTENT 0x60000013
+#define DT_SUNW_SYMSORT 0x60000014
+#define DT_SUNW_SYMSORTSZ 0x60000015
+#define DT_SUNW_TLSSORT 0x60000016
+#define DT_SUNW_TLSSORTSZ 0x60000017
+#define DT_SUNW_STRPAD 0x60000019
+#define DT_SUNW_LDMACH 0x6000001b
+
+#define NT_PRSTATUS 1
+#define NT_PRFPREG 2
+#define NT_PRPSINFO 3
+#define NT_PRXREG 4
+#define NT_PLATFORM 5
+#define NT_AUXV 6
+#define NT_GWINDOWS 7
+#define NT_ASRS 8
+#define NT_LDT 9
+#define NT_PSTATUS 10
+#define NT_PSINFO 13
+#define NT_PRCRED 14
+#define NT_UTSNAME 15
+#define NT_LWPSTATUS 16
+#define NT_LWPSINFO 17
+#define NT_PRPRIV 18
+#define NT_PRPRIVINFO 19
+#define NT_CONTENT 20
+#define NT_ZONENAME 21
+#define NT_NUM 21
+
+#define LM_ID_BASE 0
+#define LM_ID_LDSO 1
+#define LM_ID_NUM 2
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/errno.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/errno.h
new file mode 100644
index 0000000000..b1d9413d89
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/errno.h
@@ -0,0 +1,184 @@
+/* Copyright (C) 1991, 1994, 1996, 1997, 1998, 2008
+ Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+/* This file defines the `errno' constants. */
+
+#if !defined __Emath_defined && (defined _ERRNO_H || defined __need_Emath)
+#undef __need_Emath
+#define __Emath_defined 1
+
+# define EDOM 33 /* Math argument out of domain of function. */
+# define EILSEQ 88 /* Illegal byte sequence. */
+# define ERANGE 34 /* Math result not representable. */
+#endif
+
+#ifdef _ERRNO_H
+/* All error codes the system knows about. */
+
+# define EPERM 1 /* Not super-user. */
+# define ENOENT 2 /* No such file or directory. */
+# define ESRCH 3 /* No such process. */
+# define EINTR 4 /* Interrupted system call. */
+# define EIO 5 /* I/O error. */
+# define ENXIO 6 /* No such device or address. */
+# define E2BIG 7 /* Arg list too long. */
+# define ENOEXEC 8 /* Exec format error. */
+# define EBADF 9 /* Bad file number. */
+# define ECHILD 10 /* No children. */
+# define EAGAIN 11 /* Resource temporarily unavailable. */
+# define EWOULDBLOCK EAGAIN
+# define ENOMEM 12 /* Not enough core. */
+# define EACCES 13 /* Permission denied. */
+# define EFAULT 14 /* Bad address. */
+# define ENOTBLK 15 /* Block device required. */
+# define EBUSY 16 /* Mount device busy. */
+# define EEXIST 17 /* File exists. */
+# define EXDEV 18 /* Cross-device link. */
+# define ENODEV 19 /* No such device. */
+# define ENOTDIR 20 /* Not a directory. */
+# define EISDIR 21 /* Is a directory. */
+# define EINVAL 22 /* Invalid argument. */
+# define ENFILE 23 /* File table overflow. */
+# define EMFILE 24 /* Too many open files. */
+# define ENOTTY 25 /* Inappropriate ioctl for device. */
+# define ETXTBSY 26 /* Text file busy. */
+# define EFBIG 27 /* File too large. */
+# define ENOSPC 28 /* No space left on device. */
+# define ESPIPE 29 /* Illegal seek. */
+# define EROFS 30 /* Read only file system. */
+# define EMLINK 31 /* Too many links. */
+# define EPIPE 32 /* Broken pipe. */
+# define ENOMSG 35 /* No message of desired type. */
+# define EIDRM 36 /* Identifier removed. */
+# define ECHRNG 37 /* Channel number out of range. */
+# define EL2NSYNC 38 /* Level 2 not synchronized. */
+# define EL3HLT 39 /* Level 3 halted. */
+# define EL3RST 40 /* Level 3 reset. */
+# define ELNRNG 41 /* Link number out of range. */
+# define EUNATCH 42 /* Protocol driver not attached. */
+# define ENOCSI 43 /* No CSI structure available. */
+# define EL2HLT 44 /* Level 2 halted. */
+# define EDEADLK 45 /* Deadlock condition. */
+# define ENOLCK 46 /* No record locks available. */
+# define ECANCELED 47 /* Operation canceled. */
+# define ENOTSUP 48 /* Operation not supported. */
+
+/* Filesystem Quotas. */
+# define EDQUOT 49 /* Disc quota exceeded. */
+
+/* Convergent Error Returns. */
+# define EBADE 50 /* Invalid exchange. */
+# define EBADR 51 /* Invalid request descriptor. */
+# define EXFULL 52 /* Exchange full. */
+# define ENOANO 53 /* No anode. */
+# define EBADRQC 54 /* Invalid request code. */
+# define EBADSLT 55 /* Invalid slot. */
+# define EDEADLOCK 56 /* File locking deadlock error. */
+
+# define EBFONT 57 /* Bad font file fmt. */
+
+# define EOWNERDEAD 58 /* Process died with the lock. */
+# define ENOTRECOVERABLE 59 /* Lock is not recoverable. */
+
+/* STREAM problems. */
+# define ENOSTR 60 /* Device not a stream. */
+# define ENODATA 61 /* No data (for no delay io). */
+# define ETIME 62 /* Timer expired. */
+# define ENOSR 63 /* Out of streams resources. */
+
+# define ENONET 64 /* Machine is not on the network. */
+# define ENOPKG 65 /* Package not installed. */
+# define EREMOTE 66 /* The object is remote. */
+# define ENOLINK 67 /* The link has been severed. */
+# define EADV 68 /* Advertise error. */
+# define ESRMNT 69 /* Srmount error. */
+
+# define ECOMM 70 /* Communication error on send. */
+# define EPROTO 71 /* Protocol error. */
+# define ELOCKUNMAPPED 72 /* locked lock was unmapped. */
+# define ENOTACTIVE 73 /* Facility is not active. */
+# define EMULTIHOP 74 /* Multihop attempted. */
+# define EBADMSG 77 /* Trying to read unreadable message. */
+# define ENAMETOOLONG 78 /* Path name is too long. */
+# define EOVERFLOW 79 /* Value too large to be stored in data type.*/
+# define ENOTUNIQ 80 /* Given log. name not unique. */
+# define EBADFD 81 /* F.d. invalid for this operation. */
+# define EREMCHG 82 /* Remote address changed. */
+
+/* Shared library problems. */
+# define ELIBACC 83 /* Can't access a needed shared lib. */
+# define ELIBBAD 84 /* Accessing a corrupted shared lib. */
+# define ELIBSCN 85 /* .lib section in a.out corrupted. */
+# define ELIBMAX 86 /* Attempting to link in too many libs. */
+# define ELIBEXEC 87 /* Attempting to exec a shared library. */
+# define ENOSYS 89 /* Unsupported file system operation. */
+# define ELOOP 90 /* Symbolic link loop. */
+# define ERESTART 91 /* Restartable system call. */
+# define ESTRPIPE 92 /* If pipe/FIFO, don't sleep in stream head. */
+# define ENOTEMPTY 93 /* Directory not empty. */
+# define EUSERS 94 /* Too many users (for UFS). */
+
+/* BSD Networking Software: argument errors. */
+# define ENOTSOCK 95 /* Socket operation on non-socket. */
+# define EDESTADDRREQ 96 /* Destination address required. */
+# define EMSGSIZE 97 /* Message too long. */
+# define EPROTOTYPE 98 /* Protocol wrong type for socket. */
+# define ENOPROTOOPT 99 /* Protocol not available. */
+# define EPROTONOSUPPORT 120 /* Protocol not supported. */
+# define ESOCKTNOSUPPORT 121 /* Socket type not supported. */
+# define EOPNOTSUPP 122 /* Operation not supported on socket. */
+# define EPFNOSUPPORT 123 /* Protocol family not supported. */
+# define EAFNOSUPPORT 124 /* Address family not supported by
+ protocol family. */
+# define EADDRINUSE 125 /* Address already in use. */
+# define EADDRNOTAVAIL 126 /* Can't assign requested address. */
+/* BSD Networking Software: operational errors. */
+# define ENETDOWN 127 /* Network is down. */
+# define ENETUNREACH 128 /* Network is unreachable. */
+# define ENETRESET 129 /* Network dropped connection because
+ of reset. */
+# define ECONNABORTED 130 /* Software caused connection abort. */
+# define ECONNRESET 131 /* Connection reset by peer. */
+# define ENOBUFS 132 /* No buffer space available. */
+# define EISCONN 133 /* Socket is already connected. */
+# define ENOTCONN 134 /* Socket is not connected. */
+/* XENIX has 135 - 142. */
+# define ESHUTDOWN 143 /* Can't send after socket shutdown. */
+# define ETOOMANYREFS 144 /* Too many references: can't splice. */
+# define ETIMEDOUT 145 /* Connection timed out. */
+# define ECONNREFUSED 146 /* Connection refused. */
+# define EHOSTDOWN 147 /* Host is down. */
+# define EHOSTUNREACH 148 /* No route to host. */
+# define EALREADY 149 /* operation already in progress. */
+# define EINPROGRESS 150 /* operation now in progress. */
+
+/* SUN Network File System. */
+# define ESTALE 151 /* Stale NFS file handle. */
+
+# ifndef __ASSEMBLER__
+/* Function to get address of global `errno' variable. */
+extern int *__errno_location (void) __THROW __attribute__ ((__const__));
+
+# if !defined _LIBC || defined _LIBC_REENTRANT
+/* When using threads, errno is a per-thread value. */
+# define errno (*__errno_location ())
+# endif
+# endif /* !__ASSEMBLER__ */
+
+#endif /* _ERRNO_H */
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/fcntl.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/fcntl.h
new file mode 100644
index 0000000000..de499417b2
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/fcntl.h
@@ -0,0 +1,267 @@
+/* O_*, F_*, FD_* bit values for OpenSolaris.
+ Copyright (C) 2001, 2002, 2004, 2006, 2007, 2008
+ Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _FCNTL_H
+# error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead."
+#endif
+
+#include <sys/types.h>
+#include <bits/wordsize.h>
+#ifdef __USE_GNU
+# include <bits/uio.h>
+#endif
+
+
+/* open/fcntl */
+#define O_RDONLY 0
+#define O_WRONLY 1
+#define O_RDWR 2
+#define O_ACCMODE 3
+#define O_NDELAY 0x04
+#define O_APPEND 0x08
+#define O_SYNC 0x10
+#define O_NONBLOCK 0x80
+#define O_CREAT 0x100
+#define O_TRUNC 0x200
+#define O_EXCL 0x400
+#define O_NOCTTY 0x800
+#define O_PRIV 0x1000
+#define O_XATTR 0x4000
+#define O_NOFOLLOW 0x20000
+#define O_NOLINKS 0x40000
+
+#if defined __USE_POSIX199309 || defined __USE_UNIX98
+# define O_DSYNC 0x40 /* Synchronize data. */
+# define O_RSYNC 0x8000 /* Synchronize read operations. */
+#endif
+#define O_FSYNC O_SYNC
+
+#ifdef __USE_GNU
+#define O_DIRECT 0x1000000
+#define O_DIRECTORY 0x2000000
+#endif
+
+#ifdef __USE_LARGEFILE64
+# if __WORDSIZE == 64
+# define O_LARGEFILE 0
+# else
+# define O_LARGEFILE 0x2000
+# endif
+#endif
+
+/* Values for the second argument to `fcntl'. */
+#define F_DUPFD 0 /* Duplicate file descriptor. */
+#define F_GETFD 1 /* Get file descriptor flags. */
+#define F_SETFD 2 /* Set file descriptor flags. */
+#define F_GETFL 3 /* Get file status flags. */
+#define F_SETFL 4 /* Set file status flags. */
+#if __WORDSIZE == 64
+# define F_GETLK 14 /* Get record locking info. */
+# define F_SETLK 6 /* Set record locking info (non-blocking). */
+# define F_SETLKW 7 /* Set record locking info (blocking). */
+# define F_ALLOCSP 10 /* Allocate file space. */
+# define F_FREESP 11 /* Free file space. */
+# define F_SETLK_NBMAND 42 /* Private. */
+/* Not necessary, we always have 64-bit offsets. */
+# define F_GETLK64 F_GETLK /* Get record locking info. */
+# define F_SETLK64 F_SETLK /* Set record locking info (non-blocking). */
+# define F_SETLKW64 F_SETLKW /* Set record locking info (blocking). */
+# define F_ALLOCSP64 F_ALLOCSP /* Allocate file space. */
+# define F_FREESP64 F_FREESP /* Free file space. */
+# define F_SETLK64_NBMAND F_SETLK_NBMAND /* Private. */
+#else
+# ifndef __USE_FILE_OFFSET64
+# define F_GETLK 14 /* Get record locking info. */
+# define F_SETLK 6 /* Set record locking info (non-blocking). */
+# define F_SETLKW 7 /* Set record locking info (blocking). */
+# define F_ALLOCSP 10 /* Allocate file space. */
+# define F_FREESP 11 /* Free file space. */
+# define F_SETLK_NBMAND 42 /* Private. */
+# else
+# define F_GETLK F_GETLK64 /* Get record locking info. */
+# define F_SETLK F_SETLK64 /* Set record locking info (non-blocking).*/
+# define F_SETLKW F_SETLKW64 /* Set record locking info (blocking). */
+# define F_ALLOCSP F_ALLOCSP64 /* Allocate file space. */
+# define F_FREESP F_FREESP64 /* Free file space. */
+# define F_SETLK_NBMAND F_SETLK64_NBMAND /* Private. */
+# endif
+# define F_GETLK64 33 /* Get record locking info. */
+# define F_SETLK64 34 /* Set record locking info (non-blocking). */
+# define F_SETLKW64 35 /* Set record locking info (blocking). */
+# define F_ALLOCSP64 28 /* Allocate file space. */
+# define F_FREESP64 27 /* Free file space. */
+# define F_SETLK64_NBMAND 44 /* Private. */
+#endif
+
+/* OpenSolaris-specific */
+#define F_GETXFL 45
+#define F_CHKFL 8
+#define F_DUP2FD 9
+#define F_ISSTREAM 13
+#define F_PRIV 15
+#define F_NPRIV 16
+#define F_QUOTACTL 17
+#define F_BLOCKS 18
+#define F_BLKSIZE 19
+#define F_GETOWN 23
+#define F_SETOWN 24
+#define F_REVOKE 25
+#define F_HASREMOTELOCKS 26
+
+#define F_SHARE 40
+#define F_UNSHARE 41
+#define F_SHARE_NBMAND 43
+
+typedef struct fshare
+{
+ short f_access;
+ short f_deny;
+ int f_id;
+} fshare_t;
+
+/* f_access values */
+#define F_RDACC 0x1
+#define F_WRACC 0x2
+#define F_RWACC 0x3
+#define F_RMACC 0x4
+#define F_MDACC 0x20
+
+/* f_deny values */
+#define F_NODNY 0x0
+#define F_RDDNY 0x1
+#define F_WRDNY 0x2
+#define F_RWDNY 0x3
+#define F_RMDNY 0x4
+#define F_COMPAT 0x8
+#define F_MANDDNY 0x10
+
+#define F_BADFD 46
+
+/* For F_[GET|SET]FD. */
+# define FD_CLOEXEC 1 /* actually anything with low bit set goes */
+
+/* For posix fcntl() and `l_type' field of a `struct flock' for lockf(). */
+# define F_RDLCK 1 /* Read lock. */
+# define F_WRLCK 2 /* Write lock. */
+# define F_UNLCK 3 /* Remove lock. */
+/* OpenSolaris-specific */
+#define F_UNLKSYS 4
+
+typedef struct flock
+ {
+ short int l_type; /* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK. */
+ short int l_whence; /* Where `l_start' is relative to (like `lseek'). */
+#ifndef __USE_FILE_OFFSET64
+ __off_t l_start; /* Offset where the lock begins. */
+ __off_t l_len; /* Size of the locked area; zero means until EOF. */
+#else
+ __off64_t l_start; /* Offset where the lock begins. */
+ __off64_t l_len; /* Size of the locked area; zero means until EOF. */
+#endif
+ int l_sysid;
+ __pid_t l_pid; /* Process holding the lock. */
+ long l_pad[4];
+ } flock_t;
+
+#ifdef _SYSCALL32
+typedef struct flock32
+ {
+ __int16_t l_type;
+ __int16_t l_whence;
+ __off_t l_start;
+ __off_t l_len;
+ __int32_t l_sysid;
+ __pid_t l_pid;
+ __int32_t l_pad[4];
+ } flock32_t;
+#endif
+
+#ifdef __USE_LARGEFILE64
+typedef struct flock64
+ {
+ short int l_type; /* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK. */
+ short int l_whence; /* Where `l_start' is relative to (like `lseek'). */
+ __off64_t l_start; /* Offset where the lock begins. */
+ __off64_t l_len; /* Size of the locked area; zero means until EOF. */
+ int l_sysid;
+ __pid_t l_pid; /* Process holding the lock. */
+ long l_pad[4];
+ } flock64_t;
+#endif
+
+/* OpenSolaris direct i/o */
+#define DIRECTIO_OFF (0)
+#define DIRECTIO_ON (1)
+
+/* OpenSolaris-specific seek flags */
+#define SEEK_DATA 3
+#define SEEK_HOLE 4
+
+/* at-file support */
+#ifdef __USE_ATFILE
+# define __AT_DEFINED
+# define AT_FDCWD 0xffd19553 /* Special value used to indicate
+ the *at functions should use the
+ current working directory. */
+# define AT_SYMLINK_NOFOLLOW 0x1000 /* Do not follow symbolic links. */
+# define AT_REMOVEDIR 0x1 /* Remove directory instead of
+ unlinking file. */
+# define AT_EACCESS 010 /* Test access permitted for
+ effective IDs, not real IDs. */
+#endif
+
+/* Define some more compatibility macros to be backward compatible with
+ BSD systems which did not managed to hide these kernel macros. */
+#ifdef __USE_BSD
+# define FOPEN 0xffffffff
+# define FREAD 0x01
+# define FWRITE 0x02
+# define NDELAY 0x04
+# define FNDELAY NDELAY
+# define FAPPEND 0x08
+# define FSYNC 0x10
+# define FFSYNC FSYNC
+# define FREVOKED 0x20
+# define FDSYNC 0x40
+# define FNONBLOCK 0x80
+# define FCREAT 0x0100
+# define FTRUNC 0x0200
+# define FEXCL 0x0400
+# define FASYNC 0x1000
+# define FOFFMAX 0x2000
+# define FXATTR 0x4000
+# define FNOCTTY 0x0800
+# define FRSYNC 0x8000
+# define FNODSYNC 0x10000
+# define FNOFOLLOW 0x20000
+# define FNOLINKS 0x40000
+# define FIGNORECASE 0x80000
+# define FXATTRDIROPEN 0x100000
+#endif /* Use BSD. */
+
+/* Advise to `posix_fadvise'. */
+#ifdef __USE_XOPEN2K
+# define POSIX_FADV_NORMAL 0 /* No further special treatment. */
+# define POSIX_FADV_RANDOM 1 /* Expect random page references. */
+# define POSIX_FADV_SEQUENTIAL 2 /* Expect sequential page references. */
+# define POSIX_FADV_WILLNEED 3 /* Will need these pages. */
+# define POSIX_FADV_DONTNEED 4 /* Don't need these pages. */
+# define POSIX_FADV_NOREUSE 5 /* Data will be accessed once. */
+#endif
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/in.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/in.h
new file mode 100644
index 0000000000..cef1f59c31
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/in.h
@@ -0,0 +1,194 @@
+/* Copyright (C) 1991-1999, 2000, 2004, 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+/* Linux version. */
+
+#ifndef _NETINET_IN_H
+# error "Never use <bits/in.h> directly; include <netinet/in.h> instead."
+#endif
+
+/* Really these belong in the enum in netinet/in.h. */
+#define IPPROTO_GGP 3
+#define IPPROTO_HELLO 63
+#define IPPROTO_ND 77
+#define IPPROTO_EON 80
+
+#define IPPORT_CHARGEN 19
+
+/* Options for use with `getsockopt' and `setsockopt' at the IP level.
+ The first word in the comment at the right is the data type used;
+ "bool" means a boolean value stored in an `int'. */
+#define IP_OPTIONS 1 /* ip_opts; IP per-packet options. */
+#define IP_HDRINCL 2 /* int; Header is included with data. */
+#define IP_TOS 3 /* int; IP type of service and precedence. */
+#define IP_TTL 4 /* int; IP time to live. */
+#define IP_RECVOPTS 5 /* bool; Receive all IP options w/datagram. */
+#define IP_RECVRETOPTS 6 /* bool; Receive IP options for response. */
+#define IP_RECVDSTADDR 7 /* int; Receive IP dst addr w/datagram. */
+#define IP_RETOPTS 8 /* ip_opts; Set/get IP per-packet options. */
+#define IP_RECVIF 9 /* int; Receive the inbound interface index. */
+#define IP_RECVSLLA 10 /* sockaddr_dl; Get source link layer address. */
+#define IP_RECVTTL 11 /* u_char; Get TTL for inbound packet. */
+#define IP_MULTICAST_IF 16 /* in_addr; set/get IP multicast i/f */
+#define IP_MULTICAST_TTL 17 /* u_char; set/get IP multicast ttl */
+#define IP_MULTICAST_LOOP 18 /* i_char; set/get IP multicast loopback */
+#define IP_ADD_MEMBERSHIP 19 /* ip_mreq; add an IP group membership */
+#define IP_DROP_MEMBERSHIP 20 /* ip_mreq; drop an IP group membership */
+#define IP_UNBLOCK_SOURCE 21 /* ip_mreq_source: unblock data from source */
+#define IP_BLOCK_SOURCE 22 /* ip_mreq_source: block data from source */
+#define IP_ADD_SOURCE_MEMBERSHIP 23 /* ip_mreq_source: join source group */
+#define IP_DROP_SOURCE_MEMBERSHIP 24 /* ip_mreq_source: leave source group */
+#define IP_NEXTHOP 25 /* send directly to next hop */
+#define IP_PKTINFO 26 /* specify src address and/or index */
+#define IP_RECVPKTINFO 26 /* recv dest/matched addr and index */
+#define IP_SEC_OPT 34 /* used to set IPSEC options */
+
+/* ipsec */
+#define IPSEC_PREF_NEVER 0x01
+#define IPSEC_PREF_REQUIRED 0x02
+#define IPSEC_PREF_UNIQUE 0x04
+
+typedef struct ipsec_req
+ {
+ unsigned int ipsr_ah_req; /* AH request */
+ unsigned int ipsr_esp_req; /* ESP request */
+ unsigned int ipsr_self_encap_req; /* Self-Encap request */
+ unsigned int ipsr_auth_alg; /* Auth algs for AH */
+ unsigned int ipsr_esp_alg; /* Encr algs for ESP */
+ unsigned int ipsr_esp_auth_alg; /* Auth algs for ESP */
+ }
+ipsec_req_t;
+
+#define MCAST_JOIN_GROUP 41 /* group_req: join any-source group */
+#define MCAST_LEAVE_GROUP 42 /* group_req: leave any-source group */
+#define MCAST_BLOCK_SOURCE 43 /* group_source_req: block from given group */
+#define MCAST_UNBLOCK_SOURCE 44 /* group_source_req: unblock from given group*/
+#define MCAST_JOIN_SOURCE_GROUP 45 /* group_source_req: join source-spec gr */
+#define MCAST_LEAVE_SOURCE_GROUP 46 /* group_source_req: leave source-spec gr*/
+
+#define MCAST_INCLUDE 1
+#define MCAST_EXCLUDE 2
+
+#define IP_BOUND_IF 65 /* bind socket to an ifindex */
+#define IP_UNSPEC_SRC 66 /* use unspecified source address */
+#define IP_BROADCAST_TTL 67 /* use specific TTL for broadcast */
+#define IP_DONTFAILOVER_IF 68 /* no failover */
+#define IP_DHCPINIT_IF 69 /* accept all unicast DHCP traffic */
+#define IP_REUSEADDR 260
+#define IP_DONTROUTE 261
+#define IP_BROADCAST 262
+
+#define IP_DEFAULT_MULTICAST_TTL 1
+#define IP_DEFAULT_MULTICAST_LOOP 1
+//#define IP_MAX_MEMBERSHIPS 20
+
+/* Structure used for IP_PKTINFO. */
+struct in_pktinfo
+ {
+ unsigned int ipi_ifindex; /* Interface index */
+ struct in_addr ipi_spec_dst; /* Routing destination address */
+ struct in_addr ipi_addr; /* Header destination address */
+ };
+
+/* Options for use with `getsockopt' and `setsockopt' at the IPv6 level.
+ The first word in the comment at the right is the data type used;
+ "bool" means a boolean value stored in an `int'. */
+#define IPV6_UNICAST_HOPS 5
+#define IPV6_MULTICAST_IF 6
+#define IPV6_MULTICAST_HOPS 7
+#define IPV6_MULTICAST_LOOP 8
+#define IPV6_JOIN_GROUP 9
+#define IPV6_LEAVE_GROUP 10
+#define IPV6_ADD_MEMBERSHIP IPV6_JOIN_GROUP
+#define IPV6_DROP_MEMBERSHIP IPV6_LEAVE_GROUP
+#define IPV6_PKTINFO 11
+#define IPV6_HOPLIMIT 12
+#define IPV6_NEXTHOP 13
+#define IPV6_HOPOPTS 14
+#define IPV6_DSTOPTS 15
+#define IPV6_RTHDR 16
+#define IPV6_RTHDRDSTOPTS 17
+#define IPV6_RECVPKTINFO 18
+#define IPV6_RECVHOPLIMIT 19
+#define IPV6_RECVHOPOPTS 20
+
+#define IPV6_RECVRTHDR 22
+#define IPV6_RECVRTHDRDSTOPTS 23
+#define IPV6_CHECKSUM 24
+#define IPV6_RECVTCLASS 25
+
+#define IPV6_USE_MIN_MTU 32
+#define IPV6_DONTFRAG 33
+#define IPV6_SEC_OPT 34
+#define IPV6_SRC_PREFERENCES 35
+#define IPV6_RECVPATHMTU 36
+#define IPV6_PATHMTU 37
+#define IPV6_TCLASS 38
+#define IPV6_V6ONLY 39
+#define IPV6_RECVDSTOPTS 40
+
+/* IPV6_SRC_PREFERENCES */
+#define IPV6_PREFER_SRC_HOME 0x01
+#define IPV6_PREFER_SRC_COA 0x02
+#define IPV6_PREFER_SRC_PUBLIC 0x04
+#define IPV6_PREFER_SRC_TMP 0x08
+#define IPV6_PREFER_SRC_NONCGA 0x10
+#define IPV6_PREFER_SRC_CGA 0x20
+#define IPV6_PREFER_SRC_MIPMASK (IPV6_PREFER_SRC_HOME | IPV6_PREFER_SRC_COA)
+#define IPV6_PREFER_SRC_MIPDEFAULT IPV6_PREFER_SRC_HOME
+#define IPV6_PREFER_SRC_TMPMASK (IPV6_PREFER_SRC_PUBLIC | IPV6_PREFER_SRC_TMP)
+#define IPV6_PREFER_SRC_TMPDEFAULT IPV6_PREFER_SRC_PUBLIC
+#define IPV6_PREFER_SRC_CGAMASK (IPV6_PREFER_SRC_NONCGA | IPV6_PREFER_SRC_CGA)
+#define IPV6_PREFER_SRC_CGADEFAULT IPV6_PREFER_SRC_NONCGA
+#define IPV6_PREFER_SRC_MASK (IPV6_PREFER_SRC_MIPMASK |\
+ IPV6_PREFER_SRC_TMPMASK | IPV6_PREFER_SRC_CGAMASK)
+#define IPV6_PREFER_SRC_DEFAULT (IPV6_PREFER_SRC_MIPDEFAULT |\
+ IPV6_PREFER_SRC_TMPDEFAULT | IPV6_PREFER_SRC_CGADEFAULT)
+
+#define IPV6_BOUND_IF 65
+#define IPV6_UNSPEC_SRC 66
+#define IPV6_BOUND_PIF 67
+#define IPV6_DONTFAILOVER_IF 68
+
+#define IPV6_RTHDR_TYPE_0 0
+
+#include <endian.h>
+
+#if __BYTE_ORDER == __BIG_ENDIAN
+# define IPV6_FLOWINFO_FLOWLABEL 0x000fffffU
+# define IPV6_FLOWINFO_TCLASS 0x0ff00000U
+#else
+# define IPV6_FLOWINFO_FLOWLABEL 0xffff0f00U
+# define IPV6_FLOWINFO_TCLASS 0x0000f00fU
+#endif
+
+typedef __uint32_t ipaddr_t;
+typedef struct in6_addr in6_addr_t;
+
+#define IN_CLASSE(i) IN_BADCLASS(i)
+#define IN_CLASSE_NET 0xffffffffU
+
+#define IN6_V4MAPPED_TO_INADDR(v6, v4) \
+ ((v4)->s_addr = (v6)->in6_u.u6_addr32[3])
+#define IN6_V4MAPPED_TO_IPADDR(v6, v4) \
+ ((v4) = (v6)->in6_u.u6_addr32[3])
+
+#ifdef __USE_MISC
+# define _S6_un in6_u
+# define _S6_u32 u6_addr32
+#endif
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/ioctl-types.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/ioctl-types.h
new file mode 100644
index 0000000000..dcd0375811
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/ioctl-types.h
@@ -0,0 +1,87 @@
+/* Structure types for pre-termios terminal ioctls. OpenSolaris version.
+ Copyright (C) 1996, 1997, 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _SYS_IOCTL_H
+# error "Never use <bits/ioctl-types.h> directly; include <sys/ioctl.h> instead."
+#endif
+
+/* Type of ARG for TIOCGETC and TIOCSETC requests. */
+struct tchars
+{
+ char t_intrc; /* Interrupt character. */
+ char t_quitc; /* Quit character. */
+ char t_startc; /* Start-output character. */
+ char t_stopc; /* Stop-output character. */
+ char t_eofc; /* End-of-file character. */
+ char t_brkc; /* Input delimiter character. */
+};
+
+/* Type of ARG for TIOCGLTC and TIOCSLTC requests. */
+struct ltchars
+{
+ char t_suspc; /* Suspend character. */
+ char t_dsuspc; /* Delayed suspend character. */
+ char t_rprntc; /* Reprint-line character. */
+ char t_flushc; /* Flush-output character. */
+ char t_werasc; /* Word-erase character. */
+ char t_lnextc; /* Literal-next character. */
+};
+
+/* Type of ARG for TIOCGETP and TIOCSETP requests (and gtty and stty). */
+struct sgttyb
+{
+ char sg_ispeed; /* Input speed. */
+ char sg_ospeed; /* Output speed. */
+ char sg_erase; /* Erase character. */
+ char sg_kill; /* Kill character. */
+ int sg_flags; /* Mode flags. */
+};
+
+/* Type of ARG for TIOCGWINSZ and TIOCSWINSZ requests. */
+struct winsize
+{
+ unsigned short int ws_row; /* Rows, in characters. */
+ unsigned short int ws_col; /* Columns, in characters. */
+
+ /* These are not actually used. */
+ unsigned short int ws_xpixel; /* Horizontal pixels. */
+ unsigned short int ws_ypixel; /* Vertical pixels. */
+};
+
+#define NCC 8
+#define _NCC NCC
+struct termio
+{
+ unsigned short int c_iflag;
+ unsigned short int c_oflag;
+ unsigned short int c_cflag;
+ unsigned short int c_lflag;
+ char c_line;
+ unsigned char c_cc[NCC];
+};
+
+struct termcb
+{
+ char st_flgs;
+ char st_termt;
+ char st_crow;
+ char st_ccol;
+ char st_vrow;
+ char st_lrow;
+};
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/ioctls.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/ioctls.h
new file mode 100644
index 0000000000..8995b59992
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/ioctls.h
@@ -0,0 +1,305 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _SYS_IOCTL_H
+# error "Never use <bits/ioctls.h> directly; include <sys/ioctl.h> instead."
+#endif
+
+#define IOCPARM_MASK 0xff
+#define IOC_VOID 0x20000000
+#define IOC_OUT 0x40000000
+#define IOC_IN 0x80000000
+#define IOC_INOUT (IOC_IN|IOC_OUT)
+
+#define _IOC(inout,group,num,len) \
+ (inout | ((len & IOCPARM_MASK) << 16) | ((group) << 8) | (num))
+#define _IO(g,n) _IOC(IOC_VOID, (g), (n), 0)
+#define _IOR(g,n,t) _IOC(IOC_OUT, (g), (n), sizeof(t))
+#define _IORN(g,n,t) _IOC(IOC_OUT, (g), (n), (t))
+#define _IOW(g,n,t) _IOC(IOC_IN, (g), (n), sizeof(t))
+#define _IOWN(g,n,t) _IOC(IOC_IN, (g), (n), (t))
+#define _IOWR(g,n,t) _IOC(IOC_INOUT, (g), (n), sizeof(t))
+#define _IOWRN(g,n,t) _IOC(IOC_INOUT, (g), (n), (t))
+
+
+#define SIOCSHIWAT _IOW('s', 0, int)
+#define SIOCGHIWAT _IOR('s', 1, int)
+#define SIOCSLOWAT _IOW('s', 2, int)
+#define SIOCGLOWAT _IOR('s', 3, int)
+#define SIOCATMARK _IOR('s', 7, int)
+#define SIOCSPGRP _IOW('s', 8, int)
+#define SIOCGPGRP _IOR('s', 9, int)
+
+#define SIOCGETNAME _IOR('s', 52, struct sockaddr)
+#define SIOCGETPEER _IOR('s', 53, struct sockaddr)
+#define IF_UNITSEL _IOW('s', 54, int)
+#define SIOCXPROTO _IO('s', 55)
+
+
+#define SIOCADDRT _IOWN('r', 10, 48)
+#define SIOCDELRT _IOWN('r', 11, 48)
+#define SIOCGETVIFCNT _IOWR('r', 20, struct sioc_vif_req)
+#define SIOCGETSGCNT _IOWR('r', 21, struct sioc_sg_req)
+#define SIOCGETLSGCNT _IOWR('r', 21, struct sioc_lsg_req)
+
+
+#define SIOCSIFADDR _IOW('i', 12, struct ifreq)
+#define SIOCGIFADDR _IOWR('i', 13, struct ifreq)
+#define SIOCSIFDSTADDR _IOW('i', 14, struct ifreq)
+#define SIOCGIFDSTADDR _IOWR('i', 15, struct ifreq)
+#define SIOCSIFFLAGS _IOW('i', 16, struct ifreq)
+#define SIOCGIFFLAGS _IOWR('i', 17, struct ifreq)
+#define SIOCSIFMEM _IOW('i', 18, struct ifreq)
+#define SIOCGIFMEM _IOWR('i', 19, struct ifreq)
+#define O_SIOCGIFCONF _IOWRN('i', 20, 8)
+#define SIOCSIFMTU _IOW('i', 21, struct ifreq)
+#define SIOCGIFMTU _IOWR('i', 22, struct ifreq)
+#define SIOCGIFBRDADDR _IOWR('i', 23, struct ifreq)
+#define SIOCSIFBRDADDR _IOW('i', 24, struct ifreq)
+#define SIOCGIFNETMASK _IOWR('i', 25, struct ifreq)
+#define SIOCSIFNETMASK _IOW('i', 26, struct ifreq)
+#define SIOCGIFMETRIC _IOWR('i', 27, struct ifreq)
+#define SIOCSIFMETRIC _IOW('i', 28, struct ifreq)
+
+#define SIOCSARP _IOW('i', 30, struct arpreq)
+#define SIOCGARP _IOWR('i', 31, struct arpreq)
+#define SIOCDARP _IOW('i', 32, struct arpreq)
+#define SIOCUPPER _IOW('i', 40, struct ifreq)
+#define SIOCLOWER _IOW('i', 41, struct ifreq)
+#define SIOCSETSYNC _IOW('i', 44, struct ifreq)
+#define SIOCGETSYNC _IOWR('i', 45, struct ifreq)
+#define SIOCSSDSTATS _IOWR('i', 46, struct ifreq)
+#define SIOCSSESTATS _IOWR('i', 47, struct ifreq)
+#define SIOCSPROMISC _IOW('i', 48, int)
+#define SIOCADDMULTI _IOW('i', 49, struct ifreq)
+#define SIOCDELMULTI _IOW('i', 50, struct ifreq)
+
+
+#define SIOCIFDETACH _IOW('i', 56, struct ifreq)
+#define SIOCGENPSTATS _IOWR('i', 57, struct ifreq)
+
+#define SIOCX25XMT _IOWR('i', 59, struct ifreq)
+#define SIOCX25RCV _IOWR('i', 60, struct ifreq)
+#define SIOCX25TBL _IOWR('i', 61, struct ifreq)
+
+#define SIOCSLGETREQ _IOWR('i', 71, struct ifreq)
+#define SIOCSLSTAT _IOW('i', 72, struct ifreq)
+#define SIOCSIFNAME _IOW('i', 73, struct ifreq)
+
+#define SIOCGENADDR _IOWR('i', 85, struct ifreq)
+
+#define SIOCGIFNUM _IOR('i', 87, int)
+#define SIOCGIFMUXID _IOWR('i', 88, struct ifreq)
+#define SIOCSIFMUXID _IOW('i', 89, struct ifreq)
+#define SIOCGIFINDEX _IOWR('i', 90, struct ifreq)
+#define SIOCSIFINDEX _IOW('i', 91, struct ifreq)
+#define SIOCGIFCONF _IOWRN('i', 92, 8)
+
+#define SIOCLIFREMOVEIF _IOW('i', 110, struct lifreq)
+#define SIOCLIFADDIF _IOWR('i', 111, struct lifreq)
+#define SIOCSLIFADDR _IOW('i', 112, struct lifreq)
+#define SIOCGLIFADDR _IOWR('i', 113, struct lifreq)
+#define SIOCSLIFDSTADDR _IOW('i', 114, struct lifreq)
+#define SIOCGLIFDSTADDR _IOWR('i', 115, struct lifreq)
+#define SIOCSLIFFLAGS _IOW('i', 116, struct lifreq)
+#define SIOCGLIFFLAGS _IOWR('i', 117, struct lifreq)
+
+#define O_SIOCGLIFCONF _IOWRN('i', 120, 16)
+#define SIOCSLIFMTU _IOW('i', 121, struct lifreq)
+#define SIOCGLIFMTU _IOWR('i', 122, struct lifreq)
+#define SIOCGLIFBRDADDR _IOWR('i', 123, struct lifreq)
+#define SIOCSLIFBRDADDR _IOW('i', 124, struct lifreq)
+#define SIOCGLIFNETMASK _IOWR('i', 125, struct lifreq)
+#define SIOCSLIFNETMASK _IOW('i', 126, struct lifreq)
+#define SIOCGLIFMETRIC _IOWR('i', 127, struct lifreq)
+#define SIOCSLIFMETRIC _IOW('i', 128, struct lifreq)
+#define SIOCSLIFNAME _IOWR('i', 129, struct lifreq)
+#define SIOCGLIFNUM _IOWR('i', 130, struct lifnum)
+#define SIOCGLIFMUXID _IOWR('i', 131, struct lifreq)
+#define SIOCSLIFMUXID _IOW('i', 132, struct lifreq)
+#define SIOCGLIFINDEX _IOWR('i', 133, struct lifreq)
+#define SIOCSLIFINDEX _IOW('i', 134, struct lifreq)
+#define SIOCSLIFTOKEN _IOW('i', 135, struct lifreq)
+#define SIOCGLIFTOKEN _IOWR('i', 136, struct lifreq)
+#define SIOCSLIFSUBNET _IOW('i', 137, struct lifreq)
+#define SIOCGLIFSUBNET _IOWR('i', 138, struct lifreq)
+#define SIOCSLIFLNKINFO _IOW('i', 139, struct lifreq)
+#define SIOCGLIFLNKINFO _IOWR('i', 140, struct lifreq)
+#define SIOCLIFDELND _IOW('i', 141, struct lifreq)
+#define SIOCLIFGETND _IOWR('i', 142, struct lifreq)
+#define SIOCLIFSETND _IOW('i', 143, struct lifreq)
+#define SIOCTMYADDR _IOWR('i', 144, struct sioc_addrreq)
+#define SIOCTONLINK _IOWR('i', 145, struct sioc_addrreq)
+#define SIOCTMYSITE _IOWR('i', 146, struct sioc_addrreq)
+#define SIOCGTUNPARAM _IOR('i', 147, struct iftun_req)
+#define SIOCSTUNPARAM _IOW('i', 148, struct iftun_req)
+#define SIOCFIPSECONFIG _IOW('i', 149, 0)
+#define SIOCSIPSECONFIG _IOW('i', 150, 0)
+#define SIOCDIPSECONFIG _IOW('i', 151, 0)
+#define SIOCLIPSECONFIG _IOW('i', 152, 0)
+#define SIOCLIFFAILOVER _IOW('i', 153, struct lifreq)
+#define SIOCLIFFAILBACK _IOW('i', 154, struct lifreq)
+#define SIOCSLIFGROUPNAME _IOW('i', 155, struct lifreq)
+#define SIOCGLIFGROUPNAME _IOWR('i', 156, struct lifreq)
+#define SIOCGLIFOINDEX _IOWR('i', 157, struct lifreq)
+#define SIOCSLIFOINDEX _IOWR('i', 161, struct lifreq)
+#define SIOCGIP6ADDRPOLICY _IOWRN('i', 162, 0)
+#define SIOCSIP6ADDRPOLICY _IOWN('i', 163, 0)
+#define SIOCGDSTINFO _IOWRN('i', 164, 0)
+#define SIOCGLIFCONF _IOWRN('i', 165, 16)
+#define SIOCSXARP _IOW('i', 166, struct xarpreq)
+#define SIOCGXARP _IOWR('i', 167, struct xarpreq)
+#define SIOCDXARP _IOW('i', 168, struct xarpreq)
+#define _SIOCSOCKFALLBACK _IOW('i', 169, 0)
+#define SIOCGLIFZONE _IOWR('i', 170, struct lifreq)
+#define SIOCSLIFZONE _IOW('i', 171, struct lifreq)
+#define SIOCSCTPSOPT _IOWN('i', 172, 16)
+#define SIOCSCTPGOPT _IOWRN('i', 173, 16)
+#define SIOCSCTPPEELOFF _IOWR('i', 174, int)
+#define SIOCGLIFUSESRC _IOWR('i', 175, struct lifreq)
+#define SIOCSLIFUSESRC _IOW('i', 176, struct lifreq)
+#define SIOCGLIFSRCOF _IOWRN('i', 177, 16)
+#define SIOCGMSFILTER _IOWR('i', 178, 0)
+#define SIOCSMSFILTER _IOW('i', 179, 0)
+#define SIOCGIPMSFILTER _IOWR('i', 180, 0)
+#define SIOCSIPMSFILTER _IOW('i', 181, 0)
+#define SIOCSIPMPFAILBACK _IOW('i', 182, int)
+#define SIOCSENABLESDP _IOWR('i', 183, int)
+
+
+#define FIOCLEX _IO('f', 1)
+#define FIONCLEX _IO('f', 2)
+
+#define _FIOISBUSY _IO('f', 75)
+#define _FIODIRECTIO _IO('f', 76)
+#define _FIOTUNE _IO('f', 77)
+
+#define _FIOLOGENABLE _IO('f', 87)
+#define _FIOLOGDISABLE _IO('f', 88)
+#define _FIOSNAPSHOTCREATE _IO('f', 89)
+#define _FIOSNAPSHOTDELETE _IO('f', 90)
+#define _FIOGETSUPERBLOCK _IO('f', 91)
+#define _FIOGETMAXPHYS _IO('f', 92)
+#define _FIO_SET_LUFS_DEBUG _IO('f', 93)
+#define _FIO_SET_LUFS_ERROR _IO('f', 94)
+#define _FIO_GET_TOP_STATS _IO('f', 95)
+#define _FIOSNAPSHOTCREATE_MULTI _IO('f', 96)
+#define _FIO_SEEK_DATA _IO('f', 97)
+#define _FIO_SEEK_HOLE _IO('f', 98)
+#define _FIO_COMPRESSED _IO('f', 99)
+
+#define FIONREAD _IOR('f', 127, int)
+#define FIONBIO _IOW('f', 126, int)
+#define FIOASYNC _IOW('f', 125, int)
+#define FIOSETOWN _IOW('f', 124, int)
+#define FIOGETOWN _IOR('f', 123, int)
+
+
+#ifndef IOCTYPE
+#define IOCTYPE 0xff00
+#endif
+
+
+#ifndef _TIOC
+# define _TIOC ('T'<<8)
+# define TIOC _TIOC
+#endif
+
+#define TCGETA (_TIOC|1)
+#define TCSETA (_TIOC|2)
+#define TCSETAW (_TIOC|3)
+#define TCSETAF (_TIOC|4)
+#define TCSBRK (_TIOC|5)
+#define TCXONC (_TIOC|6)
+#define TCFLSH (_TIOC|7)
+#define TIOCKBON (_TIOC|8)
+#define TIOCKBOF (_TIOC|9)
+#define KBENABLED (_TIOC|10)
+
+#define TCGETS (_TIOC|13)
+#define TCSETS (_TIOC|14)
+#define TCSETSW (_TIOC|15)
+#define TCSETSF (_TIOC|16)
+
+#define TCDSET (_TIOC|32)
+#define RTS_TOG (_TIOC|33)
+
+#define TIOCSWINSZ (_TIOC|103)
+#define TIOCGWINSZ (_TIOC|104)
+#define TIOCGSOFTCAR (_TIOC|105)
+#define TIOCSSOFTCAR (_TIOC|106)
+
+#define TIOCSETLD (_TIOC|123)
+#define TIOCGETLD (_TIOC|124)
+
+
+#define tIOC ('t'<<8)
+
+#define TIOCGETD (tIOC|0)
+#define TIOCSETD (tIOC|1)
+#define TIOCHPCL (tIOC|2)
+#define TIOCGETP (tIOC|8)
+#define TIOCSETP (tIOC|9)
+#define TIOCSETN (tIOC|10)
+#define TIOCEXCL (tIOC|13)
+#define TIOCNXCL (tIOC|14)
+#define TIOCFLUSH (tIOC|16)
+#define TIOCSETC (tIOC|17)
+#define TIOCGETC (tIOC|18)
+
+#define TIOCGPGRP (tIOC|20)
+#define TIOCSPGRP (tIOC|21)
+#define TIOCGSID (tIOC|22)
+#define TIOCSTI (tIOC|23)
+
+#define TIOCMSET (tIOC|26)
+#define TIOCMBIS (tIOC|27)
+#define TIOCMBIC (tIOC|28)
+#define TIOCMGET (tIOC|29)
+#define TIOCREMOTE (tIOC|30)
+#define TIOCSIGNAL (tIOC|31)
+
+#define TIOCLBIS (tIOC|127)
+#define TIOCLBIC (tIOC|126)
+#define TIOCLSET (tIOC|125)
+#define TIOCLGET (tIOC|124)
+#define TIOCSBRK (tIOC|123)
+#define TIOCCBRK (tIOC|122)
+#define TIOCSDTR (tIOC|121)
+#define TIOCCDTR (tIOC|120)
+#define TIOCSLTC (tIOC|117)
+#define TIOCGLTC (tIOC|116)
+#define TIOCOUTQ (tIOC|115)
+#define TIOCNOTTY (tIOC|113)
+#define TIOCSCTTY (tIOC|132)
+#define TIOCSTOP (tIOC|111)
+#define TIOCSTART (tIOC|110)
+#define TIOCSILOOP (tIOC|109)
+
+
+#define TIOCM_LE 0001
+#define TIOCM_DTR 0002
+#define TIOCM_RTS 0004
+#define TIOCM_ST 0010
+#define TIOCM_SR 0020
+#define TIOCM_CTS 0040
+#define TIOCM_CAR 0100
+#define TIOCM_CD TIOCM_CAR
+#define TIOCM_RNG 0200
+#define TIOCM_RI TIOCM_RNG
+#define TIOCM_DSR 0400
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/ipc.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/ipc.h
new file mode 100644
index 0000000000..bf887832e2
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/ipc.h
@@ -0,0 +1,54 @@
+/* Copyright (C) 1995, 1996, 1997, 1999, 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _SYS_IPC_H
+# error "Never use <bits/ipc.h> directly; include <sys/ipc.h> instead."
+#endif
+
+#include <bits/types.h>
+#include <bits/wordsize.h>
+
+/* Mode bits for `msgget', `semget', and `shmget'. */
+#define IPC_ALLOC 0100000 /* entry currently allocated */
+#define IPC_CREAT 0001000 /* create key if key does not exist */
+#define IPC_EXCL 0002000 /* fail if key exists */
+#define IPC_NOWAIT 0004000 /* return error on wait */
+
+/* Control commands for `msgctl', `semctl', and `shmctl'. */
+#define IPC_RMID 10 /* remove identifier */
+#define IPC_SET 11 /* set `ipc_perm' options */
+#define IPC_STAT 12 /* get `ipc_perm' options */
+
+/* Special key values. */
+#define IPC_PRIVATE ((key_t) 0) /* private key */
+
+
+/* Data structure used to pass permission information to IPC operations. */
+struct ipc_perm
+ {
+ __uid_t uid; /* owner's user ID */
+ __gid_t gid; /* owner's group ID */
+ __uid_t cuid; /* creator's user ID */
+ __gid_t cgid; /* creator's group ID */
+ __mode_t mode; /* read/write permission */
+ unsigned int seq; /* slot usage sequence number */
+ __key_t key; /* key */
+#if __WORDSIZE == 32
+ int pad[4];
+#endif
+ };
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/local_lim.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/local_lim.h
new file mode 100644
index 0000000000..1e93857189
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/local_lim.h
@@ -0,0 +1,99 @@
+/* Minimum guaranteed maximum values for system limits. OpenSolaris version.
+ Copyright (C) 1993-1998,2000,2002,2003,2004,2008
+ Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+/* XXX: OpenSolaris doesn't define this but we do for compatibility. */
+#define NAME_MAX 255
+
+/* The number of data keys per process. */
+#define _POSIX_THREAD_KEYS_MAX 128
+/* This is the value this implementation supports. */
+#define PTHREAD_KEYS_MAX 1024
+
+/* Controlling the iterations of destructors for thread-specific data. */
+#define _POSIX_THREAD_DESTRUCTOR_ITERATIONS 4
+
+/* Number of iterations this implementation does. */
+#define PTHREAD_DESTRUCTOR_ITERATIONS _POSIX_THREAD_DESTRUCTOR_ITERATIONS
+
+/* The number of threads per process. */
+#define _POSIX_THREAD_THREADS_MAX 64
+
+/* Maximum amount by which a process can descrease its asynchronous I/O
+ priority level. */
+#define AIO_PRIO_DELTA_MAX 20
+
+/* Minimum size for a thread. We are free to choose a reasonable value. */
+#define PTHREAD_STACK_MIN 16384
+
+/* Maximum number of POSIX timers available. */
+#define TIMER_MAX 256
+
+/* Maximum number of timer expiration overruns. */
+#define DELAYTIMER_MAX 2147483647
+
+/* Maximum tty name length. */
+#define TTY_NAME_MAX 128
+#define TTYNAME_MAX TTY_NAME_MAX
+
+/* Maximum login name length. This is arbitrary. */
+#define LOGIN_NAME_MAX 256
+
+/* Maximum host name length. */
+#define HOST_NAME_MAX 64
+
+/* Maximum message queue priority level. */
+#define MQ_PRIO_MAX 32768
+
+/* Maximum number of characters in a path name. */
+#define PATH_MAX 1024
+
+/* Maximum number of files a process can have open. */
+#define OPEN_MAX 256
+
+#define NGROUPS_MAX 16
+
+/* XXX: The 64-bit case is larger but this should be enough for all. */
+#define ARG_MAX 1048320
+
+#define CHILD_MAX 25
+
+#define OPEN_MAX 256
+
+#define SYMLINK_MAX 1024
+
+#define MAX_CANON 256
+
+#define PATH_MAX 1024
+
+#define MAX_INPUT 512
+
+#define PIPE_BUF 5120
+
+#define PASS_MAX 256
+
+#define UID_MAX 2147483647
+
+#define LOGNAME_MAX 8
+
+/* Maximum message queue priority level. */
+#define MQ_PRIO_MAX 32768
+
+/* Maximum value the semaphore can have. */
+#define SEM_VALUE_MAX 2147483647
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/mman.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/mman.h
new file mode 100644
index 0000000000..529aa4f18e
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/mman.h
@@ -0,0 +1,186 @@
+/* Definitions for POSIX memory map interface. OpenSolaris version.
+ Copyright (C) 1997, 2000, 2003, 2005, 2006, 2008
+ Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _SYS_MMAN_H
+# error "Never use <bits/mman.h> directly; include <sys/mman.h> instead."
+#endif
+
+
+/* Protections are chosen from these bits, OR'd together. The
+ implementation does not necessarily support PROT_EXEC or PROT_WRITE
+ without PROT_READ. The only guarantees are that no writing will be
+ allowed without PROT_WRITE and no access will be allowed for PROT_NONE. */
+
+#define PROT_READ 0x1 /* Page can be read. */
+#define PROT_WRITE 0x2 /* Page can be written. */
+#define PROT_EXEC 0x4 /* Page can be executed. */
+#define PROT_NONE 0x0 /* Page can not be accessed. */
+
+/* Sharing types (must choose one and only one of these). */
+#define MAP_SHARED 0x01 /* Share changes. */
+#define MAP_PRIVATE 0x02 /* Changes are private. */
+#ifdef __USE_MISC
+# define MAP_TYPE 0x0f /* Mask for type of mapping. */
+#endif
+
+/* Other flags. */
+#define MAP_FIXED 0x10 /* Interpret addr exactly. */
+#ifdef __USE_MISC
+# define MAP_FILE 0
+# define MAP_ANONYMOUS 0x100 /* Don't use a file. */
+# define MAP_ANON MAP_ANONYMOUS
+#endif
+
+/* These are OpenSolaris-specific. */
+#ifdef __USE_MISC
+# define MAP_NORESERVE 0x40 /* Don't check for reservations. */
+# define MAP_ALIGN 0x200 /* Address specifies alignment. */
+# define MAP_TEXT 0x200 /* Map code segment. */
+# define MAP_INITDATA 0x800 /* Map data segment. */
+# define MAP_RENAME 0x20 /* Rename private pages to file. */
+# define _MAP_NEW 0x80000000 /* Never use this. */
+#endif
+
+/* Flags to `msync'. */
+#define MS_ASYNC 1 /* Sync memory asynchronously. */
+#define MS_SYNC 4 /* Synchronous memory sync. */
+#define MS_INVALIDATE 2 /* Invalidate the caches. */
+
+/* These are OpenSolaris-specific. */
+#ifdef __USE_MISC
+
+/* mctl functions */
+# define MC_SYNC 1
+# define MC_LOCK 2
+# define MC_UNLOCK 3
+# define MC_ADVISE 4
+# define MC_LOCKAS 5
+# define MC_UNLOCKAS 6
+# define MC_HAT_ADVISE 7
+
+/* MC_HAT_ADVISE arg */
+# define MHA_MAPSIZE_VA 0x1
+# define MHA_MAPSIZE_BSSBRK 0x2
+# define MHA_MAPSIZE_STACK 0x3
+
+# include <sys/types.h>
+
+# define MISYS_MEMINFO 0x0
+
+typedef struct meminfo
+ {
+ const uint64_t *mi_inaddr;
+ const unsigned int *mi_info_req;
+ uint64_t *mi_outdata;
+ unsigned int *mi_validity;
+ int mi_info_count;
+ } meminfo_t;
+
+/* info_req field */
+# define MEMINFO_SHIFT 16
+# define MEMINFO_MASK (0xFF << MEMINFO_SHIFT)
+# define MEMINFO_VPHYSICAL (0x01 << MEMINFO_SHIFT)
+# define MEMINFO_VLGRP (0x02 << MEMINFO_SHIFT)
+# define MEMINFO_VPAGESIZE (0x03 << MEMINFO_SHIFT)
+# define MEMINFO_VREPLCNT (0x04 << MEMINFO_SHIFT)
+# define MEMINFO_VREPL (0x05 << MEMINFO_SHIFT)
+# define MEMINFO_VREPL_LGRP (0x06 << MEMINFO_SHIFT)
+# define MEMINFO_PLGRP (0x07 << MEMINFO_SHIFT)
+
+/* max address count for meminfo */
+# define MAX_MEMINFO_CNT 256
+
+/* max request types */
+# define MAX_MEMINFO_REQ 31
+
+#endif /* __USE_MISC */
+
+/* Flags for `mlockall'. */
+#define MCL_CURRENT 1 /* Lock all currently mapped pages. */
+#define MCL_FUTURE 2 /* Lock all additions to address
+ space. */
+
+/* Flags for `mremap'. */
+#ifdef __USE_GNU
+# define MREMAP_MAYMOVE 1
+# define MREMAP_FIXED 2
+#endif
+
+/* Advice to `madvise'. */
+#ifdef __USE_MISC
+# define MADV_NORMAL 0 /* No further special treatment. */
+# define MADV_RANDOM 1 /* Expect random page references. */
+# define MADV_SEQUENTIAL 2 /* Expect sequential page references. */
+# define MADV_WILLNEED 3 /* Will need these pages. */
+# define MADV_DONTNEED 4 /* Don't need these pages. */
+# define MADV_REMOVE 9 /* Remove these pages and resources. */
+# define MADV_DONTFORK 10 /* Do not inherit across fork. */
+# define MADV_DOFORK 11 /* Do inherit across fork. */
+#endif
+
+/* These are OpenSolaris-specific. */
+#ifdef __USE_MISC
+# define MADV_FREE 5
+# define MADV_ACCESS_DEFAULT 6
+# define MADV_ACCESS_LWP 7
+# define MADV_ACCESS_MANY 8
+#endif
+
+/* The POSIX people had to invent similar names for the same things. */
+#ifdef __USE_XOPEN2K
+# define POSIX_MADV_NORMAL 0 /* No further special treatment. */
+# define POSIX_MADV_RANDOM 1 /* Expect random page references. */
+# define POSIX_MADV_SEQUENTIAL 2 /* Expect sequential page references. */
+# define POSIX_MADV_WILLNEED 3 /* Will need these pages. */
+# define POSIX_MADV_DONTNEED 4 /* Don't need these pages. */
+#endif
+
+#ifdef __USE_MISC
+# define PROC_TEXT (PROT_EXEC | PROT_READ)
+# define PROC_DATA (PROT_READ | PROT_WRITE | PROT_EXEC)
+/* GNU lbc (and probably others) use SHARED internally. */
+# ifndef _GNU_SOURCE
+# define SHARED 0x10
+# define PRIVATE 0x20
+# endif
+# define VALID_ATTR (PROT_READ | PROT_WRITE | PROT_EXEC | SHARED | PRIVATE)
+#endif
+
+struct memcntl_mha
+ {
+ unsigned int mha_cmd;
+ unsigned int mha_flags;
+ size_t mha_pagesize;
+ };
+
+__BEGIN_DECLS
+
+#if defined __USE_MISC
+extern int getpagesizes (size_t *__pagesize, int __nelem);
+extern int getpagesizes2 (size_t *__pagesize, int __nelem);
+extern int meminfo (const uint64_t *__inaddr, int,
+ const unsigned int *__addr_count, int __info_req, uint64_t *__info_count,
+ unsigned int *__outdata);
+extern int memcntl (__caddr_t addr, size_t len, int cmd, __caddr_t arg,
+ int attr, int mask);
+
+#endif
+
+__END_DECLS
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/msq.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/msq.h
new file mode 100644
index 0000000000..bff8102f84
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/msq.h
@@ -0,0 +1,68 @@
+/* Copyright (C) 1995, 1997, 2000, 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _SYS_MSG_H
+#error "Never use <bits/msq.h> directly; include <sys/msg.h> instead."
+#endif
+
+#include <bits/types.h>
+#include <bits/wordsize.h>
+
+#define MSG_R 0400
+#define MSG_W 0200
+
+#define MSG_RWAIT 01000
+#define MSG_WWAIT 02000
+
+/* Define options for message queue functions. */
+#define MSG_NOERROR 010000 /* no error if message is too big */
+
+/* Types used in the structure definition. */
+typedef unsigned long msgqnum_t;
+typedef unsigned long msglen_t;
+
+struct msg;
+
+/* Structure of record for one message inside the kernel.
+ The type `struct __msg' is opaque. */
+struct msqid_ds
+{
+ struct ipc_perm msg_perm; /* structure describing operation permission */
+ struct msg *msg_first; /* pointer to first message on q */
+ struct msg *msg_last; /* pointer to last message on q */
+ msglen_t msg_cbytes; /* current # bytes on q */
+ msgqnum_t msg_qnum; /* number of messages currently on queue */
+ msglen_t msg_qbytes; /* max number of bytes allowed on queue */
+ __pid_t msg_lspid; /* pid of last msgsnd() */
+ __pid_t msg_lrpid; /* pid of last msgrcv() */
+ __time_t msg_stime; /* time of last msgsnd command */
+#if __WORDSIZE == 32
+ int32_t msg_pad1;
+#endif
+ __time_t msg_rtime; /* time of last msgrcv command */
+#if __WORDSIZE == 32
+ int32_t msg_pad2;
+#endif
+ __time_t msg_ctime; /* time of last change */
+#if __WORDSIZE == 32
+ int32_t msg_pad3;
+#endif
+ short msg_cv;
+ short msg_qnum_cv;
+ long msg_pad4[3];
+};
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/netdb.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/netdb.h
new file mode 100644
index 0000000000..de9e90f999
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/netdb.h
@@ -0,0 +1,61 @@
+/* Copyright (C) 1996, 1997, 1998, 1999, 2000, 2008
+ Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _NETDB_H
+# error "Never include <bits/netdb.h> directly; use <netdb.h> instead."
+#endif
+
+
+/* Description of data base entry for a single network. NOTE: here a
+ poor assumption is made. The network number is expected to fit
+ into an unsigned long int variable. */
+struct netent
+{
+ char *n_name; /* Official name of network. */
+ char **n_aliases; /* Alias list. */
+ int n_addrtype; /* Net address type. */
+ uint32_t n_net; /* Network number. */
+};
+
+#define MAXALIASES 35
+#define MAXADDRS 35
+
+#ifdef __USE_MISC
+
+typedef struct ipsecalgent
+{
+ char **a_names;
+ int a_proto_num;
+ int a_alg_num;
+ char *a_mech_name;
+ int *a_block_sizes;
+ int *a_key_sizes;
+ int a_key_increment;
+} ipsecalgent_t;
+
+#define IPSEC_PROTO_AH 2
+#define IPSEC_PROTO_ESP 3
+
+#define MAXHOSTNAMELEN 256
+
+#ifdef __USE_MISC
+# define AI_DEFAULT (AI_V4MAPPED | AI_ADDRCONFIG)
+#endif
+
+#endif /* __USE_MISC */
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/poll.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/poll.h
new file mode 100644
index 0000000000..a83b1653d1
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/poll.h
@@ -0,0 +1,43 @@
+/* Copyright (C) 1997, 2001, 2006, 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _SYS_POLL_H
+# error "Never use <bits/poll.h> directly; include <sys/poll.h> instead."
+#endif
+
+/* Event types that can be polled for. These bits may be set in `events'
+ to indicate the interesting event types; they will appear in `revents'
+ to indicate the status of the file descriptor. */
+#define POLLIN 0x001 /* There is data to read. */
+#define POLLPRI 0x002 /* There is urgent data to read. */
+#define POLLOUT 0x004 /* Writing now will not block. */
+#define POLLRDNORM 0x040 /* Normal data may be read. */
+#define POLLRDBAND 0x080 /* Priority data may be read. */
+#define POLLWRNORM POLLOUT /* Writing now will not block. */
+#define POLLWRBAND 0x100 /* Priority data may be written. */
+#define POLLNORM POLLRDNORM
+#define POLLREMOVE 0x800
+
+/* Event types always implicitly polled for. These bits need not be set in
+ `events', but they will appear in `revents' to indicate the status of
+ the file descriptor. */
+#define POLLERR 0x008 /* Error condition. */
+#define POLLHUP 0x010 /* Hung up. */
+#define POLLNVAL 0x020 /* Invalid polling request. */
+
+typedef struct pollfd pollfd_t;
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/posix_opt.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/posix_opt.h
new file mode 100644
index 0000000000..c28d50306c
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/posix_opt.h
@@ -0,0 +1,82 @@
+/* Define POSIX options for OpenSolaris.
+ Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#ifndef _POSIX_OPT_H
+#define _POSIX_OPT_H
+
+#define _POSIX_ASYNCHRONOUS_IO 200112L
+#define _POSIX_FSYNC 200112L
+#define _POSIX_MAPPED_FILES 200112L
+#define _POSIX_MEMLOCK 200112L
+#define _POSIX_MEMLOCK_RANGE 200112L
+#define _POSIX_MEMORY_PROTECTION 200112L
+#define _POSIX_MESSAGE_PASSING 200112L
+#define _POSIX_PRIORITY_SCHEDULING 200112L
+#define _POSIX_REALTIME_SIGNALS 200112L
+#define _POSIX_SEMAPHORES 200112L
+#define _POSIX_SHARED_MEMORY_OBJECTS 200112L
+#define _POSIX_SYNCHRONIZED_IO 200112L
+
+#define _POSIX_THREAD_SAFE_FUNCTIONS 200112L
+#define _POSIX_THREADS 200112L
+#define _POSIX_THREAD_ATTR_STACKADDR 200112L
+#define _POSIX_THREAD_ATTR_STACKSIZE 200112L
+#define _POSIX_THREAD_PROCESS_SHARED 200112L
+#define _POSIX_THREAD_PRIORITY_SCHEDULING 200112L
+#define _POSIX_TIMERS 200112L
+
+#define _POSIX_BARRIERS 200112L
+#define _POSIX_CLOCK_SELECTION 200112L
+#define _POSIX_IPV6 200112L
+#define _POSIX_MONOTONIC_CLOCK 200112L
+#define _POSIX_RAW_SOCKETS 200112L
+#define _POSIX_READER_WRITER_LOCKS 200112L
+#define _POSIX_SPAWN 200112L
+#define _POSIX_SPIN_LOCKS 200112L
+#define _POSIX_TIMEOUTS 200112L
+#define _POSIX2_CHAR_TERM 200112L
+
+#define _POSIX_THREAD_PRIO_INHERIT 200112L
+#define _POSIX_THREAD_PRIO_PROTECT 200112L
+
+#define _LFS_LARGEFILE 1
+#define _LFS64_LARGEFILE 1
+#define _LFS64_STDIO 11
+#define _LFS64_ASYNCHRONOUS_IO 1
+
+#define _POSIX_REGEXP 1
+#define _POSIX_SAVED_IDS 1
+#define _POSIX_SHELL 1
+#define _POSIX_JOB_CONTROL 1
+
+#define _POSIX_CPUTIME -1
+#define _POSIX_ADVISORY_INFO -1
+#define _POSIX_PRIORITIZED_IO -1
+#define _POSIX_SPORADIC_SERVER -1
+#define _POSIX_THREAD_CPUTIME -1
+#define _POSIX_THREAD_SPORADIC_SERVER -1
+#define _POSIX_TRACE -1
+#define _POSIX_TRACE_EVENT_FILTER -1
+#define _POSIX_TRACE_INHERIT -1
+#define _POSIX_TRACE_LOG -1
+#define _POSIX_TYPED_MEMORY_OBJECTS -1
+
+#define _POSIX_VDISABLE '\0'
+
+#endif /* _BITS_POSIX_OPT_H */
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/resource.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/resource.h
new file mode 100644
index 0000000000..6507772c1a
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/resource.h
@@ -0,0 +1,240 @@
+/* Bit values & structures for resource limits. OpenSolaris version.
+ Copyright (C) 1994, 1996, 1997, 1998, 1999, 2000, 2004, 2005, 2008
+ Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _SYS_RESOURCE_H
+# error "Never use <bits/resource.h> directly; include <sys/resource.h> instead."
+#endif
+
+#include <bits/types.h>
+
+/* Transmute defines to enumerations. The macro re-definitions are
+ necessary because some programs want to test for operating system
+ features with #ifdef RUSAGE_SELF. In ISO C the reflexive
+ definition is a no-op. */
+
+/* Kinds of resource limit. */
+enum __rlimit_resource
+{
+ /* Per-process CPU limit, in seconds. */
+ RLIMIT_CPU = 0,
+#define RLIMIT_CPU RLIMIT_CPU
+
+ /* Largest file that can be created, in bytes. */
+ RLIMIT_FSIZE = 1,
+#define RLIMIT_FSIZE RLIMIT_FSIZE
+
+ /* Maximum size of data segment, in bytes. */
+ RLIMIT_DATA = 2,
+#define RLIMIT_DATA RLIMIT_DATA
+
+ /* Maximum size of stack segment, in bytes. */
+ RLIMIT_STACK = 3,
+#define RLIMIT_STACK RLIMIT_STACK
+
+ /* Largest core file that can be created, in bytes. */
+ RLIMIT_CORE = 4,
+#define RLIMIT_CORE RLIMIT_CORE
+
+ /* Number of open files. */
+ RLIMIT_NOFILE = 5,
+#define RLIMIT_NOFILE RLIMIT_NOFILE
+
+ /* Maximum mapped memory. */
+ RLIMIT_AS = 6,
+#define RLIMIT_AS RLIMIT_AS
+#define RLIMIT_VMEM RLIMIT_AS
+
+ __RLIMIT_NLIMITS = 7,
+ __RLIM_NLIMITS = __RLIMIT_NLIMITS
+#define RLIMIT_NLIMITS __RLIMIT_NLIMITS
+#define RLIM_NLIMITS __RLIM_NLIMITS
+};
+
+/* Type for resource quantity measurement. */
+#ifndef __USE_FILE_OFFSET64
+typedef __rlim_t rlim_t;
+#else
+typedef __rlim64_t rlim_t;
+#endif
+#ifdef _SYSCALL32
+typedef __uint32_t rlim32_t;
+#endif
+#ifdef __USE_LARGEFILE64
+typedef __rlim64_t rlim64_t;
+#endif
+
+/* Value to indicate that there is no limit. */
+#ifdef __USE_LARGEFILE64
+# define RLIM64_INFINITY ((rlim64_t)-3)
+# define RLIM64_SAVED_MAX ((rlim64_t)-2)
+# define RLIM64_SAVED_CUR ((rlim64_t)-1)
+#endif
+#if __WORDSIZE == 64
+# define RLIM_INFINITY ((rlim_t)-3l)
+# define RLIM_SAVED_MAX ((rlim_t)-2l)
+# define RLIM_SAVED_CUR ((rlim_t)-1l)
+#else
+# define RLIM_INFINITY 0x7FFFFFFF
+# define RLIM_SAVED_MAX 0x7FFFFFFE
+# define RLIM_SAVED_CUR 0x7FFFFFFD
+#endif
+#ifdef _SYSCALL32
+# define RLIM32_INFINITY 0x7FFFFFFF
+# define RLIM32_SAVED_MAX 0x7FFFFFFE
+# define RLIM32_SAVED_CUR 0x7FFFFFFD
+#endif
+
+#if __WORDSIZE == 64
+# define RLIM_SAVED(x) 1
+# define RLIM_NSAVED RLIM_NLIMITS
+#else
+# define RLIM_SAVED(x) (x <= RLIMIT_FSIZE)
+# define RLIM_NSAVED (RLIMIT_FSIZE + 1)
+#endif
+
+struct rlimit
+ {
+ /* The current (soft) limit. */
+ rlim_t rlim_cur;
+ /* The hard limit. */
+ rlim_t rlim_max;
+ };
+
+#ifdef _SYSCALL32
+struct rlimit32
+ {
+ rlim32_t rlim_cur;
+ rlim32_t rlim_max;
+};
+#endif
+
+#ifdef __USE_LARGEFILE64
+struct rlimit64
+ {
+ /* The current (soft) limit. */
+ rlim64_t rlim_cur;
+ /* The hard limit. */
+ rlim64_t rlim_max;
+ };
+#endif
+
+/* Whose usage statistics do you want? */
+enum __rusage_who
+{
+ /* The calling process. */
+ RUSAGE_SELF = 0,
+#define RUSAGE_SELF RUSAGE_SELF
+
+ /* The lwp. */
+ RUSAGE_LWP = 1,
+#define RUSAGE_LWP RUSAGE_LWP
+
+ /* All of its terminated child processes. */
+ RUSAGE_CHILDREN = 2
+#define RUSAGE_CHILDREN RUSAGE_CHILDREN
+};
+
+#define __need_timeval
+#define __need_itimerval
+#include <bits/time.h> /* For `struct timeval'. */
+
+/* Structure which says how much of each resource has been used. */
+struct rusage
+ {
+ /* Total amount of user time used. */
+ struct timeval ru_utime;
+ /* Total amount of system time used. */
+ struct timeval ru_stime;
+ /* Maximum resident set size (in kilobytes). */
+ long int ru_maxrss;
+ /* Amount of sharing of text segment memory
+ with other processes (kilobyte-seconds). */
+ long int ru_ixrss;
+ /* Amount of data segment memory used (kilobyte-seconds). */
+ long int ru_idrss;
+ /* Amount of stack memory used (kilobyte-seconds). */
+ long int ru_isrss;
+ /* Number of soft page faults (i.e. those serviced by reclaiming
+ a page from the list of pages awaiting reallocation. */
+ long int ru_minflt;
+ /* Number of hard page faults (i.e. those that required I/O). */
+ long int ru_majflt;
+ /* Number of times a process was swapped out of physical memory. */
+ long int ru_nswap;
+ /* Number of input operations via the file system. Note: This
+ and `ru_oublock' do not include operations with the cache. */
+ long int ru_inblock;
+ /* Number of output operations via the file system. */
+ long int ru_oublock;
+ /* Number of IPC messages sent. */
+ long int ru_msgsnd;
+ /* Number of IPC messages received. */
+ long int ru_msgrcv;
+ /* Number of signals delivered. */
+ long int ru_nsignals;
+ /* Number of voluntary context switches, i.e. because the process
+ gave up the process before it had to (usually to wait for some
+ resource to be available). */
+ long int ru_nvcsw;
+ /* Number of involuntary context switches, i.e. a higher priority process
+ became runnable or the current process used up its time slice. */
+ long int ru_nivcsw;
+ };
+
+/* The type of the WHICH argument to `getpriority' and `setpriority',
+ indicating what flavor of entity the WHO argument specifies. */
+enum __priority_which
+{
+ PRIO_PROCESS = 0, /* WHO is a process ID. */
+#define PRIO_PROCESS PRIO_PROCESS
+ PRIO_PGRP = 1, /* WHO is a process group ID. */
+#define PRIO_PGRP PRIO_PGRP
+ PRIO_USER = 2, /* WHO is a user ID. */
+#define PRIO_USER PRIO_USER
+ PRIO_GROUP = 3,
+#define PRIO_GROUP PRIO_GROUP
+ PRIO_SESSION = 4,
+#define PRIO_SESSION PRIO_SESSION
+ PRIO_LWP = 5,
+#define PRIO_LWP PRIO_LWP
+ PRIO_TASK = 6,
+#define PRIO_TASK PRIO_TASK
+ PRIO_PROJECT = 7,
+#define PRIO_PROJECT PRIO_PROJECT
+ PRIO_ZONE = 8,
+#define PRIO_ZONE PRIO_ZONE
+ PRIO_CONTRACT = 9,
+#define PRIO_CONTRACT PRIO_CONTRACT
+};
+
+enum
+{
+ _RUSAGESYS_GETRUSAGE = 0,
+#define _RUSAGESYS_GETRUSAGE _RUSAGESYS_GETRUSAGE
+ _RUSAGESYS_GETRUSAGE_CHLD = 1,
+#define _RUSAGESYS_GETRUSAGE_CHLD _RUSAGESYS_GETRUSAGE_CHLD
+ _RUSAGESYS_GETRUSAGE_LWP = 2,
+#define _RUSAGESYS_GETRUSAGE_LWP _RUSAGESYS_GETRUSAGE_LWP
+ _RUSAGESYS_GETVMUSAGE = 3
+#define _RUSAGESYS_GETVMUSAGE _RUSAGESYS_GETVMUSAGE
+};
+
+#define PRIO_MIN -20
+#define PRIO_MAX 20
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/sched.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/sched.h
new file mode 100644
index 0000000000..10a457ef58
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/sched.h
@@ -0,0 +1,153 @@
+/* Definitions of constants and data structure for POSIX 1003.1b-1993
+ scheduling interface. OpenSolaris version.
+ Copyright (C) 1996-1999,2001-2003,2005,2006,2007,2008
+ Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef __need_schedparam
+
+#ifndef _SCHED_H
+# error "Never include <bits/sched.h> directly; use <sched.h> instead."
+#endif
+
+
+/* Scheduling algorithms. */
+#define SCHED_OTHER 0
+#define SCHED_FIFO 1
+#define SCHED_RR 2
+#define SCHED_SYS 3
+#define SCHED_IA 4
+#define SCHED_FSS 5
+#define SCHED_FX 6
+#define _SCHED_NEXT 7
+
+/* The official definition. */
+struct sched_param
+ {
+ int __sched_priority;
+ int __sched_nicelim;
+ int __sched_nice;
+ int __sched_pad[6];
+ };
+
+#endif /* need schedparam */
+
+#if !defined __defined_schedparam \
+ && (defined __need_schedparam || defined _SCHED_H)
+# define __defined_schedparam 1
+/* Data structure to describe a process' schedulability. */
+struct __sched_param
+ {
+ int __sched_priority;
+ int __sched_nicelim;
+ int __sched_nice;
+ int __sched_pad[6];
+ };
+# undef __need_schedparam
+#endif
+
+
+#if defined _SCHED_H && !defined __cpu_set_t_defined
+# define __cpu_set_t_defined
+/* Size definition for CPU sets. */
+# define __CPU_SETSIZE 1024
+# define __NCPUBITS (8 * sizeof (__cpu_mask))
+
+/* Type for array elements in 'cpu_set_t'. */
+typedef unsigned long int __cpu_mask;
+
+/* Basic access functions. */
+# define __CPUELT(cpu) ((cpu) / __NCPUBITS)
+# define __CPUMASK(cpu) ((__cpu_mask) 1 << ((cpu) % __NCPUBITS))
+
+/* Data structure to describe CPU mask. */
+typedef struct
+{
+ __cpu_mask __bits[__CPU_SETSIZE / __NCPUBITS];
+} cpu_set_t;
+
+/* Access functions for CPU masks. */
+# if __GNUC_PREREQ (2, 91)
+# define __CPU_ZERO_S(setsize, cpusetp) \
+ do __builtin_memset (cpusetp, '\0', setsize); while (0)
+# else
+# define __CPU_ZERO_S(setsize, cpusetp) \
+ do { \
+ size_t __i; \
+ size_t __imax = (setsize) / sizeof (__cpu_mask); \
+ cpu_set_t *__arr = (cpusetp); \
+ for (__i = 0; __i < __imax; ++__i) \
+ __arr->__bits[__i] = 0; \
+ } while (0)
+# endif
+# define __CPU_SET_S(cpu, setsize, cpusetp) \
+ ({ size_t __cpu = (cpu); \
+ __cpu < 8 * (setsize) \
+ ? ((cpusetp)->__bits[__CPUELT (__cpu)] |= __CPUMASK (__cpu)) : 0; })
+# define __CPU_CLR_S(cpu, setsize, cpusetp) \
+ ({ size_t __cpu = (cpu); \
+ __cpu < 8 * (setsize) \
+ ? ((cpusetp)->__bits[__CPUELT (__cpu)] &= ~__CPUMASK (__cpu)) : 0; })
+# define __CPU_ISSET_S(cpu, setsize, cpusetp) \
+ ({ size_t __cpu = (cpu); \
+ __cpu < 8 * (setsize) \
+ ? (((cpusetp)->__bits[__CPUELT (__cpu)] & __CPUMASK (__cpu))) != 0 : 0; })
+
+# define __CPU_COUNT_S(setsize, cpusetp) \
+ __sched_cpucount (setsize, cpusetp)
+
+# if __GNUC_PREREQ (2, 91)
+# define __CPU_EQUAL_S(setsize, cpusetp1, cpusetp2) \
+ (__builtin_memcmp (cpusetp1, cpusetp2, setsize) == 0)
+# else
+# define __CPU_EQUAL_S(setsize, cpusetp1, cpusetp2) \
+ ({ cpu_set_t *__arr1 = (cpusetp1); \
+ cpu_set_t *__arr2 = (cpusetp2); \
+ size_t __imax = (setsize) / sizeof (__cpu_mask); \
+ size_t __i; \
+ for (__i = 0; __i < __imax; ++__i) \
+ if (__arr1->__bits[__i] != __arr2->__bits[__i]) \
+ break; \
+ __i == __imax; })
+# endif
+
+# define __CPU_OP_S(setsize, destset, srcset1, srcset2, op) \
+ ({ cpu_set_t *__dest = (destset); \
+ cpu_set_t *__arr1 = (srcset1); \
+ cpu_set_t *__arr2 = (srcset2); \
+ size_t __imax = (setsize) / sizeof (__cpu_mask); \
+ size_t __i; \
+ for (__i = 0; __i < __imax; ++__i) \
+ __dest->__bits[__i] = __arr1->__bits[__i] op __arr2->__bits[__i]; \
+ __dest; })
+
+# define __CPU_ALLOC_SIZE(count) \
+ ((((count) + __NCPUBITS - 1) / __NCPUBITS) * 8)
+# define __CPU_ALLOC(count) __sched_cpualloc (count)
+# define __CPU_FREE(cpuset) __sched_cpufree (cpuset)
+
+__BEGIN_DECLS
+
+extern int __sched_cpucount (size_t __setsize, const cpu_set_t *__setp)
+ __THROW;
+extern cpu_set_t *__sched_cpualloc (size_t __count) __THROW __wur;
+extern void __sched_cpufree (cpu_set_t *__set) __THROW;
+
+__END_DECLS
+
+#endif
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/sem.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/sem.h
new file mode 100644
index 0000000000..1579ea1484
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/sem.h
@@ -0,0 +1,74 @@
+/* Copyright (C) 1995, 1996, 1997, 1998, 2008
+ Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _SYS_SEM_H
+# error "Never include <bits/sem.h> directly; use <sys/sem.h> instead."
+#endif
+
+#include <sys/types.h>
+
+#define SEM_A 0200
+#define SEM_R 0400
+
+/* Flags for `semop'. */
+#define SEM_UNDO 010000 /* undo the operation on exit */
+
+/* Commands for `semctl'. */
+#define GETNCNT 3 /* get semncnt */
+#define GETPID 4 /* get sempid */
+#define GETVAL 5 /* get semval */
+#define GETALL 6 /* get all semval's */
+#define GETZCNT 7 /* get semzcnt */
+#define SETVAL 8 /* set semval */
+#define SETALL 9 /* set all semval's */
+
+
+/* Data structure describing a set of semaphores. */
+struct semid_ds
+{
+ struct ipc_perm sem_perm; /* operation permission struct */
+ struct sem *sem_base; /* ptr to first semaphore in set */
+ unsigned short sem_nsems; /* number of semaphores in set */
+ __time_t sem_otime; /* last semop() time */
+#if __WORDSIZE == 32
+ int32_t sem_pad1;
+#endif
+ __time_t sem_ctime; /* last time changed by semctl() */
+#if __WORDSIZE == 32
+ int32_t sem_pad2;
+#endif
+ int sem_binary; /* flag indicating semaphore type */
+ long sem_pad3[3];
+};
+
+/* The user should define a union like the following to use it for arguments
+ for `semctl'.
+
+ union semun
+ {
+ int val; <= value for SETVAL
+ struct semid_ds *buf; <= buffer for IPC_STAT & IPC_SET
+ unsigned short int *array; <= array for GETALL & SETALL
+ struct seminfo *__buf; <= buffer for IPC_INFO
+ };
+
+ Previous versions of this file used to define this union but this is
+ incorrect. One can test the macro _SEM_SEMUN_UNDEFINED to see whether
+ one must define the union or not. */
+#define _SEM_SEMUN_UNDEFINED 1
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/shm.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/shm.h
new file mode 100644
index 0000000000..04ccac481c
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/shm.h
@@ -0,0 +1,77 @@
+/* Copyright (C) 1995, 1996, 1997, 2000, 2002, 2004, 2008
+ Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _SYS_SHM_H
+# error "Never include <bits/shm.h> directly; use <sys/shm.h> instead."
+#endif
+
+#include <bits/types.h>
+#include <bits/wordsize.h>
+
+/* Permission flag for shmget. */
+#define SHM_R 0400 /* or S_IRUGO from <linux/stat.h> */
+#define SHM_W 0200 /* or S_IWUGO from <linux/stat.h> */
+
+/* Flags for `shmat'. */
+#define SHM_RDONLY 010000 /* attach read-only else read-write */
+#define SHM_RND 020000 /* round attach address to SHMLBA */
+#define SHM_REMAP 040000 /* take-over region on attach */
+#define SHM_PAGEABLE 0100000 /*pageable ISM */
+
+/* Commands for `shmctl'. */
+#define SHM_LOCK 3 /* lock segment (root only) */
+#define SHM_UNLOCK 4 /* unlock segment (root only) */
+
+__BEGIN_DECLS
+
+/* Segment low boundary address multiple. */
+#define SHMLBA (__getpagesize ())
+extern int __getpagesize (void) __THROW __attribute__ ((__const__));
+
+
+/* Type to count number of attaches. */
+typedef unsigned long int shmatt_t;
+
+/* Data structure describing a set of semaphores. */
+struct shmid_ds
+ {
+ struct ipc_perm shm_perm; /* operation permission struct */
+ size_t shm_segsz; /* size of segment in bytes */
+ void *shm_amp; /* segment anon_map pointer */
+ unsigned short shm_lkcnt; /* number of times it is being locked */
+ __pid_t shm_cpid; /* pid of creator */
+ __pid_t shm_lpid; /* pid of last shmop */
+ shmatt_t shm_nattch; /* number of current attaches */
+ unsigned long shm_cnattch; /* number of ISM attaches */
+ __time_t shm_atime; /* time of last shmat() */
+#if __WORDSIZE == 32
+ __int32_t shm_pad1;
+#endif
+ __time_t shm_dtime; /* time of last shmdt() */
+#if __WORDSIZE == 32
+ __int32_t shm_pad2;
+#endif
+ __time_t shm_ctime; /* time of last change by shmctl() */
+#if __WORDSIZE == 32
+ __int32_t shm_pad3;
+ __int32_t shm_pad4[4];
+#endif
+ };
+
+__END_DECLS
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/sigaction.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/sigaction.h
new file mode 100644
index 0000000000..891c4e9726
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/sigaction.h
@@ -0,0 +1,94 @@
+/* The definitions for OpenSolaris's sigaction.
+ Copyright (C) 1993-1999, 2000, 2008, 2009 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _SIGNAL_H
+# error "Never include <bits/sigaction.h> directly; use <signal.h> instead."
+#endif
+
+#define __need_siginfo_t
+#include <bits/siginfo.h>
+
+/* Structure describing the action to be taken when a signal arrives. */
+struct sigaction
+{
+ int sa_flags;
+ union
+ {
+ void (*_handler)(int);
+ void (*_sigaction)(int, siginfo_t *, void *);
+ } _funcptr;
+#define sa_handler _funcptr._handler
+#define sa_sigaction _funcptr._sigaction
+ sigset_t sa_mask;
+#if __WORDSIZE == 32
+ int sa_resv[2];
+#endif
+};
+
+#ifdef _SYSCALL32
+
+# include <sys/types32.h>
+
+struct sigaction32
+ {
+ int32_t sa_flags;
+ union
+ {
+ caddr32_t _handler;
+ caddr32_t _sigaction;
+ } _funcptr;
+ sigset32_t sa_mask;
+ int32_t sa_resv[2];
+ };
+
+#endif
+
+/* Bits in `sa_flags'. */
+#define SA_NOCLDSTOP 0x00020000 /* Don't send SIGCHLD when children stop. */
+#define SA_NOCLDWAIT 0x00010000 /* Don't send SIGCHLD when children stop. */
+#define SA_SIGINFO 0x00000008 /* Invoke signal-catching function with
+ three arguments instead of one. */
+#if defined __USE_UNIX98 || defined __USE_MISC
+#define SA_ONSTACK 0x00000001 /* Use signal stack by using `sa_restorer'. */
+#define SA_RESTART 0x00000004 /* Restart syscall on signal return. */
+#define SA_NODEFER 0x00000010 /* Don't automatically block the signal when
+ its handler is being executed. */
+#define SA_RESETHAND 0x00000002
+#endif
+
+#ifdef __USE_MISC
+# define SA_INTERRUPT 0 /* Historical no-op ("not SA_RESTART"). */
+
+/* Some aliases for the SA_ constants. */
+# define SA_NOMASK SA_NODEFER
+# define SA_ONESHOT SA_RESETHAND
+# define SA_STACK SA_ONSTACK
+#endif
+
+/* Values for the HOW argument to `sigprocmask'. */
+#define SIG_BLOCK 1 /* Block signals. */
+#define SIG_UNBLOCK 2 /* Unblock signals. */
+#define SIG_SETMASK 3 /* Set the set of blocked signals. */
+
+#define SIGNO_MASK 0xFF
+#define SIGDEFER 0x100
+#define SIGHOLD 0x200
+#define SIGRELSE 0x400
+#define SIGIGNORE 0x800
+#define SIGPAUSE 0x1000
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/sigcontext.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/sigcontext.h
new file mode 100644
index 0000000000..9b4126819a
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/sigcontext.h
@@ -0,0 +1,24 @@
+/* Structure describing state saved while handling a signal. Stub version.
+ Copyright (C) 1991, 1994, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _SIGNAL_H
+# error "Never use <bits/sigcontext.h> directly; include <signal.h> instead."
+#endif
+
+struct sigcontext;
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/siginfo.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/siginfo.h
new file mode 100644
index 0000000000..57e9f54fe1
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/siginfo.h
@@ -0,0 +1,497 @@
+/* siginfo_t, sigevent and constants. OpenSolaris version.
+ Copyright (C) 1997-2002, 2003, 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#if !defined _SIGNAL_H && !defined __need_siginfo_t \
+ && !defined __need_sigevent_t
+# error "Never include this file directly. Use <signal.h> instead"
+#endif
+
+#include <bits/wordsize.h>
+#include <features.h>
+
+/* This needs to be defined here because we only get timespec for certain
+ posix flags. */
+#if !defined __USE_POSIX199309 && !defined __USE_MISC
+struct __timespec
+ {
+ __time_t tv_sec; /* Seconds. */
+ long int tv_nsec; /* Nanoseconds. */
+ };
+#else
+# define __need_timespec
+# include <time.h>
+#endif
+
+#if (!defined __have_sigval_t \
+ && (defined _SIGNAL_H || defined __need_siginfo_t \
+ || defined __need_sigevent_t))
+# define __have_sigval_t 1
+
+/* Type for data associated with a signal. */
+union sigval
+{
+ int sival_int;
+ void *sival_ptr;
+};
+typedef union sigval sigval_t;
+
+# ifdef _SYSCALL32
+
+# include <sys/types32.h>
+
+union sigval32
+ {
+ __int32_t sival_int;
+ caddr32_t sival_ptr;
+ };
+
+# endif
+
+#endif
+
+#if (!defined __have_siginfo_t \
+ && (defined _SIGNAL_H || defined __need_siginfo_t))
+# define __have_siginfo_t 1
+
+# if __WORDSIZE == 64
+# define __SI_MAX_SIZE 256
+# define __SI_PAD_SIZE ((__SI_MAX_SIZE / sizeof (int)) - 4)
+# else
+# define __SI_MAX_SIZE 128
+# define __SI_PAD_SIZE ((__SI_MAX_SIZE / sizeof (int)) - 3)
+# endif
+# define SI_MAXSZ __SI_MAX_SIZE
+# define SI_PAD __SI_PAD_SIZE
+
+typedef struct siginfo
+{
+ int si_signo;
+ int si_code;
+ int si_errno;
+# if __WORDSIZE == 64
+ int si_pad;
+# endif
+ union
+ {
+ int _pad[__SI_PAD_SIZE];
+
+ struct /* kill(), SIGCLD, siqqueue() */
+ {
+ __pid_t __pid; /* Sending process ID. */
+ union {
+ struct {
+ __uid_t __uid; /* Real user ID of sending process. */
+ union sigval __value;
+ } __kill;
+ struct {
+ __clock_t __utime;
+ int __status;
+ __clock_t __stime;
+ } __cld;
+ } __pdata;
+ ctid_t __ctid;
+ zoneid_t __zoneid;
+ } __proc;
+
+ struct /* SIGSEGV, SIGBUS, SIGILL, SIGTRAP, SIGFPE */
+ {
+ void *__addr;
+ int __trapno;
+ char *__pc;
+ } __fault;
+
+ struct /* SIGPOLL, SIGXFSZ */
+ {
+ int __fd;
+ long __band;
+ } __file;
+
+ struct /* SIGPROF */
+ {
+ char *__faddr;
+#if !defined __USE_POSIX199309 && !defined __USE_MISC
+ struct __timespec __tstamp;
+#else
+ struct timespec __tstamp;
+#endif
+ short __syscall;
+ char __nsysarg;
+ char __fault;
+ long __sysarg[8];
+ int __mstate[10];
+ } __prof;
+
+ struct /* SI_RCTL */
+ {
+ __int32_t __entity;
+ } __rctl;
+ } __data;
+} siginfo_t;
+
+# ifdef _SYSCALL32
+
+# include <sys/types32.h>
+
+typedef struct siginfo32
+{
+ int32_t si_signo;
+ int32_t si_code;
+ int32_t si_errno;
+ union
+ {
+ int32_t _pad[__SI_PAD_SIZE];
+
+ struct /* kill(), SIGCLD, siqqueue() */
+ {
+ pid32_t __pid; /* Sending process ID. */
+ union {
+ struct {
+ uid32_t __uid; /* Real user ID of sending process. */
+ union sigval32 __value;
+ } __kill;
+ struct {
+ clock32_t __utime;
+ int32_t __status;
+ clock32_t __stime;
+ } __cld;
+ } __pdata;
+ id32_t __ctid;
+ id32_t __zoneid;
+ } __proc;
+
+ struct /* SIGSEGV, SIGBUS, SIGILL, SIGTRAP, SIGFPE */
+ {
+ caddr32_t __addr;
+ int32_t __trapno;
+ caddr32_t __pc;
+ } __fault;
+
+ struct /* SIGPOLL, SIGXFSZ */
+ {
+ int32_t __fd;
+ int32_t __band;
+ } __file;
+
+ struct /* SIGPROF */
+ {
+ caddr32_t __faddr;
+ struct timespec32 __tstamp;
+ int16_t __syscall;
+ int8_t __nsysarg;
+ int8_t __fault;
+ int32_t __sysarg[8];
+ int32_t __mstate[10];
+ } __prof;
+
+ struct /* SI_RCTL */
+ {
+ int32_t __entity;
+ } __rctl;
+ } __data;
+} siginfo32_t;
+
+# endif /* _SYSCALL32 */
+
+# ifdef __USE_MISC
+
+typedef struct k_siginfo
+{
+ int si_signo;
+ int si_code;
+ int si_errno;
+# if __WORDSIZE == 64
+ int si_pad;
+# endif
+ union
+ {
+ struct
+ {
+ __pid_t __pid;
+ union
+ {
+ struct
+ {
+ __uid_t __uid;
+ union sigval __value;
+ } __kill;
+ struct
+ {
+ __clock_t __utime;
+ int __status;
+ __clock_t __stime;
+ } __cld;
+ } __pdata;
+ ctid_t __ctid;
+ zoneid_t __zoneid;
+ } __proc;
+
+ struct
+ {
+ void *__addr;
+ int __trapno;
+ char *__pc;
+ } __fault;
+
+ struct
+ {
+ int __fd;
+ long __band;
+ } __file;
+
+ struct
+ {
+ char *__faddr;
+
+ struct timespec __tstamp;
+ short __syscall;
+ char __nsysarg;
+ char __fault;
+ } __prof;
+
+ struct
+ {
+ int32_t __entity;
+ } __rctl;
+ } __data;
+ } k_siginfo_t;
+
+typedef struct sigqueue
+ {
+ struct sigqueue *sq_next;
+ k_siginfo_t sq_info;
+ void (*sq_func)(struct sigqueue *);
+ void *sq_backptr;
+ int sq_external;
+ } sigqueue_t;
+
+# endif /* __USE_MISC */
+
+# define SI_FROMUSER(sip) ((sip)->si_code <= 0)
+# define SI_FROMKERNEL(sip) ((sip)->si_code > 0)
+
+/* Values for `si_code'. Positive values are reserved for kernel-generated
+ signals. */
+enum
+{
+ SI_NOINFO = 32767, /* no signal information */
+# define SI_NOINFO SI_NOINFO
+ SI_DTRACE = 2050, /* kernel generated signal via DTrace action */
+# define SI_DTRACE SI_DTRACE
+ SI_RCTL = 2049, /* kernel generated signal via rctl action */
+# define SI_RCTL SI_RCTL
+ SI_USER = 0, /* user generated signal via kill() */
+# define SI_USER SI_USER
+ SI_LWP = -1, /* user generated signal via lwp_kill() */
+# define SI_LWP SI_LWP
+ SI_QUEUE = -2, /* user generated signal via sigqueue() */
+# define SI_QUEUE SI_QUEUE
+ SI_TIMER = -3, /* from timer expiration */
+# define SI_TIMER SI_TIMER
+ SI_ASYNCIO = -4, /* from asynchronous I/O completion */
+# define SI_ASYNCIO SI_ASYNCIO
+ SI_MESGQ = -5 /* from message arrival */
+};
+
+/* `si_code' values for SIGILL signal. */
+enum
+{
+ ILL_ILLOPC = 1, /* Illegal opcode. */
+# define ILL_ILLOPC ILL_ILLOPC
+ ILL_ILLOPN = 2, /* Illegal operand. */
+# define ILL_ILLOPN ILL_ILLOPN
+ ILL_ILLADR = 3, /* Illegal addressing mode. */
+# define ILL_ILLADR ILL_ILLADR
+ ILL_ILLTRP = 4, /* Illegal trap. */
+# define ILL_ILLTRP ILL_ILLTRP
+ ILL_PRVOPC = 5, /* Privileged opcode. */
+# define ILL_PRVOPC ILL_PRVOPC
+ ILL_PRVREG = 6, /* Privileged register. */
+# define ILL_PRVREG ILL_PRVREG
+ ILL_COPROC = 7, /* Coprocessor error. */
+# define ILL_COPROC ILL_COPROC
+ ILL_BADSTK = 8 /* Internal stack error. */
+# define ILL_BADSTK ILL_BADSTK
+};
+# define NSIGILL 8
+
+/* `si_code' values for SIGFPE signal. */
+enum
+{
+ FPE_INTDIV = 1, /* Integer divide by zero. */
+# define FPE_INTDIV FPE_INTDIV
+ FPE_INTOVF = 2, /* Integer overflow. */
+# define FPE_INTOVF FPE_INTOVF
+ FPE_FLTDIV = 3, /* Floating point divide by zero. */
+# define FPE_FLTDIV FPE_FLTDIV
+ FPE_FLTOVF = 4, /* Floating point overflow. */
+# define FPE_FLTOVF FPE_FLTOVF
+ FPE_FLTUND = 5, /* Floating point underflow. */
+# define FPE_FLTUND FPE_FLTUND
+ FPE_FLTRES = 6, /* Floating point inexact result. */
+# define FPE_FLTRES FPE_FLTRES
+ FPE_FLTINV = 7, /* Floating point invalid operation. */
+# define FPE_FLTINV FPE_FLTINV
+ FPE_FLTSUB = 8, /* Subscript out of range. */
+# define FPE_FLTSUB FPE_FLTSUB
+ FPE_FLTDEN = 9
+# define FPE_FLTDEN FPE_FLTDEN
+};
+# define NSIGFPE 9
+
+/* `si_code' values for SIGSEGV signal. */
+enum
+{
+ SEGV_MAPERR = 1, /* Address not mapped to object. */
+# define SEGV_MAPERR SEGV_MAPERR
+ SEGV_ACCERR = 2 /* Invalid permissions for mapped object. */
+# define SEGV_ACCERR SEGV_ACCERR
+};
+# define NSIGSEGV 2
+
+/* `si_code' values for SIGBUS signal. */
+enum
+{
+ BUS_ADRALN = 1, /* Invalid address alignment. */
+# define BUS_ADRALN BUS_ADRALN
+ BUS_ADRERR = 2, /* Non-existant physical address. */
+# define BUS_ADRERR BUS_ADRERR
+ BUS_OBJERR = 3 /* Object specific hardware error. */
+# define BUS_OBJERR BUS_OBJERR
+};
+# define NSIGBUS 3
+
+/* `si_code' values for SIGEMT signal. */
+enum
+{
+ EMT_CPCOVF = 1
+# define EMT_CPCOVF EMT_CPCOVF
+};
+# define NSIGEMT 1
+
+
+/* `si_code' values for SIGTRAP signal. */
+# define TRAP_BRKPT 1 /* breakpoint trap */
+# define TRAP_TRACE 2 /* trace trap */
+# define TRAP_RWATCH 3 /* read access watchpoint trap */
+# define TRAP_WWATCH 4 /* write access watchpoint trap */
+# define TRAP_XWATCH 5 /* execute access watchpoint trap */
+# define TRAP_DTRACE 6 /* problem with fasttrap DTrace provider */
+# define NSIGTRAP 6
+
+/* `si_code' values for SIGCHLD signal. */
+# define CLD_EXITED 1 /* child has exited */
+# define CLD_KILLED 2 /* child was killed */
+# define CLD_DUMPED 3 /* child has coredumped */
+# define CLD_TRAPPED 4 /* traced child has stopped */
+# define CLD_STOPPED 5 /* child has stopped on signal */
+# define CLD_CONTINUED 6 /* stopped child has continued */
+# define NSIGCLD 6
+
+/* `si_code' values for SIGPOLL signal. */
+# define POLL_IN 1 /* input available */
+# define POLL_OUT 2 /* output possible */
+# define POLL_MSG 3 /* message available */
+# define POLL_ERR 4 /* I/O error */
+# define POLL_PRI 5 /* high priority input available */
+# define POLL_HUP 6 /* device disconnected */
+# define NSIGPOLL 6
+
+/* SIGPROF signal codes */
+# define PROF_SIG 1 /* have to set code non-zero */
+# define NSIGPROF 1
+
+/* X/Open requires some more fields with fixed names. */
+# define si_pid __data.__proc.__pid
+# define si_ctid __data.__proc.__ctid
+# define si_zoneid __data.__proc.__zoneid
+# define si_status __data.__proc.__pdata.__cld.__status
+# define si_stime __data.__proc.__pdata.__cld.__stime
+# define si_utime __data.__proc.__pdata.__cld.__utime
+# define si_uid __data.__proc.__pdata.__kill.__uid
+# define si_value __data.__proc.__pdata.__kill.__value
+# define si_addr __data.__fault.__addr
+# define si_trapno __data.__fault.__trapno
+# define si_trapafter __data.__fault.__trapno
+# define si_pc __data.__fault.__pc
+# define si_fd __data.__file.__fd
+# define si_band __data.__file.__band
+# define si_tstamp __data.__prof.__tstamp
+# define si_syscall __data.__prof.__syscall
+# define si_nsysarg __data.__prof.__nsysarg
+# define si_sysarg __data.__prof.__sysarg
+# define si_fault __data.__prof.__fault
+# define si_faddr __data.__prof.__faddr
+# define si_mstate __data.__prof.__mstate
+# define si_entity __data.__rctl.__entity
+
+# undef __need_siginfo_t
+#endif /* !have siginfo_t && (have _SIGNAL_H || need siginfo_t). */
+
+#if (defined _SIGNAL_H || defined __need_sigevent_t) \
+ && !defined __have_sigevent_t
+# define __have_sigevent_t 1
+
+/* Structure to transport application-defined values with signals. */
+# define __SIGEV_MAX_SIZE 64
+# if __WORDSIZE == 64
+# define __SIGEV_PAD_SIZE ((__SIGEV_MAX_SIZE / sizeof (int)) - 4)
+# else
+# define __SIGEV_PAD_SIZE ((__SIGEV_MAX_SIZE / sizeof (int)) - 3)
+# endif
+
+typedef struct sigevent
+{
+ int sigev_notify;
+ int sigev_signo;
+ union sigval sigev_value;
+ void (*sigev_notify_function)(union sigval);
+ /*pthread_attr_t*/ void *sigev_notify_attributes;
+ int __sigev_pad2;
+} sigevent_t;
+
+#ifdef _SYSCALL32
+
+#include <sys/types32.h>
+
+struct sigevent32
+ {
+ __int32_t sigev_notify;
+ __int32_t sigev_signo;
+ union sigval32 sigev_value;
+ caddr32_t sigev_notify_function;
+ caddr32_t sigev_notify_attributes;
+ __int32_t __sigev_pad2;
+};
+
+#endif
+
+/* `sigev_notify' values. */
+enum
+{
+ SIGEV_NONE = 1, /* no notification */
+# define SIGEV_NONE SIGEV_NONE
+ SIGEV_SIGNAL = 2, /* queued signal notification */
+# define SIGEV_SIGNAL SIGEV_SIGNAL
+ SIGEV_THREAD = 3, /* call back from another thread */
+#define SIGEV_PORT SIGEV_PORT
+ SIGEV_PORT = 4 /* use event port for notification */
+#define SIGEV_PORT SIGEV_PORT
+};
+
+#endif /* have _SIGNAL_H. */
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/signum.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/signum.h
new file mode 100644
index 0000000000..e9da43c7d6
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/signum.h
@@ -0,0 +1,90 @@
+/* Signal number definitions. OpenSolaris version.
+ Copyright (C) 1994, 1996, 1998, 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifdef _SIGNAL_H
+
+/* Fake signal functions. */
+#define SIG_ERR ((__sighandler_t) -1) /* Error return. */
+#define SIG_DFL ((__sighandler_t) 0) /* Default action. */
+#define SIG_IGN ((__sighandler_t) 1) /* Ignore signal. */
+#define SIG_HOLD ((__sighandler_t) 2) /* Add signal to hold mask. */
+
+
+/* Signals. */
+#define SIGHUP 1 /* Hangup (POSIX). */
+#define SIGINT 2 /* Interrupt (ANSI). */
+#define SIGQUIT 3 /* Quit (POSIX). */
+#define SIGILL 4 /* Illegal instruction (ANSI). */
+#define SIGABRT SIGIOT /* Abort (ANSI). */
+#define SIGTRAP 5 /* Trace trap (POSIX). */
+#define SIGIOT 6 /* IOT trap (4.2 BSD). */
+#define SIGEMT 7 /* EMT trap (4.2 BSD). */
+#define SIGFPE 8 /* Floating-point exception (ANSI). */
+#define SIGKILL 9 /* Kill, unblockable (POSIX). */
+#define SIGBUS 10 /* Bus error (4.2 BSD). */
+#define SIGSEGV 11 /* Segmentation violation (ANSI). */
+#define SIGSYS 12 /* Bad argument to system call (4.2 BSD)*/
+#define SIGPIPE 13 /* Broken pipe (POSIX). */
+#define SIGALRM 14 /* Alarm clock (POSIX). */
+#define SIGTERM 15 /* Termination (ANSI). */
+#define SIGUSR1 16 /* User-defined signal 1 (POSIX). */
+#define SIGUSR2 17 /* User-defined signal 2 (POSIX). */
+#define SIGCHLD 18 /* Child status has changed (POSIX). */
+#define SIGCLD SIGCHLD /* Same as SIGCHLD (System V). */
+#define SIGPWR 19 /* Power failure restart (System V). */
+#define SIGWINCH 20 /* Window size change (4.3 BSD, Sun). */
+#define SIGURG 21 /* Urgent condition on socket (4.2 BSD).*/
+#define SIGPOLL 22 /* Pollable event occurred (System V). */
+#define SIGIO SIGPOLL /* I/O now possible (4.2 BSD). */
+#define SIGSTOP 23 /* Stop, unblockable (POSIX). */
+#define SIGTSTP 24 /* Keyboard stop (POSIX). */
+#define SIGCONT 25 /* Continue (POSIX). */
+#define SIGTTIN 26 /* Background read from tty (POSIX). */
+#define SIGTTOU 27 /* Background write to tty (POSIX). */
+#define SIGVTALRM 28 /* Virtual alarm clock (4.2 BSD). */
+#define SIGPROF 29 /* Profiling alarm clock (4.2 BSD). */
+#define SIGXCPU 30 /* CPU limit exceeded (4.2 BSD). */
+#define SIGXFSZ 31 /* File size limit exceeded (4.2 BSD). */
+/* The following signals are new in Solaris 2. */
+#define SIGWAITING 32 /* Process's lwps are blocked. */
+#define SIGLWP 33 /* Special signal used by thread library. */
+#define SIGFREEZE 34 /* Special signal used by CPR. */
+#define SIGTHAW 35 /* Special signal used by CPR. */
+#define SIGCANCEL 36 /* Reserved signal for thread cancellation */
+#define SIGLOST 37 /* Resource lost (eg, record-lock lost) */
+#define SIGXRES 38 /* Resource control exceeded */
+#define SIGJVM1 39 /* Reserved signal for Java Virtual Machine */
+#define SIGJVM2 40 /* Reserved signal for Java Virtual Machine */
+
+#define __SIGRTMIN 41 /* First (highest-priority) realtime signal */
+#define __SIGRTMAX 48 /* Last (lowest-priority) realtime signal */
+
+#define SIGRTMIN (__libc_current_sigrtmin ())
+#define SIGRTMAX (__libc_current_sigrtmax ())
+
+#endif /* <signal.h> included. */
+
+#define _NSIG 49 /* Biggest signal number + 1 */
+
+#ifdef __USE_MISC
+# define MAXSIG 48 /* Biggest signal number */
+#endif
+
+/* This is here for lack of a better location. */
+#define SIG2STR_MAX 32
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/sigset.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/sigset.h
new file mode 100644
index 0000000000..8a384bb185
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/sigset.h
@@ -0,0 +1,139 @@
+/* __sig_atomic_t, __sigset_t, and related definitions. OpenSolaris version.
+ Copyright (C) 1991, 1992, 1994, 1996, 1997, 2007, 2008
+ Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _SIGSET_H_types
+#define _SIGSET_H_types 1
+
+typedef int __sig_atomic_t;
+
+#define _SIGSET_NWORDS 4
+
+typedef struct
+ {
+ unsigned int __sigbits[_SIGSET_NWORDS];
+ } __sigset_t;
+
+#ifdef _SYSCALL32
+
+# include <sys/types32.h>
+
+typedef struct
+ {
+ uint32_t __sigbits[4];
+ } sigset32_t;
+
+#endif
+
+typedef struct
+ {
+ unsigned int __sigbits[2];
+ } k_sigset_t;
+
+#endif /* _SIGSET_H_types */
+
+/* We only want to define these functions if <signal.h> was actually
+ included; otherwise we were included just to define the types. Since we
+ are namespace-clean, it wouldn't hurt to define extra macros. But
+ trouble can be caused by functions being defined (e.g., any global
+ register vars declared later will cause compilation errors). */
+
+#if !defined _SIGSET_H_fns && defined _SIGNAL_H
+# define _SIGSET_H_fns 1
+
+# ifndef _EXTERN_INLINE
+# define _EXTERN_INLINE __extern_inline
+# endif
+
+/* Return a mask that includes the bit for SIG only. */
+# define __sigmask(sig) \
+ (((unsigned int) 1) << (((sig) - 1) % (8 * sizeof (unsigned int))))
+
+/* Return the word index for SIG. */
+# define __sigword(sig) (((sig) - 1) / (8 * sizeof (unsigned int)))
+
+# if defined __GNUC__ && __GNUC__ >= 2
+# define __sigemptyset(set) \
+ (__extension__ ({ int __cnt = _SIGSET_NWORDS; \
+ sigset_t *__set = (set); \
+ while (--__cnt >= 0) __set->__sigbits[__cnt] = 0; \
+ 0; }))
+# define __sigfillset(set) \
+ (__extension__ ({ int __cnt = _SIGSET_NWORDS; \
+ sigset_t *__set = (set); \
+ while (--__cnt >= 0) __set->__sigbits[__cnt] = ~0UL; \
+ 0; }))
+
+# ifdef __USE_GNU
+/* The POSIX does not specify for handling the whole signal set in one
+ command. This is often wanted and so we define three more functions
+ here. */
+# define __sigisemptyset(set) \
+ (__extension__ ({ int __cnt = _SIGSET_NWORDS; \
+ const sigset_t *__set = (set); \
+ int __ret = __set->__sigbits[--__cnt]; \
+ while (!__ret && --__cnt >= 0) \
+ __ret = __set->__sigbits[__cnt]; \
+ __ret == 0; }))
+# define __sigandset(dest, left, right) \
+ (__extension__ ({ int __cnt = _SIGSET_NWORDS; \
+ sigset_t *__dest = (dest); \
+ const sigset_t *__left = (left); \
+ const sigset_t *__right = (right); \
+ while (--__cnt >= 0) \
+ __dest->__sigbits[__cnt] = (__left->__sigbits[__cnt] \
+ & __right->__sigbits[__cnt]); \
+ 0; }))
+# define __sigorset(dest, left, right) \
+ (__extension__ ({ int __cnt = _SIGSET_NWORDS; \
+ sigset_t *__dest = (dest); \
+ const sigset_t *__left = (left); \
+ const sigset_t *__right = (right); \
+ while (--__cnt >= 0) \
+ __dest->__sigbits[__cnt] = (__left->__sigbits[__cnt] \
+ | __right->__sigbits[__cnt]); \
+ 0; }))
+# endif
+# endif
+
+/* These functions needn't check for a bogus signal number -- error
+ checking is done in the non __ versions. */
+
+extern int __sigismember (__const __sigset_t *, int);
+extern int __sigaddset (__sigset_t *, int);
+extern int __sigdelset (__sigset_t *, int);
+
+# ifdef __USE_EXTERN_INLINES
+# define __SIGSETFN(NAME, BODY, CONST) \
+ _EXTERN_INLINE int \
+ NAME (CONST __sigset_t *__set, int __sig) \
+ { \
+ unsigned int __mask = __sigmask (__sig); \
+ unsigned int __word = __sigword (__sig); \
+ return BODY; \
+ }
+
+__SIGSETFN (__sigismember, (__set->__sigbits[__word] & __mask) ? 1 : 0, __const)
+__SIGSETFN (__sigaddset, ((__set->__sigbits[__word] |= __mask), 0), )
+__SIGSETFN (__sigdelset, ((__set->__sigbits[__word] &= ~__mask), 0), )
+
+# undef __SIGSETFN
+# endif
+
+#endif /* ! _SIGSET_H_fns. */
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/sigstack.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/sigstack.h
new file mode 100644
index 0000000000..ff9f1e2828
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/sigstack.h
@@ -0,0 +1,78 @@
+/* sigstack, sigaltstack definitions. OpenSolaris version.
+ Copyright (C) 1998, 1999, 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#if !defined(_SIGNAL_H) && !defined(__need_stack_t)
+# error "Never include this file directly. Use <signal.h> instead"
+#endif
+
+#include <bits/types.h>
+
+#if !defined(__need_stack_t)
+
+/* Structure describing a signal stack (obsolete). */
+struct sigstack
+ {
+ void *ss_sp; /* Signal stack pointer. */
+ int ss_onstack; /* Nonzero if executing on this stack. */
+ };
+
+# ifdef _SYSCALL32
+
+# include <sys/types32.h>
+
+typedef struct sigaltstack32
+ {
+ caddr32_t ss_sp;
+ size32_t ss_size;
+ int32_t ss_flags;
+ } stack32_t;
+
+# endif
+
+
+/* Possible values for `ss_flags.'. */
+enum
+{
+ SS_ONSTACK = 1,
+# define SS_ONSTACK SS_ONSTACK
+ SS_DISABLE = 2
+# define SS_DISABLE SS_DISABLE
+};
+
+/* Minimum stack size for a signal handler. */
+# define MINSIGSTKSZ 2048
+
+/* System default stack size. */
+# define SIGSTKSZ 8192
+
+#endif /* __need_stack_t */
+
+#if !defined(__stack_t_defined)
+# define __stack_t_defined
+# undef __need_stack_t
+
+/* Alternate, preferred interface. */
+typedef struct sigaltstack
+ {
+ void *ss_sp;
+ __SIZE_TYPE__ ss_size;
+ int ss_flags;
+ } stack_t;
+
+#endif /* !defined(__stack_t_defined) */
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/socket.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/socket.h
new file mode 100644
index 0000000000..dcf60da6fa
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/socket.h
@@ -0,0 +1,336 @@
+/* System-specific socket constants and types. OpenSolaris version.
+ Copyright (C) 1991, 1992, 1994-2001, 2004, 2006, 2007, 2008
+ Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef __BITS_SOCKET_H
+#define __BITS_SOCKET_H
+
+#ifndef _SYS_SOCKET_H
+# error "Never include <bits/socket.h> directly; use <sys/socket.h> instead."
+#endif
+
+#define __need_size_t
+#define __need_NULL
+#include <stddef.h>
+
+#include <limits.h>
+#include <sys/types.h>
+
+#define __SOCKADDR_IN6_EXTRA_FIELDS \
+ __uint32_t __sin6_src_id;
+
+/* Type for length arguments in socket calls. */
+#ifndef __socklen_t_defined
+typedef __socklen_t socklen_t;
+# define __socklen_t_defined
+#endif
+
+/* Types of sockets. */
+enum __socket_type
+{
+ SOCK_STREAM = 2, /* Sequenced, reliable, connection-based
+ byte streams. */
+#define SOCK_STREAM SOCK_STREAM
+ SOCK_DGRAM = 1, /* Connectionless, unreliable datagrams
+ of fixed maximum length. */
+#define SOCK_DGRAM SOCK_DGRAM
+ SOCK_RAW = 4, /* Raw protocol interface. */
+#define SOCK_RAW SOCK_RAW
+ SOCK_RDM = 5, /* Reliably-delivered messages. */
+#define SOCK_RDM SOCK_RDM
+ SOCK_SEQPACKET = 6 /* Sequenced, reliable, connection-based,
+ datagrams of fixed maximum length. */
+#define SOCK_SEQPACKET SOCK_SEQPACKET
+};
+
+/* Protocol families. */
+#define PF_UNSPEC 0 /* Unspecified. */
+#define PF_LOCAL 1 /* Local to host (pipes and file-domain). */
+#define PF_UNIX PF_LOCAL /* POSIX name for PF_LOCAL. */
+#define PF_FILE PF_LOCAL /* Another non-standard name for PF_LOCAL. */
+#define PF_INET 2 /* IP protocol family. */
+#define PF_IMPLINK 3 /* Arpanet imp addresses. */
+#define PF_PUP 4 /* PUP protocols: e.g. BSP. */
+#define PF_CHAOS 5 /* MIT CHAOS protocols. */
+#define PF_NS 6 /* XEROX NS protocols. */
+#define PF_NBS 7 /* NBS protocols. */
+#define PF_ECMA 8 /* European Computer Manufacturers. */
+#define PF_DATAKIT 9 /* Datakit protocols. */
+#define PF_CCITT 10 /* CCITT protocols, X.25 etc. */
+#define PF_SNA 11 /* Linux SNA Project */
+#define PF_DECnet 12 /* Reserved for DECnet project. */
+#define PF_DLI 13 /* Direct data link interface. */
+#define PF_LAT 14 /* LAT. */
+#define PF_HYLINK 15 /* NSC Hyperchannel. */
+#define PF_APPLETALK 16 /* Appletalk DDP. */
+#define PF_NIT 17 /* Network Interface Tap. */
+#define PF_802 18 /* IEEE 802.2, also ISO 8802. */
+#define PF_OSI 19 /* Umbrella for all families used. */
+#define PF_X25 20 /* Reserved for X.25 project. */
+#define PF_OSINET 21 /* AFI = 47, IDI = 4. */
+#define PF_GOSIP 22 /* U.S. Government OSI. */
+#define PF_IPX 23 /* Novell Internet Protocol. */
+#define PF_ROUTE 24 /* Internal Routing Protocol. */
+#define PF_LINK 25 /* Link-layer interface. */
+#define PF_INET6 26 /* IP version 6. */
+#define PF_KEY 27 /* PF_KEY key management API. */
+#define PF_NCA 28 /* NCA socket. */
+#define PF_POLICY 29 /* Security Policy DB socket. */
+#define PF_INET_OFFLOAD 30 /* Sun private; do not use. */
+#define PF_MAX 30 /* For now.. */
+
+/* Address families. */
+#define AF_UNSPEC PF_UNSPEC
+#define AF_UNIX PF_UNIX
+#define AF_LOCAL PF_LOCAL
+#define AF_INET PF_INET
+#define AF_IMPLINK PF_IMPLINK
+#define AF_PUP PF_PUP
+#define AF_CHAOS PF_CHAOS
+#define AF_NS PF_NBS
+#define AF_NBS PF_NBS
+#define AF_ECMA PF_ECMA
+#define AF_DATAKIT PF_DATAKIT
+#define AF_CCITT PF_CCITT
+#define AF_SNA PF_SNA
+#define AF_DECnet PF_DECnet
+#define AF_DLI PF_DLI
+#define AF_LAT PF_LAT
+#define AF_HYLINK PF_HYLINK
+#define AF_APPLETALK PF_APPLETALK
+#define AF_NIT PF_NIT
+#define AF_802 PF_802
+#define AF_X25 PF_X25
+#define AF_OSINET PF_OSINET
+#define AF_GOSIP PF_GOSIP
+#define AF_IPX PF_IPX
+#define AF_ROUTE PF_ROUTE
+#define AF_LINK PF_LINK
+#define AF_INET6 PF_INET6
+#define AF_KEY PF_X25
+#define AF_NCA PF_X25
+#define AF_POLICY PF_POLICY
+#define AF_INET_OFFLOAD PF_INET_OFFLOAD
+#define AF_MAX PF_MAX
+
+/* Socket level values. */
+#define SOL_SOCKET 0xFFFF
+#define SOL_IP 0 /* IPPROTO_IP */
+#define SOL_ICMP 1 /* IPPROTO_ICMP */
+#define SOL_TCP 6 /* IPPROTO_TCP */
+#define SOL_UDP 17 /* IPPROTO_UDP */
+#define SOL_IPV6 41 /* IPPROTO_IPV6 */
+#define SOL_ICMPV6 58 /* IPPROTO_ICMPV6 */
+#define SOL_SCTP 132 /* IPPROTO_SCTP */
+#define SOL_RAW 255 /* IPPROTO_RAW */
+
+/* Maximum queue length specifiable by listen. */
+#define SOMAXCONN 128
+
+/* Get the definition of the macro to define the common sockaddr members. */
+#include <bits/sockaddr.h>
+
+/* Structure describing a generic socket address. */
+struct sockaddr
+ {
+ __SOCKADDR_COMMON (sa_); /* Common data: address family and length. */
+ char sa_data[14]; /* Address data. */
+ };
+
+
+/* Structure large enough to hold any socket address (with the historical
+ exception of AF_UNIX). We reserve 128 bytes. */
+#define _SS_MAXSIZE 256
+#define _SS_ALIGNSIZE (sizeof (sockaddr_maxalign_t))
+typedef double sockaddr_maxalign_t;
+#define _SS_PAD1SIZE (_SS_ALIGNSIZE - sizeof (sa_family_t))
+#define _SS_PAD2SIZE (_SS_MAXSIZE - (sizeof (sa_family_t) + \
+ _SS_PAD1SIZE + _SS_ALIGNSIZE))
+
+struct sockaddr_storage
+ {
+ __SOCKADDR_COMMON (ss_); /* Address family, etc. */
+ char _ss_pad1[_SS_PAD1SIZE];
+ sockaddr_maxalign_t __ss_align; /* Force desired alignment. */
+ char _ss_pad2[_SS_PAD2SIZE];
+ };
+
+
+/* Bits in the FLAGS argument to `send', `recv', et al. */
+enum
+ {
+ MSG_OOB = 0x01, /* Process out-of-band data. */
+#define MSG_OOB MSG_OOB
+ MSG_PEEK = 0x02, /* Peek at incoming messages. */
+#define MSG_PEEK MSG_PEEK
+ MSG_DONTROUTE = 0x04, /* Don't use local routing. */
+#define MSG_DONTROUTE MSG_DONTROUTE
+#ifdef __USE_GNU
+ /* DECnet uses a different name. */
+ MSG_TRYHARD = MSG_DONTROUTE,
+# define MSG_TRYHARD MSG_DONTROUTE
+#endif
+ MSG_EOR = 0x08, /* End of record. */
+#define MSG_EOR MSG_EOR
+ MSG_CTRUNC = 0x10, /* Control data lost before delivery. */
+#define MSG_CTRUNC MSG_CTRUNC
+ MSG_TRUNC = 0x20,
+#define MSG_TRUNC MSG_TRUNC
+ MSG_WAITALL = 0x40, /* Wait for a full request. */
+#define MSG_WAITALL MSG_WAITALL
+ MSG_DONTWAIT = 0x80, /* Nonblocking IO. */
+#define MSG_DONTWAIT MSG_DONTWAIT
+ MSG_NOTIFICATION = 0x100, /* Notification, not data. */
+#define MSG_NOTIFICATION MSG_NOTIFICICATION
+ MSG_XPG4_2 = 0x8000, /* Private: XPG4.2 flag. */
+#define MSG_XPG4_2 MSG_XPG4_2
+
+/* The following are not supported by the OpenSolaris kernel. */
+ MSG_NOSIGNAL = 0x4000, /* Do not generate SIGPIPE. */
+#define MSG_NOSIGNAL MSG_NOSIGNAL
+ };
+
+
+/* Structure describing messages sent by
+ `sendmsg' and received by `recvmsg'. */
+struct msghdr
+ {
+ void *msg_name; /* Address to send to/receive from. */
+ socklen_t msg_namelen; /* Length of address data. */
+
+ struct iovec *msg_iov; /* Vector of data to send/receive into. */
+ size_t msg_iovlen; /* Number of elements in the vector. */
+
+ void *msg_control; /* Ancillary data (eg BSD filedesc passing). */
+ socklen_t msg_controllen; /* Ancillary data buffer length. */
+
+ int msg_flags; /* Flags on received message. */
+ };
+
+/* Structure used for storage of ancillary data object information. */
+struct cmsghdr
+ {
+ socklen_t cmsg_len; /* Length of data in cmsg_data plus length
+ of cmsghdr structure. */
+ int cmsg_level; /* Originating protocol. */
+ int cmsg_type; /* Protocol specific type. */
+ };
+
+/* Ancillary data object manipulation macros. */
+#if defined(__sparc__)
+# define _CMSG_HDR_ALIGNMENT 8
+#else
+# define _CMSG_HDR_ALIGNMENT 4
+#endif
+#define CMSG_ALIGN(len) (((uintptr_t)(len) + _CMSG_HDR_ALIGNMENT - 1) \
+ & ~(_CMSG_HDR_ALIGNMENT - 1))
+#define _CMSG_HDR_ALIGN(x) CMSG_ALIGN(x)
+#define CMSG_DATA(cmsg) ((unsigned char *) CMSG_ALIGN((struct cmsghdr *) (cmsg) + 1))
+#define CMSG_NXTHDR(mhdr, cmsg) __cmsg_nxthdr (mhdr, cmsg)
+#define CMSG_FIRSTHDR(mhdr) \
+ ((size_t) (mhdr)->msg_controllen >= sizeof (struct cmsghdr) \
+ ? (struct cmsghdr *) (mhdr)->msg_control : (struct cmsghdr *) NULL)
+#define CMSG_SPACE(len) (CMSG_ALIGN (len) \
+ + CMSG_ALIGN (sizeof (struct cmsghdr)))
+#define CMSG_LEN(len) (CMSG_ALIGN (sizeof (struct cmsghdr)) + (len))
+
+extern struct cmsghdr *__cmsg_nxthdr (struct msghdr *__mhdr,
+ struct cmsghdr *__cmsg) __THROW;
+#ifdef __USE_EXTERN_INLINES
+# ifndef _EXTERN_INLINE
+# define _EXTERN_INLINE __extern_inline
+# endif
+_EXTERN_INLINE struct cmsghdr *
+__NTH (__cmsg_nxthdr (struct msghdr *__mhdr, struct cmsghdr *__cmsg))
+{
+ if ((size_t) __cmsg->cmsg_len < sizeof (struct cmsghdr))
+ /* The kernel header does this so there may be a reason. */
+ return 0;
+
+ __cmsg = (struct cmsghdr *) ((unsigned char *) __cmsg
+ + CMSG_ALIGN (__cmsg->cmsg_len));
+ if ((unsigned char *) (__cmsg + 1) > ((unsigned char *) __mhdr->msg_control
+ + __mhdr->msg_controllen)
+ || ((unsigned char *) __cmsg + CMSG_ALIGN (__cmsg->cmsg_len)
+ > ((unsigned char *) __mhdr->msg_control + __mhdr->msg_controllen)))
+ /* No more entries. */
+ return 0;
+ return __cmsg;
+}
+#endif /* Use `extern inline'. */
+
+/* Socket options. */
+#define SO_DEBUG 0x0001 /* Turn on debugging info recording. */
+#define SO_ACCEPTCONN 0x0002 /* Socket has had listen(). */
+#define SO_REUSEADDR 0x0004 /* Allow local address reuse. */
+#define SO_KEEPALIVE 0x0008 /* Keep connections alive. */
+#define SO_DONTROUTE 0x0010 /* Just use interface addresses. */
+#define SO_BROADCAST 0x0020 /* Permit sending of broadcast msgs. */
+#define SO_USELOOPBACK 0x0040 /* Bypass hardware when possible. */
+#define SO_LINGER 0x0080 /* Linger on close if data present. */
+#define SO_OOBINLINE 0x0100 /* Leave received OOB data in line. */
+#define SO_DGRAM_ERRIND 0x0200 /* Application wants delayed error. */
+#define SO_RECVUCRED 0x0400 /* Application wants ucred of sender. */
+
+/* Socket options not kept in so_options. */
+#define SO_SNDBUF 0x1001 /* Send buffer size. */
+#define SO_RCVBUF 0x1002 /* Receive buffer size. */
+#define SO_SNDLOWAT 0x1003 /* Send low-water mark. */
+#define SO_RCVLOWAT 0x1004 /* Receive low-water mark. */
+#define SO_SNDTIMEO 0x1005 /* Send timeout. */
+#define SO_RCVTIMEO 0x1006 /* Receive timeout. */
+#define SO_ERROR 0x1007 /* Get error status and clear. */
+#define SO_TYPE 0x1008 /* Get socket type. */
+#define SO_PROTOTYPE 0x1009 /* Get/set protocol type. */
+#define SO_ANON_MLP 0x100a /* Create MLP on anonymous bind. */
+#define SO_MAC_EXEMPT 0x100b /* Allow dominated unlabeled peers. */
+#define SO_DOMAIN 0x100c /* Get socket domain. */
+/* SCM_RIGHTS = 0x1010 */
+#define SO_SECATTR 0x1011 /* Socket's security attributes. */
+/* SCM_UCRED = 0x1012 */
+#define SO_TIMESTAMP 0x1013 /* Sender's ucred. */
+#define SO_ALLZONES 0x1014 /* Bind in all zones. */
+#define SO_EXCLBIND 0x1015 /* Exclusive binding. */
+
+/* Socket level message types. */
+enum
+ {
+ SCM_RIGHTS = 0x1010, /* Transfer file descriptors. */
+#define SCM_RIGHTS SCM_RIGHTS
+ SCM_UCRED = 0x1012,
+#define SCM_UCRED SCM_UCRED
+ SCM_TIMESTAMP = SO_TIMESTAMP
+#define SCM_TIMESTAMP SCM_TIMESTAMP
+ };
+
+/* Structure used to manipulate the SO_LINGER option. */
+struct linger
+ {
+ int l_onoff; /* Nonzero to linger on close. */
+ int l_linger; /* Time to linger. */
+ };
+
+/* Socket versions. */
+#define SOV_STREAM 0 /* Not a socket - just a stream. */
+#define SOV_DEFAULT 1 /* Select based on so_default_version. */
+#define SOV_SOCKSTREAM 2 /* Socket plus streams operations. */
+#define SOV_SOCKBSD 3 /* Socket with no streams operations. */
+#define SOV_XPG4_2 4 /* Xnet socket. */
+
+#endif /* bits/socket.h */
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/stat.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/stat.h
new file mode 100644
index 0000000000..b572984357
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/stat.h
@@ -0,0 +1,230 @@
+/* Copyright (C) 1993, 96, 97, 98, 99, 2000, 2008
+ Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _SYS_STAT_H
+# error "Never include <bits/stat.h> directly; use <sys/stat.h> instead."
+#endif
+
+#include <bits/wordsize.h>
+
+/* Length of array allocated for file system type name. */
+#define _ST_FSTYPSZ 16
+
+/* Structure describing file characteristics. */
+struct stat
+ {
+ __dev_t st_dev;
+#if __WORDSIZE == 32
+ long int st_pad1[3];
+#endif
+#ifndef __USE_FILE_OFFSET64
+ __ino_t st_ino; /* File serial number. */
+#else
+ __ino64_t st_ino; /* File serial number. */
+#endif
+ __mode_t st_mode; /* File mode. */
+ __nlink_t st_nlink; /* Link count. */
+ __uid_t st_uid; /* User ID of the file's owner. */
+ __gid_t st_gid; /* Group ID of the file's group.*/
+ __dev_t st_rdev; /* Device number, if device. */
+#if __WORDSIZE == 32
+ long int st_pad2[2];
+#endif
+#ifndef __USE_FILE_OFFSET64
+ __off_t st_size; /* Size of file, in bytes. */
+#else
+ __off64_t st_size; /* Size of file, in bytes. */
+#endif
+#if __WORDSIZE == 32 && !defined(__USE_FILE_OFFSET64)
+ long int st_pad3;
+#endif
+#ifdef __USE_MISC
+ struct timespec st_atim; /* Time of last access. */
+ struct timespec st_mtim; /* Time of last modification. */
+ struct timespec st_ctim; /* Time of last status change. */
+# define st_atime st_atim.tv_sec /* Backward compatibility. */
+# define st_mtime st_mtim.tv_sec
+# define st_ctime st_ctim.tv_sec
+#else
+ __time_t st_atime; /* Time of last access. */
+ unsigned long int st_atime_usec;
+ __time_t st_mtime; /* Time of last modification. */
+ unsigned long int st_mtime_usec;
+ __time_t st_ctime; /* Time of last status change. */
+ unsigned long int st_ctime_usec;
+#endif
+ __blksize_t st_blksize; /* Optimal block size for I/O. */
+#define _STATBUF_ST_BLKSIZE /* Tell code we have this member. */
+
+#ifndef __USE_FILE_OFFSET64
+ __blkcnt_t st_blocks; /* Number of 512-byte blocks allocated. */
+#else
+ __blkcnt64_t st_blocks; /* Number of 512-byte blocks allocated. */
+#endif
+ char st_fstype[_ST_FSTYPSZ];
+#if __WORDSIZE == 32
+ long int st_pad4[8];
+#endif
+ };
+
+#ifdef _SYSCALL32
+#include <sys/types32.h>
+
+struct stat32
+ {
+ __dev_t st_dev;
+ __int32_t st_pad1[3];
+ __ino_t st_ino;
+ __mode_t st_mode;
+ __nlink_t st_nlink;
+ __uid_t st_uid;
+ __gid_t st_gid;
+ __dev_t st_rdev;
+ __int32_t st_pad2[2];
+ __off_t st_size;
+ __int32_t st_pad3;
+ struct timespec32 st_atim;
+ struct timespec32 st_mtim;
+ struct timespec32 st_ctim;
+ __int32_t st_blksize;
+ __blkcnt_t st_blocks;
+ char st_fstype[_ST_FSTYPSZ];
+ __int32_t st_pad4[8];
+ };
+#endif /* _SYSCALL32 */
+
+#ifdef __USE_LARGEFILE64
+/* struct stat64 has the shape as stat */
+struct stat64
+ {
+ __dev_t st_dev; /* Device */
+#if __WORDSIZE == 32
+ long int st_pad1[3];
+#endif
+ __ino64_t st_ino; /* File serial number */
+ __mode_t st_mode; /* File mode */
+ __nlink_t st_nlink; /* Link count */
+ __uid_t st_uid; /* User ID of the file's owner. */
+ __gid_t st_gid; /* Group ID of the file's group.*/
+ __dev_t st_rdev; /* Device number, if device */
+#if __WORDSIZE == 32
+ long int st_pad2[2];
+#endif
+ __off64_t st_size; /* Size of file, in bytes. */
+#ifdef __USE_MISC
+ struct timespec st_atim; /* Time of last access. */
+ struct timespec st_mtim; /* Time of last modification. */
+ struct timespec st_ctim; /* Time of last status change. */
+# define st_atime st_atim.tv_sec /* Backward compatibility. */
+# define st_mtime st_mtim.tv_sec
+# define st_ctime st_ctim.tv_sec
+#else
+ __time_t st_atime; /* Time of last access */
+ unsigned long int st_atime_usec;
+ __time_t st_mtime; /* Time of last modification */
+ unsigned long int st_mtime_usec;
+ __time_t st_ctime; /* Time of last status change */
+ unsigned long int st_ctime_usec;
+#endif
+ __blksize_t st_blksize;
+ __blkcnt64_t st_blocks;
+ char st_fstype[_ST_FSTYPSZ];
+#if __WORDSIZE == 32
+ long int st_pad4[8];
+#endif
+};
+#endif
+
+#ifdef _SYSCALL32
+
+#include <sys/isa_defs.h>
+
+#if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4
+# pragma pack(4)
+#endif
+
+struct stat64_32
+ {
+ dev32_t st_dev;
+ int32_t st_pad1[3];
+ ino64_t st_ino;
+ mode32_t st_mode;
+ nlink32_t st_nlink;
+ uid32_t st_uid;
+ gid32_t st_gid;
+ dev32_t st_rdev;
+ int32_t st_pad2[2];
+ off64_t st_size;
+ struct timespec32 st_atim;
+ struct timespec32 st_mtim;
+ struct timespec32 st_ctim;
+ int32_t st_blksize;
+ blkcnt64_t st_blocks;
+ char st_fstype[_ST_FSTYPSZ];
+ int32_t st_pad4[8];
+ };
+
+#if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4
+# pragma pack()
+#endif
+
+#endif /* _SYSCALL32 */
+
+/* Tell code we have these members. */
+#define _STATBUF_ST_BLKSIZE
+#define _STATBUF_ST_RDEV
+
+/* Encoding of the file mode. */
+
+#define __S_IFMT 0xF000 /* These bits determine file type. */
+
+/* File types. */
+#define __S_IFDIR 0x4000 /* Directory. */
+#define __S_IFCHR 0x2000 /* Character device. */
+#define __S_IFBLK 0x6000 /* Block device. */
+#define __S_IFREG 0x8000 /* Regular file. */
+#define __S_IFIFO 0x1000 /* FIFO. */
+#define __S_IFLNK 0xA000 /* Symbolic link. */
+#define __S_IFSOCK 0xC000 /* Socket. */
+#define S_IFDOOR 0xD000 /* Door. */
+#define S_IFPORT 0xE000 /* Event port. */
+
+/* POSIX.1b objects. */
+#define __S_TYPEISMQ(buf) (0)
+#define __S_TYPEISSEM(buf) (0)
+#define __S_TYPEISSHM(buf) (0)
+
+/* Protection bits. */
+
+#define __S_ISUID 0x800 /* Set user ID on execution. */
+#define __S_ISGID 0x400 /* Set group ID on execution. */
+#define __S_ISVTX 0x200 /* Save swapped text after use (sticky). */
+#define __S_IREAD 00400 /* Read by owner. */
+#define __S_IWRITE 00200 /* Write by owner. */
+#define __S_IEXEC 00100 /* Execute by owner. */
+
+#define _R3_MKNOD_VER 1 /* SVR3.0 mknod */
+#define _MKNOD_VER 2 /* current version of mknod */
+#define _R3_STAT_VER 1 /* SVR3.0 stat */
+#define _STAT_VER 2 /* current version of stat */
+
+#define S_IAMB 0x01FF
+
+#define S_ISDOOR(mode) (((mode) & 0xF000) == S_IFDOOR)
+#define S_ISPORT(mode) (((mode) & 0xF000) == S_IFPORT)
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/statfs.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/statfs.h
new file mode 100644
index 0000000000..51810ddae4
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/statfs.h
@@ -0,0 +1,68 @@
+/* Copyright (C) 1997, 1998, 2000, 2002, 2003, 2009
+ Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _SYS_STATFS_H
+# error "Never include <bits/statfs.h> directly; use <sys/statfs.h> instead."
+#endif
+
+#include <bits/types.h>
+
+struct statfs
+ {
+ __SWORD_TYPE f_type;
+ __SWORD_TYPE f_bsize;
+#ifndef __USE_FILE_OFFSET64
+ __fsblkcnt_t f_blocks;
+ __fsblkcnt_t f_bfree;
+ __fsblkcnt_t f_bavail;
+ __fsfilcnt_t f_files;
+ __fsfilcnt_t f_ffree;
+#else
+ __fsblkcnt64_t f_blocks;
+ __fsblkcnt64_t f_bfree;
+ __fsblkcnt64_t f_bavail;
+ __fsfilcnt64_t f_files;
+ __fsfilcnt64_t f_ffree;
+#endif
+ __UWORD_TYPE f_fsid;
+ __SWORD_TYPE f_namelen;
+ __SWORD_TYPE f_frsize;
+ __SWORD_TYPE f_spare[5];
+ };
+
+#ifdef __USE_LARGEFILE64
+struct statfs64
+ {
+ __SWORD_TYPE f_type;
+ __SWORD_TYPE f_bsize;
+ __fsblkcnt64_t f_blocks;
+ __fsblkcnt64_t f_bfree;
+ __fsblkcnt64_t f_bavail;
+ __fsfilcnt64_t f_files;
+ __fsfilcnt64_t f_ffree;
+ __UWORD_TYPE f_fsid;
+ __SWORD_TYPE f_namelen;
+ __SWORD_TYPE f_frsize;
+ __SWORD_TYPE f_spare[5];
+ };
+#endif
+
+/* Tell code we have these members. */
+#define _STATFS_F_NAMELEN
+#define _STATFS_F_FRSIZE
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/statvfs.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/statvfs.h
new file mode 100644
index 0000000000..81eb6b9795
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/statvfs.h
@@ -0,0 +1,134 @@
+/* Copyright (C) 1997,1998,2000,2001,2002,2006,2008
+ Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _SYS_STATVFS_H
+# error "Never include <bits/statvfs.h> directly; use <sys/statvfs.h> instead."
+#endif
+
+#include <bits/types.h> /* For __fsblkcnt_t and __fsfilcnt_t. */
+#include <bits/wordsize.h>
+#include <features.h>
+
+#define _FSTYPSZ 16
+#ifdef __USE_MISC
+# define FSTYPSZ _FSTYPSZ
+#endif
+
+typedef struct statvfs
+{
+ unsigned long int f_bsize;
+ unsigned long int f_frsize;
+#ifdef __USE_FILE_OFFSET64
+ __fsblkcnt64_t f_blocks;
+ __fsblkcnt64_t f_bfree;
+ __fsblkcnt64_t f_bavail;
+ __fsfilcnt64_t f_files;
+ __fsfilcnt64_t f_ffree;
+ __fsfilcnt64_t f_favail;
+#else
+ __fsblkcnt_t f_blocks;
+ __fsblkcnt_t f_bfree;
+ __fsblkcnt_t f_bavail;
+ __fsfilcnt_t f_files;
+ __fsfilcnt_t f_ffree;
+ __fsfilcnt_t f_favail;
+#endif
+ unsigned long int f_fsid;
+ char f_basetype[_FSTYPSZ];
+ unsigned long int f_flag;
+ unsigned long int f_namemax;
+ char f_fstr[32];
+#if __WORDSIZE == 32
+ unsigned long f_filler[16];
+#endif
+} statvfs_t;
+
+#ifdef _SYSCALL32
+typedef struct statvfs32
+{
+ __uint32_t f_bsize;
+ __uint32_t f_frsize;
+ __fsblkcnt_t f_blocks;
+ __fsblkcnt_t f_bfree;
+ __fsblkcnt_t f_bavail;
+ __fsfilcnt_t f_files;
+ __fsfilcnt_t f_ffree;
+ __fsfilcnt_t f_favail;
+ __uint32_t f_fsid;
+ char f_basetype[_FSTYPSZ];
+ __uint32_t f_flag;
+ __uint32_t f_namemax;
+ char f_fstr[32];
+ __uint32_t f_filler[16];
+} statvfs32_t;
+#endif
+
+#ifdef __USE_LARGEFILE64
+typedef struct statvfs64
+{
+ unsigned long int f_bsize;
+ unsigned long int f_frsize;
+ __fsblkcnt64_t f_blocks;
+ __fsblkcnt64_t f_bfree;
+ __fsblkcnt64_t f_bavail;
+ __fsfilcnt64_t f_files;
+ __fsfilcnt64_t f_ffree;
+ __fsfilcnt64_t f_favail;
+ unsigned long int f_fsid;
+ char f_basetype[_FSTYPSZ];
+ unsigned long int f_flag;
+ unsigned long int f_namemax;
+ char f_fstr[32];
+#if __WORDSIZE == 32
+ unsigned long f_filler[16];
+#endif
+} statvfs64_t;
+#endif
+
+#ifdef _SYSCALL32
+typedef struct statvfs64_32
+{
+ __uint32_t f_bsize;
+ __uint32_t f_frsize;
+ __fsblkcnt64_t f_blocks;
+ __fsblkcnt64_t f_bfree;
+ __fsblkcnt64_t f_bavail;
+ __fsfilcnt64_t f_files;
+ __fsfilcnt64_t f_ffree;
+ __fsfilcnt64_t f_favail;
+ __uint32_t f_fsid;
+ char f_basetype[_FSTYPSZ];
+ __uint32_t f_flag;
+ __uint32_t f_namemax;
+ char f_fstr[32];
+ __uint32_t f_filler[16];
+} statvfs64_32_t;
+#endif
+
+/* Definitions for the flag in `f_flag'. These definitions should be
+ kept in sync with the definitions in <sys/mount.h>. */
+enum
+{
+ ST_RDONLY = 1, /* Mount read-only. */
+#define ST_RDONLY ST_RDONLY
+ ST_NOSUID = 2, /* Ignore suid and sgid bits. */
+#define ST_NOSUID ST_NOSUID
+ ST_NOTRUNC = 4 /* Don't truncate long files. */
+#define ST_NOTRUNC ST_NOTRUNC
+};
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/stropts.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/stropts.h
new file mode 100644
index 0000000000..8b198e88cb
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/stropts.h
@@ -0,0 +1,256 @@
+/* Copyright (C) 1998, 1999, 2000, 2002, 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _STROPTS_H
+# error "Never include <bits/stropts.h> directly; use <stropts.h> instead."
+#endif
+
+#ifndef _BITS_STROPTS_H
+#define _BITS_STROPTS_H 1
+
+#include <bits/types.h>
+#include <features.h>
+
+/* Macros used as `request' argument to `ioctl'. */
+#define __SID ('S' << 8)
+
+#define I_NREAD (__SID | 1) /* Counts the number of data bytes in the data
+ block in the first message. */
+#define I_PUSH (__SID | 2) /* Push STREAMS module onto top of the current
+ STREAM, just below the STREAM head. */
+#define I_POP (__SID | 3) /* Remove STREAMS module from just below the
+ STREAM head. */
+#define I_LOOK (__SID | 4) /* Retrieve the name of the module just below
+ the STREAM head and place it in a character
+ string. */
+#define I_FLUSH (__SID | 5) /* Flush all input and/or output. */
+#define I_SRDOPT (__SID | 6) /* Sets the read mode. */
+#define I_GRDOPT (__SID | 7) /* Returns the current read mode setting. */
+#define I_STR (__SID | 8) /* Construct an internal STREAMS `ioctl'
+ message and send that message downstream. */
+#define I_SETSIG (__SID | 9) /* Inform the STREAM head that the process
+ wants the SIGPOLL signal issued. */
+#define I_GETSIG (__SID |10) /* Return the events for which the calling
+ process is currently registered to be sent
+ a SIGPOLL signal. */
+#define I_FIND (__SID |11) /* Compares the names of all modules currently
+ present in the STREAM to the name pointed to
+ by `arg'. */
+#define I_LINK (__SID |12) /* Connect two STREAMs. */
+#define I_UNLINK (__SID |13) /* Disconnects the two STREAMs. */
+#define I_PEEK (__SID |15) /* Allows a process to retrieve the information
+ in the first message on the STREAM head read
+ queue without taking the message off the
+ queue. */
+#define I_FDINSERT (__SID |16) /* Create a message from the specified
+ buffer(s), adds information about another
+ STREAM, and send the message downstream. */
+#define I_SENDFD (__SID |17) /* Requests the STREAM associated with `fildes'
+ to send a message, containing a file
+ pointer, to the STREAM head at the other end
+ of a STREAMS pipe. */
+#define I_RECVFD (__SID |14) /* Non-EFT definition. */
+#define I_SWROPT (__SID |19) /* Set the write mode. */
+#define I_GWROPT (__SID |20) /* Return the current write mode setting. */
+#define I_LIST (__SID |21) /* List all the module names on the STREAM, up
+ to and including the topmost driver name. */
+#define I_PLINK (__SID |22) /* Connect two STREAMs with a persistent
+ link. */
+#define I_PUNLINK (__SID |23) /* Disconnect the two STREAMs that were
+ connected with a persistent link. */
+#define I_FLUSHBAND (__SID |28) /* Flush only band specified. */
+#define I_CKBAND (__SID |29) /* Check if the message of a given priority
+ band exists on the STREAM head read
+ queue. */
+#define I_GETBAND (__SID |30) /* Return the priority band of the first
+ message on the STREAM head read queue. */
+#define I_ATMARK (__SID |31) /* See if the current message on the STREAM
+ head read queue is "marked" by some module
+ downstream. */
+#define I_SETCLTIME (__SID |32) /* Set the time the STREAM head will delay when
+ a STREAM is closing and there is data on
+ the write queues. */
+#define I_GETCLTIME (__SID |33) /* Get current value for closing timeout. */
+#define I_CANPUT (__SID |34) /* Check if a certain band is writable. */
+
+#define __I_PUSH_NOCTTY (__SID |047)
+
+#define _I_MUXID2FD (__SID |056)
+#define _I_INSERT (__SID |057)
+#define _I_REMOVE (__SID |060)
+#define _I_GETPEERCRED (__SID |061)
+#define _I_PLINK_LH (__SID |062)
+#define _I_CMD (__SID |063)
+
+
+/* Used in `I_LOOK' request. */
+#define FMNAMESZ 8 /* compatibility w/UnixWare/Solaris. */
+
+/* Flush options. */
+#define FLUSHR 0x01 /* Flush read queues. */
+#define FLUSHW 0x02 /* Flush write queues. */
+#define FLUSHRW 0x03 /* Flush read and write queues. */
+#ifdef __USE_GNU
+# define FLUSHBAND 0x04 /* Flush only specified band. */
+#endif
+
+/* Possible arguments for `I_SETSIG'. */
+#define S_INPUT 0x0001 /* A message, other than a high-priority
+ message, has arrived. */
+#define S_HIPRI 0x0002 /* A high-priority message is present. */
+#define S_OUTPUT 0x0004 /* The write queue for normal data is no longer
+ full. */
+#define S_MSG 0x0008 /* A STREAMS signal message that contains the
+ SIGPOLL signal reaches the front of the
+ STREAM head read queue. */
+#define S_ERROR 0x0010 /* Notification of an error condition. */
+#define S_HANGUP 0x0020 /* Notification of a hangup. */
+#define S_RDNORM 0x0040 /* A normal message has arrived. */
+#define S_WRNORM S_OUTPUT
+#define S_RDBAND 0x0080 /* A message with a non-zero priority has
+ arrived. */
+#define S_WRBAND 0x0100 /* The write queue for a non-zero priority
+ band is no longer full. */
+#define S_BANDURG 0x0200 /* When used in conjunction with S_RDBAND,
+ SIGURG is generated instead of SIGPOLL when
+ a priority message reaches the front of the
+ STREAM head read queue. */
+
+/* Option for `I_PEEK'. */
+#define RS_HIPRI 0x01 /* Only look for high-priority messages. */
+
+/* Options for `I_SRDOPT'. */
+#define RNORM 0x0000 /* Byte-STREAM mode, the default. */
+#define RMSGD 0x0001 /* Message-discard mode. */
+#define RMSGN 0x0002 /* Message-nondiscard mode. */
+#define RPROTDAT 0x0004 /* Deliver the control part of a message as
+ data. */
+#define RPROTDIS 0x0008 /* Discard the control part of a message,
+ delivering any data part. */
+#define RPROTNORM 0x0010 /* Fail `read' with EBADMSG if a message
+ containing a control part is at the front
+ of the STREAM head read queue. */
+#ifdef __USE_GNU
+# define RPROTMASK 0x001C /* The RPROT bits */
+#endif
+
+/* Possible mode for `I_SWROPT'. */
+#define SNDZERO 0x001 /* Send a zero-length message downstream when a
+ `write' of 0 bytes occurs. */
+#ifdef __USE_GNU
+# define SNDPIPE 0x002 /* Send SIGPIPE on write and putmsg if
+ sd_werror is set. */
+#endif
+
+/* Arguments for `I_ATMARK'. */
+#define ANYMARK 0x01 /* Check if the message is marked. */
+#define LASTMARK 0x02 /* Check if the message is the last one marked
+ on the queue. */
+
+/* Argument for `I_UNLINK'. */
+#ifdef __USE_GNU
+# define MUXID_ALL (-1) /* Unlink all STREAMs linked to the STREAM
+ associated with `fildes'. */
+#endif
+
+
+/* Macros for `getmsg', `getpmsg', `putmsg' and `putpmsg'. */
+#define MSG_HIPRI 0x01 /* Send/receive high priority message. */
+#define MSG_ANY 0x02 /* Receive any message. */
+#define MSG_BAND 0x04 /* Receive message from specified band. */
+
+/* Values returned by getmsg and getpmsg */
+#define MORECTL 1 /* More control information is left in
+ message. */
+#define MOREDATA 2 /* More data is left in message. */
+
+#ifdef __USE_MISC
+# define MSG_XPG4 0x08
+#endif
+
+
+/* Structure used for the I_FLUSHBAND ioctl on streams. */
+struct bandinfo
+ {
+ unsigned char bi_pri;
+ int bi_flag;
+ };
+
+struct strbuf
+ {
+ int maxlen; /* Maximum buffer length. */
+ int len; /* Length of data. */
+ char *buf; /* Pointer to buffer. */
+ };
+
+struct strpeek
+ {
+ struct strbuf ctlbuf;
+ struct strbuf databuf;
+ t_uscalar_t flags; /* UnixWare/Solaris compatibility. */
+ };
+
+struct strfdinsert
+ {
+ struct strbuf ctlbuf;
+ struct strbuf databuf;
+ t_uscalar_t flags; /* UnixWare/Solaris compatibility. */
+ int fildes;
+ int offset;
+ };
+
+struct strioctl
+ {
+ int ic_cmd;
+ int ic_timout;
+ int ic_len;
+ char *ic_dp;
+ };
+
+struct strrecvfd
+ {
+ int fd;
+ uid_t uid;
+ gid_t gid;
+ char __fill[8]; /* UnixWare/Solaris compatibility */
+ };
+
+
+struct str_mlist
+ {
+ char l_name[FMNAMESZ + 1];
+ };
+
+struct str_list
+ {
+ int sl_nmods;
+ struct str_mlist *sl_modlist;
+ };
+
+#ifdef __USE_MISC
+
+struct strmodconf
+ {
+ int pos;
+ __caddr_t mod_name;
+ };
+
+# define INFTIM -1
+#endif
+
+#endif /* bits/stropts.h */
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/syslog-path.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/syslog-path.h
new file mode 100644
index 0000000000..3e9f79b7ff
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/syslog-path.h
@@ -0,0 +1,29 @@
+/* <bits/syslog-path.h> -- _PATH_LOG definition
+ Copyright (C) 2006 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _SYS_SYSLOG_H
+# error "Never include this file directly. Use <sys/syslog.h> instead"
+#endif
+
+#ifndef _BITS_SYSLOG_PATH_H
+#define _BITS_SYSLOG_PATH_H 1
+
+#define _PATH_LOG "/etc/.log"
+
+#endif /* bits/syslog-path.h */
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/termios.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/termios.h
new file mode 100644
index 0000000000..49e030e888
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/termios.h
@@ -0,0 +1,241 @@
+/* termios type and macro definitions. OpenSolaris version.
+ Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2003, 2005, 2008
+ Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _TERMIOS_H
+# error "Never include <bits/termios.h> directly; use <termios.h> instead."
+#endif
+
+typedef unsigned char cc_t;
+typedef unsigned int speed_t;
+typedef unsigned int tcflag_t;
+
+#define NCCS 19
+struct termios
+ {
+ tcflag_t c_iflag; /* input mode flags */
+ tcflag_t c_oflag; /* output mode flags */
+ tcflag_t c_cflag; /* control mode flags */
+ tcflag_t c_lflag; /* line discipline mode flags */
+ cc_t c_cc[NCCS]; /* control characters */
+ };
+
+/* c_cc characters */
+#define VINTR 0
+#define VQUIT 1
+#define VERASE 2
+#define VKILL 3
+#define VEOF 4
+#define VEOL 5
+#define VEOL2 6
+#define VMIN 4
+#define VTIME 5
+#define VSWTCH 7
+#define VSWTC VSWTCH
+#define VSTART 8
+#define VSTOP 9
+#define VSUSP 10
+#define VDSUSP 11
+#define VREPRINT 12
+#define VDISCARD 13
+#define VWERASE 14
+#define VLNEXT 15
+
+/* c_iflag bits */
+#define IGNBRK 0000001
+#define BRKINT 0000002
+#define IGNPAR 0000004
+#define PARMRK 0000010
+#define INPCK 0000020
+#define ISTRIP 0000040
+#define INLCR 0000100
+#define IGNCR 0000200
+#define ICRNL 0000400
+#define IUCLC 0001000
+#define IXON 0002000
+#define IXANY 0004000
+#define IXOFF 0010000
+#define IMAXBEL 0020000
+#define DOSMODE 0100000
+
+/* c_oflag bits */
+#define OPOST 0000001
+#define OLCUC 0000002
+#define ONLCR 0000004
+#define OCRNL 0000010
+#define ONOCR 0000020
+#define ONLRET 0000040
+#define OFILL 0000100
+#define OFDEL 0000200
+#if defined __USE_MISC || defined __USE_XOPEN
+# define NLDLY 0000400
+# define NL0 0000000
+# define NL1 0000400
+# define CRDLY 0003000
+# define CR0 0000000
+# define CR1 0001000
+# define CR2 0002000
+# define CR3 0003000
+# define TABDLY 0014000
+# define TAB0 0000000
+# define TAB1 0004000
+# define TAB2 0010000
+# define TAB3 0014000
+# define BSDLY 0020000
+# define BS0 0000000
+# define BS1 0020000
+# define FFDLY 0100000
+# define FF0 0000000
+# define FF1 0100000
+#endif
+
+#define VTDLY 0040000
+#define VT0 0000000
+#define VT1 0040000
+
+#ifdef __USE_MISC
+# define XTABS 0014000
+#endif
+
+#ifdef __USE_MISC
+# define PAGEOUT 0200000
+# define WRAP 0400000
+#endif
+
+/* c_cflag bit meaning */
+#if defined(__USE_MISC)
+# define CBAUD 0000017
+#endif
+#define B0 0000000 /* hang up */
+#define B50 0000001
+#define B75 0000002
+#define B110 0000003
+#define B134 0000004
+#define B150 0000005
+#define B200 0000006
+#define B300 0000007
+#define B600 0000010
+#define B1200 0000011
+#define B1800 0000012
+#define B2400 0000013
+#define B4800 0000014
+#define B9600 0000015
+#define B19200 0000016
+#define B38400 0000017
+#define B57600 0000020
+#define B76800 0000021
+#define B115200 0000022
+#define B153600 0000023
+#define B230400 0000024
+#define B307200 0000025
+#define B460800 0000026
+#define __MAX_BAUD B460800
+#define CSIZE 0000060
+#define CS5 0000000
+#define CS6 0000020
+#define CS7 0000040
+#define CS8 0000060
+#define CSTOPB 0000100
+#define CREAD 0000200
+#define PARENB 0000400
+#define PARODD 0001000
+#define HUPCL 0002000
+#define CLOCAL 0004000
+#ifdef __USE_MISC
+# define RCV1EN 0010000
+# define XMT1EN 0020000
+# define LOBLK 0040000
+# define XCLUDE 0100000
+# define CRTSXOFF 010000000000
+# define CRTSCTS 020000000000
+# define CRTSCTS 020000000000
+# define CIBAUD 03600000
+# define PAREXT 04000000
+# define CBAUDEXT 010000000
+# define CIBAUDEXT 020000000
+# define CRTS_IFLOW 010000000000
+# define CCTS_OFLOW 020000000000
+#endif
+
+/* c_lflag bits */
+#define ISIG 0000001
+#define ICANON 0000002
+#if defined __USE_MISC || defined __USE_XOPEN
+# define XCASE 0000004
+#endif
+#define ECHO 0000010
+#define ECHOE 0000020
+#define ECHOK 0000040
+#define ECHONL 0000100
+#define NOFLSH 0000200
+#define TOSTOP 0000400
+#ifdef __USE_MISC
+# define ECHOCTL 0001000
+# define ECHOPRT 0002000
+# define ECHOKE 0004000
+# define DEFECHO 0010000
+# define FLUSHO 0020000
+# define PENDIN 0040000
+#endif
+#define IEXTEN 0100000
+
+/* tcflow() and TCXONC use these */
+#define TCOOFF 0
+#define TCOON 1
+#define TCIOFF 2
+#define TCION 3
+
+/* tcflush() and TCFLSH use these */
+#define TCIFLUSH 0
+#define TCOFLUSH 1
+#define TCIOFLUSH 2
+
+/* tcsetattr uses these */
+#ifndef _TIOC
+# define _TIOC ('T'<<8)
+#endif
+#define TCSANOW (_TIOC|14)
+#define TCSADRAIN (_TIOC|15)
+#define TCSAFLUSH (_TIOC|16)
+
+
+#define _IOT_termios /* Hurd ioctl type field. */ \
+ _IOT (_IOTS (cflag_t), 4, _IOTS (cc_t), NCCS, _IOTS (speed_t), 2)
+
+#define LDIOC ('D'<<8)
+#define LDOPEN (LDIOC|0)
+#define LDCLOSE (LDIOC|1)
+#define LDCHG (LDIOC|2)
+#define LDGETT (LDIOC|8)
+#define LDSETT (LDIOC|9)
+#define LDSMAP (LDIOC|110)
+#define LDGMAP (LDIOC|111)
+#define LDNMAP (LDIOC|112)
+#define LDEMAP (LDIOC|113)
+#define LDDMAP (LDIOC|114)
+
+#define DIOC ('d'<<8)
+#define DIOCGETP (DIOC|8)
+#define DIOCSETP (DIOC|9)
+
+#define FIORDCHK (('f'<<8)|3)
+
+#define CESC '\\'
+#define CNUL 0
+#define CDEL 0377
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/time.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/time.h
new file mode 100644
index 0000000000..fd39a74b69
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/time.h
@@ -0,0 +1,207 @@
+/* System-dependent timing definitions. OpenSolaris version.
+ Copyright (C) 1996,1997,1999-2002,2003,2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+/*
+ * Never include this file directly; use <time.h> instead.
+ */
+
+#ifndef __need_timeval
+# ifndef _BITS_TIME_H
+# define _BITS_TIME_H 1
+
+/* ISO/IEC 9899:1990 7.12.1: <time.h>
+ The macro `CLOCKS_PER_SEC' is the number per second of the value
+ returned by the `clock' function. */
+/* CAE XSH, Issue 4, Version 2: <time.h>
+ The value of CLOCKS_PER_SEC is required to be 1 million on all
+ XSI-conformant systems. */
+# define CLOCKS_PER_SEC 1000000l
+
+# if !defined __STRICT_ANSI__ && !defined __USE_XOPEN2K
+/* Even though CLOCKS_PER_SEC has such a strange value CLK_TCK
+ presents the real value for clock ticks per second for the system. */
+# include <bits/types.h>
+extern long int __sysconf (int);
+# define CLK_TCK ((__clock_t) __sysconf (2)) /* 2 is _SC_CLK_TCK */
+# endif
+
+# ifdef __USE_POSIX199309
+
+/* Thread-specific userland-only CPU-time clock. */
+# define CLOCK_VIRTUAL 1
+/* Thread-specific CPU-time clock. */
+# define CLOCK_THREAD_CPUTIME_ID 2
+/* Identifier for system-wide realtime clock. */
+# define CLOCK_REALTIME 3
+/* Monotonic system-wide clock. */
+# define CLOCK_MONOTONIC 4
+/* High-resolution timer from the CPU. */
+# define CLOCK_PROCESS_CPUTIME_ID 5
+/* OpenSolaris defines these. */
+# define __CLOCK_REALTIME0 0
+# define CLOCK_HIGHRES CLOCK_MONOTONIC
+# define CLOCK_PROF CLOCK_THREAD_CPUTIME_ID
+
+/* Flag to indicate time is relative. */
+# define TIMER_RELTIME 0
+/* Flag to indicate time is absolute. */
+# define TIMER_ABSTIME 1
+
+# endif
+
+# endif /* bits/time.h */
+#endif
+
+#if defined (__need_itimerval) && !defined (__need_timeval)
+# define __need_timeval
+#endif
+
+#ifdef __need_timeval
+# undef __need_timeval
+# ifndef _STRUCT_TIMEVAL
+# define _STRUCT_TIMEVAL 1
+# include <bits/types.h>
+
+/* A time value that is accurate to the nearest
+ microsecond but also has a range of years. */
+struct timeval
+ {
+ __time_t tv_sec; /* Seconds. */
+ __suseconds_t tv_usec; /* Microseconds. */
+ };
+
+
+
+# endif /* struct timeval */
+#endif /* need timeval */
+
+# if defined (__need_itimerval) && !defined (__itimerval_defined)
+struct itimerval
+ {
+ /* Value to put into `it_value' when the timer expires. */
+ struct timeval it_interval;
+ /* Time to the next timer expiration. */
+ struct timeval it_value;
+ };
+# define __itimerval_defined
+# undef __need_itimerval
+# endif
+
+#if !defined (__time_misc_defined) && defined (__USE_MISC)
+
+typedef struct timespec timespec_t;
+typedef struct timespec timestruc_t;
+typedef struct itimerspec itimerspec_t;
+typedef struct tm tm_t;
+
+# define SEC 1
+# define MILLISEC 1000
+# define MICROSEC 1000000
+# define NANOSEC 1000000000
+
+# include <bits/types.h>
+
+__BEGIN_DECLS
+
+extern int cftime (char *, const char *, const __time_t *) __THROW;
+extern int ascftime (char *, const char *, const struct tm *) __THROW;
+
+__END_DECLS
+
+# define __time_misc_defined
+
+#endif /* __time_misc_defined */
+
+#ifdef _SYSCALL32
+
+# include <sys/types32.h>
+
+# ifndef __time32_misc_defined
+
+# define TIMEVAL32_TO_TIMEVAL(tv, tv32) \
+{ \
+ (tv)->tv_sec = (time_t)(tv32)->tv_sec; \
+ (tv)->tv_usec = (tv32)->tv_usec; \
+}
+
+# define TIMEVAL_TO_TIMEVAL32(tv32, tv) \
+{ \
+ (tv32)->tv_sec = (time32_t)(tv)->tv_sec; \
+ (tv32)->tv_usec = (tv)->tv_usec; \
+}
+
+# define TIMESPEC32_TO_TIMESPEC(ts, ts32) \
+ { \
+ (ts)->tv_sec = (time_t)(ts32)->tv_sec; \
+ (ts)->tv_nsec = (ts32)->tv_nsec; \
+ }
+
+# define TIMESPEC_TO_TIMESPEC32(ts32, ts) \
+ { \
+ (ts32)->tv_sec = (time32_t)(ts)->tv_sec; \
+ (ts32)->tv_nsec = (ts)->tv_nsec; \
+ }
+
+# define TIME32_MAX INT32_MAX
+# define TIME32_MIN INT32_MIN
+
+# define TIMESPEC_OVERFLOW(ts) \
+ ((ts)->tv_sec < TIME32_MIN || (ts)->tv_sec > TIME32_MAX)
+
+# define __time32_misc_defined
+# endif /* __time32_misc_defined */
+
+# if defined (_SYS_TIME_H) && !defined (__itimerval32_defined)
+struct itimerval32
+ {
+ struct timeval32 it_interval;
+ struct timeval32 it_value;
+ };
+
+# define ITIMERVAL32_TO_ITIMERVAL(itv, itv32) \
+{ \
+ TIMEVAL32_TO_TIMEVAL(&(itv)->it_interval, &(itv32)->it_interval); \
+ TIMEVAL32_TO_TIMEVAL(&(itv)->it_value, &(itv32)->it_value); \
+}
+
+# define ITIMERVAL_TO_ITIMERVAL32(itv32, itv) \
+{ \
+ TIMEVAL_TO_TIMEVAL32(&(itv32)->it_interval, &(itv)->it_interval); \
+ TIMEVAL_TO_TIMEVAL32(&(itv32)->it_value, &(itv)->it_value); \
+}
+
+# define ITIMERVAL_OVERFLOW(itv) \
+ (TIMEVAL_OVERFLOW(&(itv)->it_interval) || \
+ TIMEVAL_OVERFLOW(&(itv)->it_value))
+
+# define __itimerval32_defined
+# endif
+
+# if defined (_TIME_H) && !defined (__tms32_defined)
+struct tms32
+ {
+ clock32_t tms_utime;
+ clock32_t tms_stime;
+ clock32_t tms_cutime;
+ clock32_t tms_cstime;
+ };
+# define __tms32_defined
+# endif
+
+#endif /* _SYSCALL32 */
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/types.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/types.h
new file mode 100644
index 0000000000..f2dec909f3
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/types.h
@@ -0,0 +1,350 @@
+/* bits/types.h -- definitions of __*_t types underlying *_t types.
+ Copyright (C) 2002, 2003, 2004, 2005, 2007, 2008
+ Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+/*
+ * Never include this file directly; use <sys/types.h> instead.
+ */
+
+#ifndef _BITS_TYPES_H
+#define _BITS_TYPES_H 1
+
+#include <bits/wordsize.h>
+
+/* Convenience types. */
+typedef unsigned char __u_char;
+typedef unsigned short int __u_short;
+typedef unsigned int __u_int;
+typedef unsigned long int __u_long;
+
+/* Fixed-size types, underlying types depend on word size and compiler. */
+typedef signed char __int8_t;
+typedef unsigned char __uint8_t;
+typedef signed short int __int16_t;
+typedef unsigned short int __uint16_t;
+typedef signed int __int32_t;
+typedef unsigned int __uint32_t;
+#if __WORDSIZE == 64
+typedef signed long int __int64_t;
+typedef unsigned long int __uint64_t;
+#elif defined __GLIBC_HAVE_LONG_LONG
+__extension__ typedef signed long long int __int64_t;
+__extension__ typedef unsigned long long int __uint64_t;
+#endif
+
+/* quad_t is also 64 bits. */
+#if __WORDSIZE == 64
+typedef long int __quad_t;
+typedef unsigned long int __u_quad_t;
+#elif defined __GLIBC_HAVE_LONG_LONG
+__extension__ typedef long long int __quad_t;
+__extension__ typedef unsigned long long int __u_quad_t;
+#else
+typedef struct
+{
+ long __val[2];
+} __quad_t;
+typedef struct
+{
+ __u_long __val[2];
+} __u_quad_t;
+#endif
+
+
+/* The machine-dependent file <bits/typesizes.h> defines __*_T_TYPE
+ macros for each of the OS types we define below. The definitions
+ of those macros must use the following macros for underlying types.
+ We define __S<SIZE>_TYPE and __U<SIZE>_TYPE for the signed and unsigned
+ variants of each of the following integer types on this machine.
+
+ 16 -- "natural" 16-bit type (always short)
+ 32 -- "natural" 32-bit type (always int)
+ 64 -- "natural" 64-bit type (long or long long)
+ LONG32 -- 32-bit type, traditionally long
+ QUAD -- 64-bit type, always long long
+ WORD -- natural type of __WORDSIZE bits (int or long)
+ LONGWORD -- type of __WORDSIZE bits, traditionally long
+
+ We distinguish WORD/LONGWORD, 32/LONG32, and 64/QUAD so that the
+ conventional uses of `long' or `long long' type modifiers match the
+ types we define, even when a less-adorned type would be the same size.
+ This matters for (somewhat) portably writing printf/scanf formats for
+ these types, where using the appropriate l or ll format modifiers can
+ make the typedefs and the formats match up across all GNU platforms. If
+ we used `long' when it's 64 bits where `long long' is expected, then the
+ compiler would warn about the formats not matching the argument types,
+ and the programmer changing them to shut up the compiler would break the
+ program's portability.
+
+ Here we assume what is presently the case in all the GCC configurations
+ we support: long long is always 64 bits, long is always word/address size,
+ and int is always 32 bits. */
+
+#define __S16_TYPE short int
+#define __U16_TYPE unsigned short int
+#define __S32_TYPE int
+#define __U32_TYPE unsigned int
+#define __SLONGWORD_TYPE long int
+#define __ULONGWORD_TYPE unsigned long int
+#if __WORDSIZE == 32
+# define __SQUAD_TYPE __quad_t
+# define __UQUAD_TYPE __u_quad_t
+# define __SWORD_TYPE int
+# define __UWORD_TYPE unsigned int
+# define __SLONG32_TYPE long int
+# define __ULONG32_TYPE unsigned long int
+# define __S64_TYPE __quad_t
+# define __U64_TYPE __u_quad_t
+/* We want __extension__ before typedef's that use nonstandard base types
+ such as `long long' in C89 mode. */
+# define __STD_TYPE __extension__ typedef
+#elif __WORDSIZE == 64
+# define __SQUAD_TYPE long int
+# define __UQUAD_TYPE unsigned long int
+# define __SWORD_TYPE long int
+# define __UWORD_TYPE unsigned long int
+# define __SLONG32_TYPE int
+# define __ULONG32_TYPE unsigned int
+# define __S64_TYPE long int
+# define __U64_TYPE unsigned long int
+/* No need to mark the typedef with __extension__. */
+# define __STD_TYPE typedef
+#else
+# error
+#endif
+#include <bits/typesizes.h> /* Defines __*_T_TYPE macros. */
+
+
+__STD_TYPE __DEV_T_TYPE __dev_t; /* Type of device numbers. */
+__STD_TYPE __UID_T_TYPE __uid_t; /* Type of user identifications. */
+__STD_TYPE __GID_T_TYPE __gid_t; /* Type of group identifications. */
+__STD_TYPE __INO_T_TYPE __ino_t; /* Type of file serial numbers. */
+__STD_TYPE __INO64_T_TYPE __ino64_t; /* Type of file serial numbers (LFS).*/
+__STD_TYPE __MODE_T_TYPE __mode_t; /* Type of file attribute bitmasks. */
+__STD_TYPE __NLINK_T_TYPE __nlink_t; /* Type of file link counts. */
+__STD_TYPE __OFF_T_TYPE __off_t; /* Type of file sizes and offsets. */
+__STD_TYPE __OFF64_T_TYPE __off64_t; /* Type of file sizes and offsets (LFS). */
+__STD_TYPE __PID_T_TYPE __pid_t; /* Type of process identifications. */
+__STD_TYPE __FSID_T_TYPE __fsid_t; /* Type of file system IDs. */
+__STD_TYPE __CLOCK_T_TYPE __clock_t; /* Type of CPU usage counts. */
+__STD_TYPE __RLIM_T_TYPE __rlim_t; /* Type for resource measurement. */
+__STD_TYPE __RLIM64_T_TYPE __rlim64_t; /* Type for resource measurement (LFS). */
+__STD_TYPE __ID_T_TYPE __id_t; /* General type for IDs. */
+__STD_TYPE __TIME_T_TYPE __time_t; /* Seconds since the Epoch. */
+__STD_TYPE __USECONDS_T_TYPE __useconds_t; /* Count of microseconds. */
+__STD_TYPE __SUSECONDS_T_TYPE __suseconds_t; /* Signed count of microseconds. */
+
+__STD_TYPE __DADDR_T_TYPE __daddr_t; /* The type of a disk address. */
+__STD_TYPE __SWBLK_T_TYPE __swblk_t; /* Type of a swap block maybe? */
+__STD_TYPE __KEY_T_TYPE __key_t; /* Type of an IPC key. */
+
+/* Clock ID used in clock and timer functions. */
+__STD_TYPE __CLOCKID_T_TYPE __clockid_t;
+
+/* Timer ID returned by `timer_create'. */
+__STD_TYPE __TIMER_T_TYPE __timer_t;
+
+/* Type to represent block size. */
+__STD_TYPE __BLKSIZE_T_TYPE __blksize_t;
+
+/* Types from the Large File Support interface. */
+
+/* Type to count number of disk blocks. */
+__STD_TYPE __BLKCNT_T_TYPE __blkcnt_t;
+__STD_TYPE __BLKCNT64_T_TYPE __blkcnt64_t;
+
+/* Type to count file system blocks. */
+__STD_TYPE __FSBLKCNT_T_TYPE __fsblkcnt_t;
+__STD_TYPE __FSBLKCNT64_T_TYPE __fsblkcnt64_t;
+
+/* Type to count file system nodes. */
+__STD_TYPE __FSFILCNT_T_TYPE __fsfilcnt_t;
+__STD_TYPE __FSFILCNT64_T_TYPE __fsfilcnt64_t;
+
+__STD_TYPE __SSIZE_T_TYPE __ssize_t; /* Type of a byte count, or error. */
+
+/* These few don't really vary by system, they always correspond
+ to one of the other defined types. */
+typedef __off64_t __loff_t; /* Type of file sizes and offsets (LFS). */
+typedef __quad_t *__qaddr_t;
+typedef char *__caddr_t;
+
+/* Duplicates info from stdint.h but this is used in unistd.h. */
+__STD_TYPE __SWORD_TYPE __intptr_t;
+
+/* Duplicate info from sys/socket.h. */
+__STD_TYPE __U32_TYPE __socklen_t;
+
+
+#undef __STD_TYPE
+
+/* OpenSolaris extension types. */
+typedef __id_t taskid_t;
+typedef __id_t projid_t;
+typedef __id_t poolid_t;
+typedef __id_t zoneid_t;
+typedef __id_t ctid_t;
+typedef __id_t lgrp_id_t;
+typedef short pri_t;
+typedef long long offset_t;
+typedef long long longlong_t;
+typedef unsigned char uchar_t;
+typedef unsigned int uint_t;
+typedef unsigned short ushort_t;
+typedef unsigned long ulong_t;
+typedef unsigned long long u_longlong_t;
+typedef unsigned long long diskaddr_t;
+typedef unsigned long psaddr_t;
+typedef unsigned int lwpid_t;
+typedef long long hrtime_t;
+typedef unsigned int major_t;
+typedef unsigned int minor_t;
+typedef unsigned short cpu_flag_t;
+typedef unsigned long pgcnt_t;
+typedef long spgcnt_t;
+typedef unsigned long long u_offset_t;
+typedef unsigned long pfn_t;
+typedef unsigned int k_fltset_t;
+typedef void *timeout_id_t;
+typedef void *bufcall_id_t;
+typedef long long len_t;
+typedef __SLONG32_TYPE __t_scalar_t;
+typedef __ULONG32_TYPE __t_uscalar_t;
+#ifndef __t_uscalar_t_defined
+typedef __t_uscalar_t t_uscalar_t;
+# define __t_uscalar_t_defined
+#endif
+typedef __t_scalar_t t_scalar_t;
+
+#if defined(__USE_XOPEN_OR_POSIX)
+typedef enum
+ {
+ _B_FALSE,
+ _B_TRUE
+ } boolean_t;
+#else
+typedef enum
+ {
+ B_FALSE,
+ B_TRUE
+ } boolean_t;
+#endif
+
+typedef union
+ {
+ long double _q;
+ __int32_t _l[4];
+ } pad128_t;
+
+typedef union
+ {
+ long double _q;
+ __uint32_t _l[4];
+ } upad128_t;
+
+#include <endian.h>
+
+#if __BYTE_ORDER == __BIG_ENDIAN
+
+typedef union
+ {
+ offset_t _f;
+ struct
+ {
+ __int32_t _u;
+ __int32_t _l;
+ } _p;
+ } lloff_t;
+
+typedef union
+ {
+ long long _f;
+ struct
+ {
+ __int32_t _u;
+ __int32_t _l;
+ } _p;
+ } lldaddr_t;
+
+#else
+
+typedef union
+ {
+ offset_t _f;
+ struct
+ {
+ __int32_t _l;
+ __int32_t _u;
+ } _p;
+ } lloff_t;
+
+typedef union
+ {
+ long long _f;
+ struct
+ {
+ __int32_t _l;
+ __int32_t _u;
+ } _p;
+ } lldaddr_t;
+
+#endif /* __BYTE_ORDER == __BIG_ENDIAN */
+
+#define _INT64_TYPE
+
+#include <bits/machtypes.h>
+
+/* OpenSolaris compatibility types. */
+typedef unsigned short o_mode_t;
+typedef short o_dev_t;
+typedef unsigned short o_uid_t;
+typedef unsigned short o_gid_t;
+typedef short o_nlink_t;
+typedef short o_pid_t;
+typedef unsigned short o_ino_t;
+
+/* OpenSolaris needs clock_t in sys/types.h. */
+#if !defined __clock_t_defined
+# define __clock_t_defined 1
+
+__BEGIN_NAMESPACE_STD
+/* Returned by `clock'. */
+typedef __clock_t clock_t;
+__END_NAMESPACE_STD
+#if defined __USE_XOPEN || defined __USE_POSIX || defined __USE_MISC
+__USING_NAMESPACE_STD(clock_t)
+#endif
+
+#endif /* clock_t not defined and <time.h> or need clock_t. */
+
+#if defined(__USE_MISC)
+/* A value representing the current process/task. */
+# define P_MYID (-1)
+#endif
+
+/* OpenSolaris needs this for source compatibility. */
+#ifdef __USE_MISC
+# include <stdint.h>
+#endif
+
+#ifdef _SYSCALL32
+# include <sys/types32.h>
+#endif
+
+#endif /* bits/types.h */
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/typesizes.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/typesizes.h
new file mode 100644
index 0000000000..02c03b0df3
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/typesizes.h
@@ -0,0 +1,67 @@
+/* bits/typesizes.h -- underlying types for *_t. OpenSolaris version.
+ Copyright (C) 2002, 2003, 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _BITS_TYPES_H
+# error "Never include <bits/typesizes.h> directly; use <sys/types.h> instead."
+#endif
+
+#ifndef _BITS_TYPESIZES_H
+#define _BITS_TYPESIZES_H 1
+
+/* See <bits/types.h> for the meaning of these macros. This file exists so
+ that <bits/types.h> need not vary across different GNU platforms. */
+
+#define __DEV_T_TYPE __ULONGWORD_TYPE
+#define __UID_T_TYPE __U32_TYPE
+#define __GID_T_TYPE __U32_TYPE
+#define __INO_T_TYPE __ULONGWORD_TYPE
+#define __INO64_T_TYPE __UQUAD_TYPE
+#define __MODE_T_TYPE __U32_TYPE
+#define __NLINK_T_TYPE __U32_TYPE
+#define __OFF_T_TYPE __SLONGWORD_TYPE
+#define __OFF64_T_TYPE __SQUAD_TYPE
+#define __PID_T_TYPE __S32_TYPE
+#define __RLIM_T_TYPE __ULONGWORD_TYPE
+#define __RLIM64_T_TYPE __UQUAD_TYPE
+#define __BLKCNT_T_TYPE __SLONGWORD_TYPE
+#define __BLKCNT64_T_TYPE __SQUAD_TYPE
+#define __FSBLKCNT_T_TYPE __ULONGWORD_TYPE
+#define __FSBLKCNT64_T_TYPE __UQUAD_TYPE
+#define __FSFILCNT_T_TYPE __ULONGWORD_TYPE
+#define __FSFILCNT64_T_TYPE __UQUAD_TYPE
+#define __ID_T_TYPE __SLONG32_TYPE
+#define __CLOCK_T_TYPE __SLONGWORD_TYPE
+#define __TIME_T_TYPE __SLONGWORD_TYPE
+#define __USECONDS_T_TYPE __U32_TYPE
+#define __SUSECONDS_T_TYPE __SLONGWORD_TYPE
+#define __DADDR_T_TYPE __SLONGWORD_TYPE
+#define __SWBLK_T_TYPE __SLONGWORD_TYPE
+#define __KEY_T_TYPE __S32_TYPE
+#define __CLOCKID_T_TYPE __S32_TYPE
+#define __TIMER_T_TYPE __S32_TYPE
+#define __BLKSIZE_T_TYPE __S32_TYPE
+#define __FSID_T_TYPE struct { int __val[2]; }
+#define __SSIZE_T_TYPE __SWORD_TYPE
+
+/* Number of descriptors that can fit in an `fd_set'. */
+/* TODO: for 64-bit (_LP64) machines this should be 65536 */
+#define __FD_SETSIZE 1024
+
+
+#endif /* bits/typesizes.h */
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/uio.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/uio.h
new file mode 100644
index 0000000000..0855d4e177
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/uio.h
@@ -0,0 +1,93 @@
+/* Copyright (C) 1996, 1997, 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+
+#if !defined _SYS_UIO_H && !defined _FCNTL_H
+# error "Never include <bits/uio.h> directly; use <sys/uio.h> instead."
+#endif
+
+#ifndef _BITS_UIO_H
+#define _BITS_UIO_H 1
+
+#include <bits/types.h>
+
+/* Maximum number of iovec's that can be processed in a single call. */
+#define UIO_MAXIOV 16
+
+/* `struct iovec' -- Structure describing a section of memory. */
+
+struct iovec {
+ /* Starting address. */
+ __ptr_t iov_base;
+ /* Length in bytes. */
+ size_t iov_len;
+};
+
+typedef struct iovec iovec_t;
+
+#ifdef __USE_MISC
+
+typedef enum uio_seg
+ {
+ UIO_USERSPACE,
+ UIO_SYSSPACE,
+ UIO_USERISPACE
+ } uio_seg_t;
+
+typedef struct uio
+ {
+ iovec_t *uio_iov;
+ int uio_iovcnt;
+ lloff_t _uio_offset;
+ uio_seg_t uio_segflg;
+ __uint16_t uio_fmode;
+ __uint16_t uio_extflg;
+ lloff_t _uio_limit;
+ ssize_t uio_resid;
+ } uio_t;
+
+typedef struct uioa_page_s
+ {
+ int uioa_pfncnt;
+ void **uioa_ppp;
+ caddr_t uioa_base;
+ size_t uioa_len;
+ } uioa_page_t;
+
+#define UIOA_IOV_MAX 16
+
+typedef struct uioa_s
+ {
+ iovec_t *uio_iov;
+ int uio_iovcnt;
+ lloff_t _uio_offset;
+ uio_seg_t uio_segflg;
+ uint16_t uio_fmode;
+ uint16_t uio_extflg;
+ lloff_t _uio_limit;
+ ssize_t uio_resid;
+ uint32_t uioa_state;
+ uioa_page_t *uioa_lcur;
+ void **uioa_lppp;
+ void *uioa_hwst[4];
+ uioa_page_t uioa_locked[UIOA_IOV_MAX];
+ } uioa_t;
+
+#endif
+
+#endif /* _SYS_UIO_H */
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/utmp.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/utmp.h
new file mode 100644
index 0000000000..e855ad73f8
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/utmp.h
@@ -0,0 +1,125 @@
+/* The `struct utmp' type, describing entries in the utmp file. GNU version.
+ Copyright (C) 1993, 1996, 1997, 1998, 1999, 2002
+ Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _UTMP_H
+# error "Never include <bits/utmp.h> directly; use <utmp.h> instead."
+#endif
+
+#include <paths.h>
+#include <sys/time.h>
+#include <sys/types.h>
+#include <bits/wordsize.h>
+
+
+#define UT_LINESIZE 32
+#define UT_NAMESIZE 32
+#define UT_HOSTSIZE 256
+
+
+/* The structure describing an entry in the database of
+ previous logins. */
+struct lastlog
+ {
+#if __WORDSIZE == 64 && defined __WORDSIZE_COMPAT32
+ int32_t ll_time;
+#else
+ __time_t ll_time;
+#endif
+ char ll_line[UT_LINESIZE];
+ char ll_host[UT_HOSTSIZE];
+ };
+
+
+/* The structure describing the status of a terminated process. This
+ type is used in `struct utmp' below. */
+struct exit_status
+ {
+ short int e_termination; /* Process termination status. */
+ short int e_exit; /* Process exit status. */
+ };
+
+
+/* The structure describing an entry in the user accounting database. */
+struct utmp
+{
+ short int ut_type; /* Type of login. */
+ pid_t ut_pid; /* Process ID of login process. */
+ char ut_line[UT_LINESIZE]; /* Devicename. */
+ char ut_id[4]; /* Inittab ID. */
+ char ut_user[UT_NAMESIZE]; /* Username. */
+ char ut_host[UT_HOSTSIZE]; /* Hostname for remote login. */
+ struct exit_status ut_exit; /* Exit status of a process marked
+ as DEAD_PROCESS. */
+/* The ut_session and ut_tv fields must be the same size when compiled
+ 32- and 64-bit. This allows data files and shared memory to be
+ shared between 32- and 64-bit applications. */
+#if __WORDSIZE == 64 && defined __WORDSIZE_COMPAT32
+ int32_t ut_session; /* Session ID, used for windowing. */
+ struct
+ {
+ int32_t tv_sec; /* Seconds. */
+ int32_t tv_usec; /* Microseconds. */
+ } ut_tv; /* Time entry was made. */
+#else
+ long int ut_session; /* Session ID, used for windowing. */
+ struct timeval ut_tv; /* Time entry was made. */
+#endif
+
+ int32_t ut_addr_v6[4]; /* Internet address of remote host. */
+ char __unused[20]; /* Reserved for future use. */
+};
+
+/* Backwards compatibility hacks. */
+#define ut_name ut_user
+#ifndef _NO_UT_TIME
+/* We have a problem here: `ut_time' is also used otherwise. Define
+ _NO_UT_TIME if the compiler complains. */
+# define ut_time ut_tv.tv_sec
+#endif
+#define ut_xtime ut_tv.tv_sec
+#define ut_addr ut_addr_v6[0]
+
+
+/* Values for the `ut_type' field of a `struct utmp'. */
+#define EMPTY 0 /* No valid user accounting information. */
+
+#define RUN_LVL 1 /* The system's runlevel. */
+#define BOOT_TIME 2 /* Time of system boot. */
+#define NEW_TIME 3 /* Time after system clock changed. */
+#define OLD_TIME 4 /* Time when system clock changed. */
+
+#define INIT_PROCESS 5 /* Process spawned by the init process. */
+#define LOGIN_PROCESS 6 /* Session leader of a logged in user. */
+#define USER_PROCESS 7 /* Normal process. */
+#define DEAD_PROCESS 8 /* Terminated process. */
+
+#define ACCOUNTING 9
+
+/* Old Linux name for the EMPTY type. */
+#define UT_UNKNOWN EMPTY
+
+
+/* Tell the user that we have a modern system with UT_HOST, UT_PID,
+ UT_TYPE, UT_ID and UT_TV fields. */
+#define _HAVE_UT_TYPE 1
+#define _HAVE_UT_PID 1
+#define _HAVE_UT_ID 1
+#define _HAVE_UT_TV 1
+#define _HAVE_UT_HOST 1
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/utmpx.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/utmpx.h
new file mode 100644
index 0000000000..8ddd42973e
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/utmpx.h
@@ -0,0 +1,126 @@
+/* Structures and definitions for the user accounting database. GNU version.
+ Copyright (C) 1997, 1998, 2000, 2001, 2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _UTMPX_H
+# error "Never include <bits/utmpx.h> directly; use <utmpx.h> instead."
+#endif
+
+#include <bits/types.h>
+#include <sys/time.h>
+#include <bits/wordsize.h>
+
+
+#define _UTMPX_FILE "/var/run/utmp"
+#define _WTMPX_FILE "/var/log/wtmp"
+#ifdef __USE_MISC
+# include <paths.h>
+# define _PATH_UTMPX _PATH_UTMP
+# define _PATH_WTMPX _PATH_WTMP
+#endif
+
+
+#define __UT_LINESIZE 32
+#define __UT_NAMESIZE 32
+#define __UT_HOSTSIZE 256
+
+
+/* The structure describing the status of a terminated process. This
+ type is used in `struct utmpx' below. */
+struct __exit_status
+ {
+#ifdef __USE_MISC
+ short int e_termination; /* Process termination status. */
+ short int e_exit; /* Process exit status. */
+#else
+ short int __e_termination; /* Process termination status. */
+ short int __e_exit; /* Process exit status. */
+#endif
+ };
+
+
+/* The structure describing an entry in the user accounting database. */
+struct utmpx
+{
+ short int ut_type; /* Type of login. */
+ __pid_t ut_pid; /* Process ID of login process. */
+ char ut_line[__UT_LINESIZE]; /* Devicename. */
+ char ut_id[4]; /* Inittab ID. */
+ char ut_user[__UT_NAMESIZE]; /* Username. */
+ char ut_host[__UT_HOSTSIZE]; /* Hostname for remote login. */
+ struct __exit_status ut_exit; /* Exit status of a process marked
+ as DEAD_PROCESS. */
+
+/* The fields ut_session and ut_tv must be the same size when compiled
+ 32- and 64-bit. This allows files and shared memory to be shared
+ between 32- and 64-bit applications. */
+#if __WORDSIZE == 64 && defined __WORDSIZE_COMPAT32
+ __int32_t ut_session; /* Session ID, used for windowing. */
+ struct
+ {
+ __int32_t tv_sec; /* Seconds. */
+ __int32_t tv_usec; /* Microseconds. */
+ } ut_tv; /* Time entry was made. */
+#else
+ long int ut_session; /* Session ID, used for windowing. */
+ struct timeval ut_tv; /* Time entry was made. */
+#endif
+ __int32_t ut_addr_v6[4]; /* Internet address of remote host. */
+ char __unused[20]; /* Reserved for future use. */
+};
+
+/* Backwards compatibility hacks. */
+#define ut_name ut_user
+#ifndef _NO_UT_TIME
+/* We have a problem here: `ut_time' is also used otherwise. Define
+ _NO_UT_TIME if the compiler complains. */
+# define ut_time ut_tv.tv_sec
+#endif
+#define ut_xtime ut_tv.tv_sec
+#define ut_addr ut_addr_v6[0]
+
+
+/* Values for the `ut_type' field of a `struct utmpx'. */
+#define EMPTY 0 /* No valid user accounting information. */
+
+#ifdef __USE_MISC
+# define RUN_LVL 1 /* The system's runlevel. */
+#endif
+#define BOOT_TIME 2 /* Time of system boot. */
+#define NEW_TIME 3 /* Time after system clock changed. */
+#define OLD_TIME 4 /* Time when system clock changed. */
+
+#define INIT_PROCESS 5 /* Process spawned by the init process. */
+#define LOGIN_PROCESS 6 /* Session leader of a logged in user. */
+#define USER_PROCESS 7 /* Normal process. */
+#define DEAD_PROCESS 8 /* Terminated process. */
+
+#ifdef __USE_MISC
+# define ACCOUNTING 9 /* System accounting. */
+# define DOWN_TIME 10
+# define UTMAXTYPE DOWN_TIME
+#endif
+
+#ifdef __USE_MISC
+# define RUNLVL_MSG "run-level %c"
+# define BOOT_MSG "system boot"
+# define OTIME_MSG "old time"
+# define NTIME_MSG "new time"
+# define PSRADM_MSG "%03d %s"
+# define DOWN_MSG "system down"
+#endif
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/utsname.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/utsname.h
new file mode 100644
index 0000000000..8ed5155416
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/utsname.h
@@ -0,0 +1,26 @@
+/* Copyright (C) 1997, 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _SYS_UTSNAME_H
+# error "Never include <bits/utsname.h> directly; use <sys/utsname.h> instead."
+#endif
+
+/* The size of the character arrays used to hold the information
+ in a `struct utsname'. Enlarge this as necessary. */
+#define _UTSNAME_LENGTH 257
+#define _SYS_NMLN _UTSNAME_LENGTH
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/waitflags.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/waitflags.h
new file mode 100644
index 0000000000..0106e129d6
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/waitflags.h
@@ -0,0 +1,35 @@
+/* Definitions of flag bits for `waitpid' et al.
+ Copyright (C) 1992, 1996-1997, 2000, 2002, 2008
+ Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#if !defined _SYS_WAIT_H && !defined _STDLIB_H
+# error "Never include <bits/waitflags.h> directly; use <sys/wait.h> instead."
+#endif
+
+
+/* Bits in the third argument to `waitpid'. */
+#define WNOHANG 0x40 /* Don't block waiting. */
+#define WUNTRACED 0x04 /* Report status of stopped children. */
+
+/* Bits in the fourth argument to `waitid'. */
+#define WSTOPPED WUNTRACED /* Report stopped child (same as WUNTRACED). */
+#define WCONTINUED 0x08 /* Report continued child. */
+#define WNOWAIT 0x80 /* Don't reap, just poll status. */
+#define WEXITED 0x01 /* Report dead child. */
+#define WTRAPPED 0x02 /* Report processes stopped while tracing */
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/waitstatus.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/waitstatus.h
new file mode 100644
index 0000000000..237b0ba3be
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/waitstatus.h
@@ -0,0 +1,116 @@
+/* Definitions of status bits for `wait' et al.
+ Copyright (C) 1992,1994,1996,1997,2000,2004,2008
+ Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#if !defined _SYS_WAIT_H && !defined _STDLIB_H
+# error "Never include <bits/waitstatus.h> directly; use <sys/wait.h> instead."
+#endif
+
+
+/* Everything extant so far uses these same bits. */
+
+
+/* If WIFEXITED(STATUS), the low-order 8 bits of the status. */
+#define __WEXITSTATUS(status) (((status) >> 8) & 0xff)
+
+/* If WIFSIGNALED(STATUS), the terminating signal. */
+#define __WTERMSIG(status) ((status) & 0x7f)
+
+/* If WIFSTOPPED(STATUS), the signal that stopped the child. */
+#define __WSTOPSIG(status) __WEXITSTATUS(status)
+
+/* Nonzero if STATUS indicates normal termination. */
+#define __WIFEXITED(status) (((status) & 0xff) == 0)
+
+/* Nonzero if STATUS indicates termination by a signal. */
+#define __WIFSIGNALED(status) \
+ (((int)((status) & 0xff) > 0) && (((status) & 0xff00) == 0))
+
+/* Nonzero if STATUS indicates the child is stopped. */
+#define __WIFSTOPPED(status) \
+ ((((status) & 0xff) == 0x7f) && (((status) & 0xff00) != 0))
+
+/* Nonzero if STATUS indicates the child continued after a stop. We only
+ define this if <bits/waitflags.h> provides the WCONTINUED flag bit. */
+#ifdef WCONTINUED
+# define __WIFCONTINUED(status) (((status) & __W_CONTINUED) == __W_CONTINUED)
+#endif
+
+/* Nonzero if STATUS indicates the child dumped core. */
+#define __WCOREDUMP(status) ((status) & __WCOREFLAG)
+
+/* Macros for constructing status values. */
+#define __W_EXITCODE(ret, sig) ((ret) << 8 | (sig))
+#define __W_STOPCODE(sig) ((sig) << 8 | 0x7f)
+#define __W_CONTINUED 0xffff
+#define __WCOREFLAG 0x80
+
+#ifdef __USE_BSD
+
+#define WSTOPFLG 0x7f
+#define WCONTFLG __W_CONTINUED
+#define WCOREFLG __WCOREFLAG
+#define WSIGMASK 0x7f
+
+#define WLOBYTE(stat) (((status) & 0xff))
+#define WHIBYTE(stat) ((((status) >> 8) & 0xff))
+#define WWORD(stat) (((status)) & 0xffff)
+
+# include <endian.h>
+
+union wait
+ {
+ int w_status;
+ struct
+ {
+# if __BYTE_ORDER == __LITTLE_ENDIAN
+ unsigned int __w_termsig:7; /* Terminating signal. */
+ unsigned int __w_coredump:1; /* Set if dumped core. */
+ unsigned int __w_retcode:8; /* Return code if exited normally. */
+ unsigned int:16;
+# endif /* Little endian. */
+# if __BYTE_ORDER == __BIG_ENDIAN
+ unsigned int:16;
+ unsigned int __w_retcode:8;
+ unsigned int __w_coredump:1;
+ unsigned int __w_termsig:7;
+# endif /* Big endian. */
+ } __wait_terminated;
+ struct
+ {
+# if __BYTE_ORDER == __LITTLE_ENDIAN
+ unsigned int __w_stopval:8; /* W_STOPPED if stopped. */
+ unsigned int __w_stopsig:8; /* Stopping signal. */
+ unsigned int:16;
+# endif /* Little endian. */
+# if __BYTE_ORDER == __BIG_ENDIAN
+ unsigned int:16;
+ unsigned int __w_stopsig:8; /* Stopping signal. */
+ unsigned int __w_stopval:8; /* W_STOPPED if stopped. */
+# endif /* Big endian. */
+ } __wait_stopped;
+ };
+
+# define w_termsig __wait_terminated.__w_termsig
+# define w_coredump __wait_terminated.__w_coredump
+# define w_retcode __wait_terminated.__w_retcode
+# define w_stopsig __wait_stopped.__w_stopsig
+# define w_stopval __wait_stopped.__w_stopval
+
+#endif /* Use BSD. */
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/xtitypes.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/xtitypes.h
new file mode 100644
index 0000000000..4d0ce1de3a
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bits/xtitypes.h
@@ -0,0 +1 @@
+#include <bits/types.h>
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bootparams-lookup.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bootparams-lookup.c
new file mode 100644
index 0000000000..8525498f90
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/bootparams-lookup.c
@@ -0,0 +1,23 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#define DATABASE_NAME bootparams
+#define DEFAULT_CONFIG "nis [NOTFOUND=return] files"
+
+#include "XXX-lookup.c"
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/brk.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/brk.c
new file mode 100644
index 0000000000..222c3b313a
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/brk.c
@@ -0,0 +1,91 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <inline-syscall.h>
+#include <errno.h>
+#include <unistd.h>
+#include <sys/gmon.h>
+#include <ldsodefs.h>
+#include <dlfcn.h>
+
+DECLARE_INLINE_SYSCALL (int, brk, __caddr_t *addr);
+
+/*
+ Solaris will round the break up to an 8 - 16 byte alignment. We don't take
+ this into account, which is safe; we will always just assume a slightly
+ smaller amount of core than we actually have available.
+
+ Solaris doesn't return the current break via brk, so we track it here.
+
+ For dynamic executables, the kernel does not set the initial break. It
+ expects libc to set the initial break to the tail of the executable being
+ loaded. For static executables we use &_end.
+
+ See uts/common/exec/elf/elf.c, line 800.
+*/
+
+#define BRK_ALIGN(addr) (void *)(((uintptr_t)addr + 0x7) & ~(uintptr_t)0x7)
+
+void *__curbrk = 0;
+extern int _end;
+
+int
+__brk (addr)
+ void *addr;
+{
+ int result = 0;
+
+ if (__curbrk == 0)
+ {
+#ifndef SHARED
+ /* If we are statically compiled we can use &_end. */
+ addr = &_end;
+#else
+ if (GL(dl_ns)[LM_ID_BASE]._ns_loaded)
+ {
+ /* The dynamic executable has been mapped in. */
+ addr = (void*)GL(dl_ns)[LM_ID_BASE]._ns_loaded->l_map_end;
+ }
+ else if (GL(dl_rtld_map).l_addr == 0)
+ {
+ /* This must be ld.so.1 being run directly. */
+ addr = &_end;
+ }
+ else
+ {
+ /* The executable has not been mapped in. */
+ return -1;
+ }
+#endif
+ }
+ else if (addr == 0)
+ {
+ /* We have multiple libc's. */
+ return 0;
+ }
+
+ addr = BRK_ALIGN (addr);
+ result = INLINE_SYSCALL (brk, 1, addr);
+ if (result == 0)
+ __curbrk = addr;
+
+ return result;
+}
+
+weak_alias (__brk, brk)
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/cftime.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/cftime.c
new file mode 100644
index 0000000000..bf24171014
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/cftime.c
@@ -0,0 +1,34 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <time.h>
+
+int cftime (char *s, const char *format, const time_t *clock)
+{
+ struct tm res;
+ if (localtime_r (clock, &res) == NULL)
+ {
+ s[0] = '\0';
+ return 0;
+ }
+ else
+ {
+ return ascftime (s, format, &res);
+ }
+}
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/check_fds.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/check_fds.c
new file mode 100644
index 0000000000..20449aaf81
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/check_fds.c
@@ -0,0 +1,25 @@
+/* Copyright (C) 2000, 2002, 2003, 2005 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+// TODO
+#include <errno.h>
+
+void
+__libc_check_standard_fds (void)
+{
+}
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/check_pf.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/check_pf.c
new file mode 100644
index 0000000000..6788c6023d
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/check_pf.c
@@ -0,0 +1,12 @@
+#include <sys/socket.h>
+#include <ifaddrs.h>
+#include <netdb.h>
+
+// TODO
+
+void
+attribute_hidden
+__check_pf (bool *seen_ipv4, bool *seen_ipv6,
+ struct in6addrinfo **in6ai, size_t *in6ailen)
+{
+}
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/clock.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/clock.c
new file mode 100644
index 0000000000..e5c6b0e29a
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/clock.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/clock.c>
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/clock_gettime.S b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/clock_gettime.S
new file mode 100644
index 0000000000..52c91ce3fb
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/clock_gettime.S
@@ -0,0 +1,5 @@
+#include <sysdep.h>
+PSEUDO (clock_gettime, clock_gettime, 2)
+ ret
+PSEUDO_END(clock_gettime)
+librt_hidden_def (clock_gettime)
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/clock_nanosleep.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/clock_nanosleep.c
new file mode 100644
index 0000000000..f23f944b2e
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/clock_nanosleep.c
@@ -0,0 +1,25 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <time.h>
+
+#define INVALID_CLOCK_P(cl) \
+ ((cl) < __CLOCK_REALTIME0 || (cl) > CLOCK_PROCESS_CPUTIME_ID)
+
+#include <sysdeps/unix/clock_nanosleep.c>
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/clock_settime.S b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/clock_settime.S
new file mode 100644
index 0000000000..c773c8b0a6
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/clock_settime.S
@@ -0,0 +1,4 @@
+#include <sysdep.h>
+PSEUDO (clock_settime, clock_settime, 2)
+ ret
+PSEUDO_END(clock_settime)
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/closefrom.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/closefrom.c
new file mode 100644
index 0000000000..e88b69e08f
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/closefrom.c
@@ -0,0 +1,37 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <stdlib.h>
+#include <unistd.h>
+
+/* TODO: This should go away once we put fdwalk in stdlib.h. */
+extern int fdwalk(int (*)(void *, int), void *);
+
+static int close_lowfd (void *lowfdp, int fd)
+{
+ int lowfd = (int)lowfdp;
+ if (fd >= lowfd)
+ (void) close (fd);
+ return 0;
+}
+
+void closefrom (int lowfd)
+{
+ fdwalk (close_lowfd, (void *)lowfd);
+}
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/cmsg_nxthdr.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/cmsg_nxthdr.c
new file mode 100644
index 0000000000..11e16cb567
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/cmsg_nxthdr.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/cmsg_nxthdr.c>
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/configure b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/configure
new file mode 100644
index 0000000000..d57e3215a4
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/configure
@@ -0,0 +1,9 @@
+# This file is generated from configure.in by Autoconf. DO NOT EDIT!
+ # Local configure fragment for sysdeps/unix/sysv/solaris2/kopensolaris-gnu.
+
+use_ldconfig=yes
+
+cat >>confdefs.h <<\_ACEOF
+#define ALLOW_NULL_STRFTIME_FORMAT 1
+_ACEOF
+
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/configure.in b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/configure.in
new file mode 100644
index 0000000000..6ef5079cff
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/configure.in
@@ -0,0 +1,6 @@
+GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
+# Local configure fragment for sysdeps/unix/sysv/solaris2/kopensolaris-gnu.
+
+use_ldconfig=yes
+
+AC_DEFINE(ALLOW_NULL_STRFTIME_FORMAT)
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/connect.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/connect.c
new file mode 100644
index 0000000000..f9f9281715
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/connect.c
@@ -0,0 +1,39 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sysdep-cancel.h>
+#include <inline-syscall.h>
+#include <sys/socket.h>
+
+extern int _so_connect (int sock, __CONST_SOCKADDR_ARG addr,
+ unsigned int addrlen, int version);
+
+int
+__libc_connect (fd, addr, len)
+ int fd;
+ __CONST_SOCKADDR_ARG addr;
+ socklen_t len;
+{
+ return _so_connect (fd, addr, len, SOV_XPG4_2);
+}
+
+weak_alias (__libc_connect, __connect)
+weak_alias (__libc_connect, connect)
+weak_alias (__libc_connect, __connect_internal)
+LIBC_CANCEL_HANDLED (); /* sys_connect handles cancellation */
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/deflt.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/deflt.c
new file mode 100644
index 0000000000..c75c1af83f
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/deflt.c
@@ -0,0 +1,119 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <defltP.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+static __thread FILE *deflt_fp = NULL;
+static __thread int deflt_flags = 0;
+static __thread char deflt_buf[_DEFLT_BUFSIZE];
+
+
+int defopen (char *fn)
+{
+ /* Close old file if open. */
+ if (deflt_fp)
+ {
+ fclose (deflt_fp);
+ deflt_fp = NULL;
+ }
+ if (!fn)
+ return 0;
+
+ deflt_fp = fopen (fn, "r");
+ if (!deflt_fp)
+ return -1;
+
+ /* Set default flags. */
+ deflt_flags = DC_STD;
+
+ return 0;
+}
+
+
+char * defread (char *cp)
+{
+ if (!deflt_fp)
+ return NULL;
+
+ /* Rewind if needed. */
+ if ((deflt_flags & DC_NOREWIND) == 0)
+ rewind (deflt_fp);
+
+ size_t cplen = strlen (cp);
+ int (*strcmpfunc)(const char *, const char *, size_t) =
+ (deflt_flags & DC_CASE) ? strncmp : strncasecmp;
+ while (fgets (deflt_buf, _DEFLT_BUFSIZE + 2, deflt_fp))
+ {
+ if (strlen (deflt_buf) > _DEFLT_BUFSIZE)
+ break;
+
+ /* Trim trailing newline. */
+ size_t len = strlen (deflt_buf);
+ if (len && deflt_buf[len - 1] == '\n')
+ deflt_buf[len - 1] = '\0';
+
+ /* Eat spaces. */
+ char *bufp = deflt_buf - 1;
+ while (*++bufp == ' ') ;
+
+ if ((*strcmpfunc)(bufp, cp, cplen) == 0)
+ {
+ bufp += cplen;
+
+ /* Strip quotes. */
+ if ((deflt_flags & DC_STRIP_QUOTES) && *bufp)
+ {
+ /* Strip leading quote. */
+ if (*bufp == '"' || *bufp == '\'')
+ {
+ char *bufp2 = bufp, *bufp3 = bufp;
+ while ((*bufp2++ = *++bufp3)) ;
+ }
+
+ /* Strip trailing quote. */
+ len = strlen (bufp);
+ if (len && (bufp[len - 1] == '"' || bufp[len - 1] == '\''))
+ bufp[len - 1] = '\0';
+ }
+
+ return bufp;
+ }
+ }
+
+ return NULL;
+}
+
+
+int defcntl (int cmd, int newflags)
+{
+ int oldflags = deflt_flags;
+ switch (cmd)
+ {
+ case DC_GETFLAGS:
+ return oldflags;
+ case DC_SETFLAGS:
+ deflt_flags = newflags;
+ return oldflags;
+ default:
+ return -1;
+ }
+}
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/deflt.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/deflt.h
new file mode 100644
index 0000000000..326ba7e951
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/deflt.h
@@ -0,0 +1,41 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _DEFLT_H
+#define _DEFLT_H
+
+#include <features.h>
+
+#define DC_GETFLAGS 0
+#define DC_SETFLAGS 1
+
+#define DC_CASE 0x01
+#define DC_NOREWIND 0x02
+#define DC_STRIP_QUOTES 0x04
+#define DC_STD DC_CASE
+
+__BEGIN_DECLS
+
+extern int defopen (char *);
+extern char *defread (char *);
+extern int defcntl (int, int);
+
+__END_DECLS
+
+#endif /* _DEFLT_H */
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/defltP.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/defltP.h
new file mode 100644
index 0000000000..2505c44e3e
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/defltP.h
@@ -0,0 +1,27 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _DEFLTP_H
+#define _DEFLTP_H
+
+#include <deflt.h>
+
+#define _DEFLT_BUFSIZE 1024
+
+#endif /* _DEFLTP_H */
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/dl-execstack.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/dl-execstack.c
new file mode 100644
index 0000000000..2b6c3baadb
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/dl-execstack.c
@@ -0,0 +1,52 @@
+/* Stack executability handling for GNU dynamic linker. OpenSolaris version.
+ Copyright (C) 2003, 2004, 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <ldsodefs.h>
+#include <errno.h>
+#include <sys/ucontext.h>
+#include <sys/syscall.h>
+
+/* There is no portable way to know the bounds of the initial thread's stack
+ so as to mprotect it. */
+
+int
+internal_function
+_dl_make_stack_executable (void **stack_endp)
+{
+ /* We can get the stack base and size from getcontext. */
+ sysret_t ret;
+ ucontext_t ctx;
+ int errval = __systemcall (&ret, SYS_context, GETCONTEXT, &ctx);
+ if (errval != 0)
+ return errval;
+
+ /* The given stack pointer better be in range. */
+ if (*stack_endp < ctx.uc_stack.ss_sp ||
+ *stack_endp > (ctx.uc_stack.ss_sp + ctx.uc_stack.ss_size))
+ return ENOTSUP;
+
+ errval = __systemcall (&ret, SYS_mprotect, ctx.uc_stack.ss_sp,
+ ctx.uc_stack.ss_size, PROT_READ | PROT_WRITE | PROT_EXEC);
+ if (errval != 0)
+ return errval;
+
+ *stack_endp = NULL;
+ return 0;
+}
+rtld_hidden_def (_dl_make_stack_executable)
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/dl-sysdep.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/dl-sysdep.c
new file mode 100644
index 0000000000..7ff55cf5bc
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/dl-sysdep.c
@@ -0,0 +1,35 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <link.h>
+#include <sys/mman.h>
+#include <ldsodefs.h>
+
+#define DL_SYSDEP_INIT exec_last_load (phdr, phnum)
+
+static inline void exec_last_load (const ElfW(Phdr) *phdr, ElfW(Word) phnum)
+{
+ /* Check if the last PT_LOAD segment is executable. */
+ GLRO(dl_malloc_prot_exec) = 0;
+ for (uint_fast16_t i = 0; i < phnum; ++i)
+ if (phdr[i].p_type == PT_LOAD)
+ GLRO(dl_malloc_prot_exec) = (phdr[i].p_flags & PF_X) ? PROT_EXEC : 0;
+}
+
+#include <elf/dl-sysdep.c>
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/dl-sysdep.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/dl-sysdep.h
new file mode 100644
index 0000000000..9ba9ed9559
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/dl-sysdep.h
@@ -0,0 +1,39 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sys/auxv.h>
+#include_next <dl-sysdep.h>
+
+#ifdef SHARED
+# define SECURE_DECIDED
+#else
+# define SECURE_DECIDED __libc_enable_secure_decided = 1;
+#endif
+
+#define DL_PLATFORM_AUXV \
+ case AT_SUN_EXECNAME: \
+ GLRO(dl_sun_execname) = (void *) av->a_un.a_val; \
+ break; \
+ case AT_SUN_AUXFLAGS: \
+ if (av->a_un.a_val & AF_SUN_SETUGID) \
+ { \
+ __libc_enable_secure = 1; \
+ SECURE_DECIDED \
+ } \
+ break;
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/door.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/door.c
new file mode 100644
index 0000000000..93d19f86ae
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/door.c
@@ -0,0 +1,261 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sysdep-cancel.h>
+#include <inline-syscall.h>
+#include <doorP.h>
+#include <ucredP.h>
+#include <libio/libioP.h>
+#include <atomic.h>
+#include <thread.h>
+#include <dlfcn.h>
+#include <alloca.h>
+#include <signal.h>
+
+static pid_t __door_private_pid, __door_unref_pid;
+static void door_server_create_default (door_info_t *);
+door_server_func_t *door_server_create_proc = door_server_create_default;
+static int (*thr_create_ptr) (void *, size_t, void * (*)(void *), void *,
+ long, thread_t *);
+
+/* Arguments are passed normally with the 6th argument always the subcode. */
+
+DECLARE_INLINE_SYSCALL (int, door, long, long, long, long, long, long subcode);
+
+
+int door_info (int d, door_info_t *info)
+{
+ return INLINE_SYSCALL (door, 6, d, (long)info, 0, 0, 0, SYS_SUB_door_info);
+}
+
+
+int door_bind (int d)
+{
+ return INLINE_SYSCALL (door, 6, d, 0, 0, 0, 0, SYS_SUB_door_bind);
+}
+
+
+int door_unbind (void)
+{
+ return INLINE_SYSCALL (door, 6, 0, 0, 0, 0, 0, SYS_SUB_door_unbind);
+}
+
+
+int door_revoke (int d)
+{
+ return INLINE_SYSCALL (door, 6, d, 0, 0, 0, 0, SYS_SUB_door_revoke);
+}
+
+
+int door_getparam(int d, int param, size_t *out)
+{
+ return INLINE_SYSCALL (door, 6, d, param, (long)out, 0, 0,
+ SYS_SUB_door_getparam);
+}
+
+
+int door_setparam (int d, int param, size_t val)
+{
+ return INLINE_SYSCALL (door, 6, d, param, val, 0, 0, SYS_SUB_door_setparam);
+}
+
+
+int door_call (int d, door_arg_t* params)
+{
+ if (SINGLE_THREAD_P)
+ return INLINE_SYSCALL (door, 6, d, (long)params, 0, 0, 0,
+ SYS_SUB_door_call);
+
+ int oldtype = LIBC_CANCEL_ASYNC ();
+
+ int res = INLINE_SYSCALL (door, 6, d, (long)params, 0, 0, 0,
+ SYS_SUB_door_call);
+
+ LIBC_CANCEL_RESET (oldtype);
+
+ return res;
+}
+
+
+int door_return (char *data_ptr, size_t data_size, door_desc_t *desc_ptr,
+ uint_t num_desc)
+{
+ /* Reserve space for returned client arguments. */
+ stack_t stack;
+ thr_stksegment (&stack);
+ if (stack.ss_size > DOOR_MIN_STACKSIZE)
+ {
+ stack.ss_size -= DOOR_MIN_STACKSIZE;
+ // TODO: handle stacks that grow up
+ stack.ss_sp -= DOOR_MIN_STACKSIZE;
+ }
+ else
+ {
+ stack.ss_size = 0;
+ }
+
+ door_return_desc_t drd;
+ drd.desc_ptr = desc_ptr;
+ drd.desc_num = num_desc;
+
+ /* __door_return never returns unless there's an error. */
+ while (__door_return ((long)data_ptr, data_size, (long)&drd,
+ (long)stack.ss_sp, stack.ss_size, SYS_SUB_door_return) == 0 ||
+ errno == EINTR || errno == ERESTART) ;
+ return -1;
+}
+
+
+door_server_func_t * door_server_create (door_server_func_t *create_proc)
+{
+ while (1)
+ {
+ door_server_func_t *cur_proc = door_server_create_proc;
+ door_server_func_t *old_proc = atomic_compare_and_exchange_val_acq (
+ &door_server_create_proc, create_proc, cur_proc);
+ if (old_proc == cur_proc)
+ return old_proc;
+ }
+}
+
+
+static void * door_create_default_proc (void *arg)
+{
+ pthread_setcancelstate (PTHREAD_CANCEL_DISABLE, NULL);
+ door_return (NULL, 0, NULL, 0);
+
+ return arg;
+}
+
+
+static int door_load_libpthread (void)
+{
+ if (!thr_create_ptr)
+ {
+ void *libpthread = __libc_dlopen ("libpthread.so.0");
+ if (!libpthread)
+ return -1;
+ thr_create_ptr = __libc_dlsym (libpthread, "thr_create");
+ if (!thr_create_ptr)
+ return -1;
+ }
+
+ return 0;
+}
+
+
+static void door_server_create_default (door_info_t *info)
+{
+ if (door_load_libpthread () != 0)
+ return;
+
+ /* The default server create action is to create a server thread. We use
+ thr_create since we want to create this as a daemon thread. */
+ thr_create_ptr (NULL, 0, door_create_default_proc, NULL, THR_DETACHED, NULL);
+}
+
+
+static void * door_unref_proc (void *arg)
+{
+ /* We may get interrupted so loop. */
+ while (INLINE_SYSCALL (door, 6, 0, 0, 0, 0, 0, SYS_SUB_door_unrefsys) &&
+ errno == EINTR) ;
+
+ return NULL;
+}
+
+
+int door_create (void (*server_procedure)(void *cookie, char *argp,
+ size_t arg_size, door_desc_t *dp, uint_t n_desc), void *cookie,
+ unsigned int attributes)
+{
+ // TODO: remove
+ if (attributes & ~(DOOR_NO_CANCEL | DOOR_REFUSE_DESC | DOOR_PRIVATE | \
+ DOOR_UNREF | DOOR_UNREF_MULTI))
+ abort ();
+
+ /* We lock the io list lock as fork() locks it before forking. This allows us
+ to be safe in the face of a fork. */
+ _IO_list_lock ();
+
+ int res = INLINE_SYSCALL (door, 6, (long)server_procedure,
+ (long)cookie, attributes, 0, 0, SYS_SUB_door_create);
+
+ pid_t pid = getpid ();
+ if (__door_private_pid != pid && (attributes & DOOR_PRIVATE) == 0)
+ {
+ /* We haven't created the first server. */
+ (*door_server_create_proc) (NULL);
+ __door_private_pid = pid;
+ }
+ if (__door_unref_pid != pid && (attributes & (DOOR_UNREF | DOOR_UNREF_MULTI)))
+ {
+ if (door_load_libpthread () != 0)
+ return -1;
+
+ /* We haven't created the unreferenced thread. */
+ thr_create_ptr (NULL, 0, door_unref_proc, NULL, THR_DAEMON, NULL);
+ __door_unref_pid = pid;
+ }
+
+ _IO_list_unlock ();
+
+ return res;
+}
+
+
+int door_ucred (ucred_t **info)
+{
+ ucred_t *uc = *info;
+ if (!uc)
+ {
+ uc = _ucred_alloc ();
+ if (!uc)
+ return -1;
+ }
+
+ int res = INLINE_SYSCALL (door, 6, (long)uc, 0, 0, 0, 0, SYS_SUB_door_ucred);
+ if (res != 0)
+ {
+ if (!*info)
+ free (uc);
+ return -1;
+ }
+
+ *info = uc;
+
+ return 0;
+}
+
+
+int door_cred (door_cred_t *info)
+{
+ ucred_t *uc = alloca (ucred_size ());
+ int res = INLINE_SYSCALL (door, 6, (long)uc, 0, 0, 0, 0, SYS_SUB_door_ucred);
+ if (res != 0)
+ return -1;
+
+ info->dc_euid = ucred_geteuid (uc);
+ info->dc_ruid = ucred_getruid (uc);
+ info->dc_egid = ucred_getegid (uc);
+ info->dc_rgid = ucred_getrgid (uc);
+ info->dc_pid = ucred_getpid (uc);
+
+ return 0;
+}
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/door.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/door.h
new file mode 100644
index 0000000000..90b2fd3986
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/door.h
@@ -0,0 +1,47 @@
+/* Declarations of privilege functions and types.
+ Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _DOOR_H
+#define _DOOR_H
+
+#include <sys/door.h>
+#include <ucred.h>
+#include <features.h>
+
+typedef void door_server_func_t (door_info_t *);
+
+__BEGIN_DECLS
+
+extern int door_create (void (*)(void *, char *, size_t, door_desc_t *, uint_t),
+ void *, uint_t);
+extern int door_revoke (int);
+extern int door_info (int, door_info_t *);
+extern int door_call (int, door_arg_t *);
+extern int door_return (char *, size_t, door_desc_t *, uint_t);
+extern int door_cred (door_cred_t *);
+extern int door_ucred (ucred_t **);
+extern int door_bind (int);
+extern int door_unbind (void);
+extern int door_getparam (int, int, size_t *);
+extern int door_setparam (int, int, size_t);
+extern door_server_func_t *door_server_create (door_server_func_t *);
+
+__END_DECLS
+
+#endif /* _DOOR_H */
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/doorP.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/doorP.h
new file mode 100644
index 0000000000..40c1dea5eb
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/doorP.h
@@ -0,0 +1,30 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _DOORP_H
+#define _DOORP_H
+
+#include <door.h>
+
+/* The default stack size is 1-2M so reserving 16K is reasonable. */
+#define DOOR_MIN_STACKSIZE 16384
+
+int __door_return (long, long, long, long, long, long);
+
+#endif /* _DOORP_H */
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/dup2.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/dup2.c
new file mode 100644
index 0000000000..6f778c2185
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/dup2.c
@@ -0,0 +1,38 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <not-cancel.h>
+#include <fcntl.h>
+#include <unistd.h>
+
+/* F_DUPFD expects the target fd to be closed before calling it; if
+ we close first we create a race condition where the fd could be
+ reused before we call fcntl. Solaris solves this by providing
+ F_DUP2FD, which is atomic in this regard. */
+
+int
+__dup2 (fd, fd2)
+ int fd;
+ int fd2;
+{
+ return fcntl_not_cancel (fd, F_DUP2FD, fd2);
+}
+
+libc_hidden_def (__dup2)
+weak_alias (__dup2, dup2)
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/euidaccess.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/euidaccess.c
new file mode 100644
index 0000000000..2ea3d23b1a
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/euidaccess.c
@@ -0,0 +1,37 @@
+/* Test for access to FILE using effective UID and GID. OpenSolaris version.
+ Copyright (C) 1991, 1995, 1997, 2006, 2009 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ OpenSolaris bits contributed by David Bartley
+ <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <stddef.h>
+#include <unistd.h>
+#include <fcntl.h>
+
+#define E_OK 010
+
+int
+__euidaccess (file, type)
+ const char *file;
+ int type;
+{
+ return __access (file, type | E_OK);
+}
+weak_alias (__euidaccess, euidaccess)
+weak_alias (__euidaccess, eaccess)
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/exec_attr-lookup.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/exec_attr-lookup.c
new file mode 100644
index 0000000000..1671043feb
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/exec_attr-lookup.c
@@ -0,0 +1,23 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#define DATABASE_NAME exec_attr
+#define DEFAULT_CONFIG "files nis"
+
+#include "XXX-lookup.c"
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/exec_attrP.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/exec_attrP.h
new file mode 100644
index 0000000000..b3d4113c49
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/exec_attrP.h
@@ -0,0 +1,46 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _EXEC_ATTRP_H
+#define _EXEC_ATTRP_H
+
+#include <sys/types.h>
+#include <nss/nss.h>
+
+#define NSS_BUFLEN_USERATTR 1024
+
+typedef struct execstr_s
+ {
+ char *name;
+ char *policy;
+ char *type;
+ char *res1;
+ char *res2;
+ char *id;
+ char *attr;
+ struct execstr_s *next;
+ } execstr_t;
+
+struct parser_data;
+extern int _nss_files_parse_execattr (char *line, struct execstr_s *result,
+ struct parser_data *data,
+ size_t datalen, int *errnop);
+libnss_files_hidden_proto (_nss_files_parse_execattr)
+
+#endif /* _EXEC_ATTRP_H */
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/exit-thread.S b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/exit-thread.S
new file mode 100644
index 0000000000..6cdd0a6ee0
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/exit-thread.S
@@ -0,0 +1,23 @@
+/* Copyright (C) 1991,92,97,99,2002,2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sysdep.h>
+
+PSEUDO (__exit_thread, lwp_exit, 0)
+ /* Shouldn't get here. */
+PSEUDO_END(__exit_thread)
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/faccessat.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/faccessat.c
new file mode 100644
index 0000000000..9648352ca5
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/faccessat.c
@@ -0,0 +1,107 @@
+/* Test for access to file, relative to open directory. OpenSolaris version.
+ Copyright (C) 2006, 2009 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ OpenSolaris bits contributed by David Bartley
+ <dtbartle@csclub.uwaterloo.ca>, 2009.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <fcntl.h>
+#include <stddef.h>
+#include <unistd.h>
+#include <sys/types.h>
+
+#define E_OK 010
+
+DECLARE_INLINE_SYSCALL (int, accessat, int, const char *, int);
+
+int
+faccessat (fd, file, type, flag)
+ int fd;
+ const char *file;
+ int type;
+ int flag;
+{
+ if (file == NULL || (flag & ~(AT_EACCESS)) != 0
+ || (type & ~(R_OK|W_OK|X_OK|F_OK|E_OK)) != 0)
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ if (fd < 0 && fd != AT_FDCWD)
+ {
+ __set_errno (EBADF);
+ return -1;
+ }
+
+ if (flag & AT_EACCESS)
+ {
+ type |= E_OK;
+ }
+
+ int res = INLINE_SYSCALL (accessat, 3, fd, file, type);
+
+ /* XXX: This should really be fixed in the kernel. */
+ if (res == 0 && (type & X_OK))
+ {
+ uid_t uid;
+ gid_t gid;
+
+ uid = (type & E_OK) ? geteuid () : getuid ();
+ gid = (type & E_OK) ? getegid () : getgid ();
+ if (uid == 0 || gid == 0)
+ {
+ struct stat buf;
+
+ if (fstatat (fd, file, &buf, 0) != 0)
+ return -1;
+
+ /* Test user bit. */
+ if (uid == buf.st_uid)
+ {
+ if ((buf.st_mode & S_IXUSR) == 0)
+ {
+ __set_errno (EACCES);
+ return -1;
+ }
+ return 0;
+ }
+
+ /* Test gid bit. */
+ if (gid == buf.st_gid)
+ {
+ if ((buf.st_mode & S_IXGRP) == 0)
+ {
+ __set_errno (EACCES);
+ return -1;
+ }
+ return 0;
+ }
+
+ /* Test other bit. */
+ if ((buf.st_mode & S_IXOTH) == 0)
+ {
+ __set_errno (EACCES);
+ return -1;
+ }
+ return 0;
+ }
+ }
+
+ return res;
+}
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/fattach.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/fattach.c
new file mode 100644
index 0000000000..c2e77a7de9
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/fattach.c
@@ -0,0 +1,31 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <streams/stropts.h>
+#include <sys/mount.h>
+#include <stddef.h>
+
+int
+fattach (fildes, path)
+ int fildes;
+ const char *path;
+{
+ return mount (NULL, path, MS_DATA | MS_NOMNTTAB, "namefs",
+ (char*)&fildes, sizeof(int), NULL, 0);
+}
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/fcntl.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/fcntl.c
new file mode 100644
index 0000000000..ef8a0b968f
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/fcntl.c
@@ -0,0 +1,79 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sysdep-cancel.h>
+#include <inline-syscall.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <stdarg.h>
+#include <sys/ioctl.h>
+
+DECLARE_INLINE_SYSCALL (int, fcntl, int fd, int cmd, ...);
+
+int
+__fcntl_not_cancel (int fd, int cmd, ...)
+{
+ int res;
+ va_list ap;
+ void *arg;
+
+ va_start (ap, cmd);
+ arg = va_arg (ap, void *);
+ va_end (ap);
+
+ /* we need to handle some cmd's here since the kernel doesn't */
+ switch(cmd)
+ {
+ case F_GETOWN:
+ if(ioctl (fd, FIOGETOWN, &res) == -1)
+ return -1;
+ return res;
+ case F_SETOWN:
+ return ioctl (fd, FIOSETOWN, &arg);
+ default:
+ return INLINE_SYSCALL (fcntl, 3, fd, cmd, arg);
+ }
+}
+
+int
+__libc_fcntl (int fd, int cmd, ...)
+{
+ va_list ap;
+ void *arg;
+
+ va_start (ap, cmd);
+ arg = va_arg (ap, void *);
+ va_end (ap);
+
+ if (SINGLE_THREAD_P || cmd != F_SETLKW)
+ return __fcntl_not_cancel (fd, cmd, arg);
+
+ int oldtype = LIBC_CANCEL_ASYNC ();
+
+ int res = __fcntl_not_cancel (fd, cmd, arg);
+
+ LIBC_CANCEL_RESET (oldtype);
+
+ return res;
+}
+
+libc_hidden_def (__libc_fcntl)
+weak_alias (__libc_fcntl, __fcntl)
+libc_hidden_weak (__fcntl)
+weak_alias (__libc_fcntl, fcntl)
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/fdatasync.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/fdatasync.c
new file mode 100644
index 0000000000..2e7c117e84
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/fdatasync.c
@@ -0,0 +1,31 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sysdep-cancel.h>
+#include <inline-syscall.h>
+#include <sys/fcntl.h>
+
+DECLARE_INLINE_SYSCALL (int, fdsync, int fd, int flag);
+
+int
+fdatasync (int fildes)
+{
+ return INLINE_SYSCALL (fdsync, 2, fildes, FDSYNC);
+}
+LIBC_CANCEL_HANDLED (); /* sys_fdsync handles cancellation */
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/fdetach.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/fdetach.c
new file mode 100644
index 0000000000..bee9eec123
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/fdetach.c
@@ -0,0 +1,28 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <streams/stropts.h>
+#include <sys/mount.h>
+
+int
+fdetach (path)
+ const char *path;
+{
+ return umount2 (path, 0);
+}
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/fdwalk.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/fdwalk.c
new file mode 100644
index 0000000000..a03d2c8961
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/fdwalk.c
@@ -0,0 +1,69 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <stdlib.h>
+#include <dirent.h>
+#include <sys/resource.h>
+
+/* Docs: http://docs.sun.com/app/docs/doc/816-5168/fdwalk-3c */
+
+int fdwalk (int (*func)(void *, int), void *cd)
+{
+ int res = 0;
+ DIR *dir;
+
+ dir = opendir ("/proc/self/fd");
+ if (dir)
+ {
+ /* Note that fdwalk is not required to be thread-safe so we don't need to
+ use the _r version. */
+ struct dirent *dirent;
+ while ((dirent = readdir (dir)))
+ {
+ int fd;
+
+ if (dirent->d_name[0] == '.')
+ continue;
+ fd = atoi (dirent->d_name);
+ if (fd == dirfd (dir))
+ continue;
+ res = (*func)(cd, fd);
+ if (res != 0)
+ break;
+ }
+
+ (void) closedir (dir);
+ }
+ else
+ {
+ struct rlimit rlim;
+ int fd;
+
+ if (getrlimit (RLIMIT_NOFILE, &rlim) != 0)
+ return -1;
+ for (fd = 0; fd < rlim.rlim_max; fd++)
+ {
+ res = (*func)(cd, fd);
+ if (res != 0)
+ break;
+ }
+ }
+
+ return res;
+}
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/fexecve.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/fexecve.c
new file mode 100644
index 0000000000..53989cb878
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/fexecve.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/fexecve.c>
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/files-audit_user.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/files-audit_user.c
new file mode 100644
index 0000000000..e16735a161
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/files-audit_user.c
@@ -0,0 +1,43 @@
+/* User file parser in nss_files module.
+ Copyright (C) 1996, 1997, 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ OpenSolaris bits contributed by David Bartley
+ <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <auditP.h>
+
+#define STRUCTURE au_user_str_s
+#define ENTNAME auuser
+#define DATABASE "security/audit_user"
+struct auuserent_data {};
+
+#include "files-parse.c"
+LINE_PARSER
+(,
+ STRING_FIELD (result->au_name, ISCOLON, 0);
+ STRING_FIELD (result->au_always, ISCOLON, 0);
+ STRING_FIELD (result->au_never, ISCOLON, 0);
+ )
+
+#include GENERIC
+
+DB_LOOKUP (auusernam, 1 + strlen (name), (".%s", name),
+ {
+ if (! strcmp (name, result->au_name))
+ break;
+ }, const char *name)
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/files-auth_attr.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/files-auth_attr.c
new file mode 100644
index 0000000000..a931b6139d
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/files-auth_attr.c
@@ -0,0 +1,46 @@
+/* User file parser in nss_files module.
+ Copyright (C) 1996, 1997, 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ OpenSolaris bits contributed by David Bartley
+ <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <auth_attrP.h>
+
+#define STRUCTURE authstr_s
+#define ENTNAME authattr
+#define DATABASE "security/auth_attr"
+struct authattrent_data {};
+
+#include "files-parse.c"
+LINE_PARSER
+(,
+ STRING_FIELD (result->name, ISCOLON, 0);
+ STRING_FIELD (result->res1, ISCOLON, 0);
+ STRING_FIELD (result->res2, ISCOLON, 0);
+ STRING_FIELD (result->short_desc, ISCOLON, 0);
+ STRING_FIELD (result->long_desc, ISCOLON, 0);
+ STRING_FIELD (result->attr, ISCOLON, 0);
+ )
+
+#include GENERIC
+
+DB_LOOKUP (authnam, 1 + strlen (name), (".%s", name),
+ {
+ if (! strcmp (name, result->name))
+ break;
+ }, const char *name)
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/files-bootparams.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/files-bootparams.c
new file mode 100644
index 0000000000..70b786d12e
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/files-bootparams.c
@@ -0,0 +1 @@
+// TODO
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/files-exec_attr.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/files-exec_attr.c
new file mode 100644
index 0000000000..d5af56e28c
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/files-exec_attr.c
@@ -0,0 +1,48 @@
+/* User file parser in nss_files module.
+ Copyright (C) 1996, 1997, 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ OpenSolaris bits contributed by David Bartley
+ <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <exec_attrP.h>
+
+#define STRUCTURE execstr_s
+#define ENTNAME execattr
+#define DATABASE "security/exec_attr"
+struct execattrent_data {};
+
+#include "files-parse.c"
+LINE_PARSER
+(,
+ STRING_FIELD (result->name, ISCOLON, 0);
+ STRING_FIELD (result->policy, ISCOLON, 0);
+ STRING_FIELD (result->type, ISCOLON, 0);
+ STRING_FIELD (result->res1, ISCOLON, 0);
+ STRING_FIELD (result->res2, ISCOLON, 0);
+ STRING_FIELD (result->id, ISCOLON, 0);
+ STRING_FIELD (result->attr, ISCOLON, 0);
+ result->next = NULL;
+ )
+
+#include GENERIC
+
+DB_LOOKUP (execnam, 1 + strlen (name), (".%s", name),
+ {
+ if (! strcmp (name, result->name))
+ break;
+ }, const char *name)
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/files-netmasks.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/files-netmasks.c
new file mode 100644
index 0000000000..70b786d12e
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/files-netmasks.c
@@ -0,0 +1 @@
+// TODO
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/files-printers.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/files-printers.c
new file mode 100644
index 0000000000..70b786d12e
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/files-printers.c
@@ -0,0 +1 @@
+// TODO
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/files-prof_attr.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/files-prof_attr.c
new file mode 100644
index 0000000000..cd20d637c2
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/files-prof_attr.c
@@ -0,0 +1,45 @@
+/* User file parser in nss_files module.
+ Copyright (C) 1996, 1997, 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ OpenSolaris bits contributed by David Bartley
+ <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <prof_attrP.h>
+
+#define STRUCTURE profstr_s
+#define ENTNAME profattr
+#define DATABASE "security/prof_attr"
+struct profattrent_data {};
+
+#include "files-parse.c"
+LINE_PARSER
+(,
+ STRING_FIELD (result->name, ISCOLON, 0);
+ STRING_FIELD (result->res1, ISCOLON, 0);
+ STRING_FIELD (result->res2, ISCOLON, 0);
+ STRING_FIELD (result->desc, ISCOLON, 0);
+ STRING_FIELD (result->attr, ISCOLON, 0);
+ )
+
+#include GENERIC
+
+DB_LOOKUP (profnam, 1 + strlen (name), (".%s", name),
+ {
+ if (! strcmp (name, result->name))
+ break;
+ }, const char *name)
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/files-project.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/files-project.c
new file mode 100644
index 0000000000..1fed2dc0b1
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/files-project.c
@@ -0,0 +1,47 @@
+/* User file parser in nss_files module.
+ Copyright (C) 1996, 1997, 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ OpenSolaris bits contributed by David Bartley
+ <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <projectP.h>
+
+#define STRUCTURE project
+#define ENTNAME proj
+#define DATABASE "project"
+struct projent_data {};
+
+#include "files-parse.c"
+// TODO: need to split out pj_users and pj_groups
+LINE_PARSER
+(,
+ STRING_FIELD (result->pj_name, ISCOLON, 0);
+ INT_FIELD (result->pj_projid, ISCOLON, 0, 10, (projid_t));
+ STRING_FIELD (result->pj_comment, ISCOLON, 0);
+ STRING_FIELD (result->pj_users, ISCOLON, 0);
+ STRING_FIELD (result->pj_groups, ISCOLON, 0);
+ STRING_FIELD (result->pj_attr, ISCOLON, 0);
+ )
+
+#include GENERIC
+
+DB_LOOKUP (projnam, 1 + strlen (name), (".%s", name),
+ {
+ if (! strcmp (name, result->pj_name))
+ break;
+ }, const char *name)
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/files-user_attr.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/files-user_attr.c
new file mode 100644
index 0000000000..0a4c5736e2
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/files-user_attr.c
@@ -0,0 +1,39 @@
+/* User file parser in nss_files module.
+ Copyright (C) 1996, 1997, 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ OpenSolaris bits contributed by David Bartley
+ <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <user_attrP.h>
+
+#define STRUCTURE userstr_s
+#define ENTNAME userattr
+#define DATABASE "user_attr"
+struct userattrent_data {};
+
+/* Our parser function is already defined in _fgetuserattr.c, so use that
+ to parse lines from the database file. */
+#define EXTERN_PARSER
+#include "files-parse.c"
+#include GENERIC
+
+DB_LOOKUP (usernam, 1 + strlen (name), (".%s", name),
+ {
+ if (! strcmp (name, result->name))
+ break;
+ }, const char *name)
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/fork.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/fork.c
new file mode 100644
index 0000000000..6b6b96f672
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/fork.c
@@ -0,0 +1,45 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <inline-syscall.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <sysdep.h>
+
+DECLARE_INLINE_SYSCALL (int64_t, forkx, int flags);
+
+pid_t
+__libc_fork (void)
+{
+ rval_t res;
+ res.rval64 = INLINE_SYSCALL (forkx, 1, 0);
+
+ /* Only the lower 32-bits are set to -1 on error (see NOTES.opensolaris). */
+ if (res.rval1 == -1)
+ return (pid_t)-1;
+ else if (res.rval2 != 0)
+ return 0;
+ else
+ return (pid_t)res.rval1;
+}
+weak_alias (__libc_fork, __fork)
+libc_hidden_def (__fork)
+weak_alias (__libc_fork, fork)
+weak_alias (__libc_fork, fork1)
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/fstab.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/fstab.c
new file mode 100644
index 0000000000..c59a96ed0f
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/fstab.c
@@ -0,0 +1 @@
+/* This is here so that we don't compile the default fstab.c. */
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/fstatfs.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/fstatfs.c
new file mode 100644
index 0000000000..670f93e315
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/fstatfs.c
@@ -0,0 +1,7 @@
+#define STATFS_FUNC __fstatfs
+#define STATFS_STRUCT struct statfs
+#define STATVFS_FUNC __fstatvfs
+#define STATVFS_STRUCT struct statvfs
+#define STATFS_ARG int
+#include "sysdeps/unix/sysv/solaris2/kopensolaris-gnu/statfs_common.c"
+weak_alias (__fstatfs, fstatfs)
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/fstatfs64.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/fstatfs64.c
new file mode 100644
index 0000000000..2daf84c2ea
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/fstatfs64.c
@@ -0,0 +1,7 @@
+#define STATFS_FUNC __fstatfs64
+#define STATFS_STRUCT struct statfs64
+#define STATVFS_FUNC __fstatvfs64
+#define STATVFS_STRUCT struct statvfs64
+#define STATFS_ARG int
+#include "sysdeps/unix/sysv/solaris2/kopensolaris-gnu/statfs_common.c"
+weak_alias (__fstatfs64, fstatfs64)
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/fsync.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/fsync.c
new file mode 100644
index 0000000000..b8683f4d6a
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/fsync.c
@@ -0,0 +1,32 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sysdep-cancel.h>
+#include <inline-syscall.h>
+#include <sys/fcntl.h>
+
+DECLARE_INLINE_SYSCALL (int, fdsync, int fd, int flag);
+
+int
+fsync (fd)
+ int fd;
+{
+ return INLINE_SYSCALL (fdsync, 2, fd, FSYNC);
+}
+LIBC_CANCEL_HANDLED (); /* sys_fdsync handles cancellation */
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/ftime.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/ftime.c
new file mode 100644
index 0000000000..dd763fbfd4
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/ftime.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/bsd/ftime.c>
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/ftruncate.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/ftruncate.c
new file mode 100644
index 0000000000..da45d4e987
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/ftruncate.c
@@ -0,0 +1,36 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <not-cancel.h>
+#include <sys/types.h>
+#include <sys/fcntl.h>
+
+int
+__ftruncate (int fd, off_t length)
+{
+ struct flock fl;
+ fl.l_whence = 0;
+ fl.l_len = 0;
+ fl.l_start = length;
+ fl.l_type = F_WRLCK;
+
+ return fcntl_not_cancel (fd, F_FREESP, &fl);
+}
+
+weak_alias (__ftruncate, ftruncate)
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/ftruncate64.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/ftruncate64.c
new file mode 100644
index 0000000000..9f4a7299f6
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/ftruncate64.c
@@ -0,0 +1,36 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <not-cancel.h>
+#include <sys/types.h>
+#include <sys/fcntl.h>
+
+int
+__ftruncate64 (int fd, off64_t length)
+{
+ struct flock64 fl;
+ fl.l_whence = 0;
+ fl.l_len = 0;
+ fl.l_start = length;
+ fl.l_type = F_WRLCK;
+
+ return fcntl_not_cancel (fd, F_FREESP64, &fl);
+}
+
+weak_alias (__ftruncate64, ftruncate64)
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/futimes.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/futimes.c
new file mode 100644
index 0000000000..da751ddaeb
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/futimes.c
@@ -0,0 +1,46 @@
+/* futimes -- change access and modification times of open file.
+ OpenSolaris version.
+ Copyright (C) 2002,2003,2005,2006,2007,2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ OpenSolaris bits contributed by David Bartley
+ <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <sysdep.h>
+#include <string.h>
+#include <time.h>
+#include <utime.h>
+#include <sys/time.h>
+#include <stdio-common/_itoa.h>
+#include <fcntl.h>
+
+/* Change the access time of the file associated with FD to TVP[0] and
+ the modification time of FILE to TVP[1]. */
+int
+__futimes (int fd, const struct timeval tvp[2])
+{
+ static const char selffd[] = "/proc/self/fd/";
+ char fname[sizeof (selffd) + 3 * sizeof (int)];
+ fname[sizeof (fname) - 1] = '\0';
+ char *cp = _itoa_word ((unsigned int) fd, fname + sizeof (fname) - 1, 10, 0);
+ cp = memcpy (cp - sizeof (selffd) + 1, selffd, sizeof (selffd) - 1);
+
+ return utimes (cp, tvp);
+}
+
+weak_alias (__futimes, futimes)
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/fxstat.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/fxstat.c
new file mode 100644
index 0000000000..1eac7909d8
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/fxstat.c
@@ -0,0 +1,39 @@
+/* Copyright (C) 1991, 1995, 1996, 1997, 2002, 2008
+ Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <inline-syscall.h>
+#include <sys/stat.h>
+#include <errno.h>
+#include <bp-checks.h>
+
+DECLARE_INLINE_SYSCALL (int, fstat, int filedes, struct stat *buf);
+
+int
+__fxstat (int vers, int fd, struct stat *buf)
+{
+ if(vers != _STAT_VER)
+ {
+ __set_errno (ENOSYS);
+ return -1;
+ }
+
+ return INLINE_SYSCALL (fstat, 2, fd, CHECK_1 (buf));
+}
+
+hidden_def (__fxstat)
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/fxstat64.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/fxstat64.c
new file mode 100644
index 0000000000..ebf02d8a50
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/fxstat64.c
@@ -0,0 +1,39 @@
+/* Copyright (C) 1991, 1995, 1996, 1997, 2002, 2008
+ Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <inline-syscall.h>
+#include <sys/stat.h>
+#include <errno.h>
+#include <bp-checks.h>
+
+DECLARE_INLINE_SYSCALL (int, fstat64, int filedes, struct stat64 *buf);
+
+int
+__fxstat64 (int vers, int fd, struct stat64 *buf)
+{
+ if(vers != _STAT_VER)
+ {
+ __set_errno(ENOSYS);
+ return -1;
+ }
+
+ return INLINE_SYSCALL (fstat64, 2, fd, CHECK_1 (buf));
+}
+
+hidden_def (__fxstat64)
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/fxstatat.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/fxstatat.c
new file mode 100644
index 0000000000..5d89db1515
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/fxstatat.c
@@ -0,0 +1,40 @@
+/* Copyright (C) 2005, 2006, 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <inline-syscall.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <stddef.h>
+#include <sys/stat.h>
+#include <bp-checks.h>
+
+DECLARE_INLINE_SYSCALL (int, fstatat, int fd, const char *name,
+ struct stat *sb, int flags);
+
+int
+__fxstatat (int vers, int fd, const char *filename, struct stat *buf, int flag)
+{
+ if (vers != _STAT_VER)
+ {
+ __set_errno(ENOSYS);
+ return -1;
+ }
+
+ return INLINE_SYSCALL (fstatat, 2, fd, filename, CHECK_1 (buf), flag);
+}
+libc_hidden_def (__fxstatat)
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/fxstatat64.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/fxstatat64.c
new file mode 100644
index 0000000000..27a6277653
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/fxstatat64.c
@@ -0,0 +1,43 @@
+/* Copyright (C) 2005, 2006, 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <inline-syscall.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <stddef.h>
+#include <sys/stat.h>
+#include <bp-checks.h>
+
+DECLARE_INLINE_SYSCALL (int, fstatat64, int fd, const char *name,
+ struct stat64 *sb, int flags);
+
+/* Get information about the file descriptor FD in BUF. */
+int
+__fxstatat64 (int vers, int fd, const char *filename, struct stat64 *buf,
+ int flag)
+{
+ if (vers != _STAT_VER)
+ {
+ __set_errno(ENOSYS);
+ return -1;
+ }
+
+ return INLINE_SYSCALL (fstatat64, 2, fd, filename, CHECK_1 (buf), flag);
+}
+
+libc_hidden_def (__fxstatat64)
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/gai_sigqueue.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/gai_sigqueue.c
new file mode 100644
index 0000000000..3821f34c6b
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/gai_sigqueue.c
@@ -0,0 +1,34 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <inline-syscall.h>
+#include "gai_misc.h"
+#include <signal.h>
+
+DECLARE_INLINE_SYSCALL (int, sigqueue, pid_t pid, int sig,
+ const union sigval value, int si_code, int block);
+
+int
+__gai_sigqueue (sig, val, caller_pid)
+ int sig;
+ const union sigval val;
+ pid_t caller_pid;
+{
+ return INLINE_SYSCALL (sigqueue, 5, caller_pid, sig, val, SI_QUEUE, 1);
+}
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/get_child_max.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/get_child_max.c
new file mode 100644
index 0000000000..f7f437e727
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/get_child_max.c
@@ -0,0 +1,28 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sys/sysconfig.h>
+
+extern long _sysconfig (int which);
+
+long int
+__get_child_max (void)
+{
+ return _sysconfig (_CONFIG_CHILD_MAX);
+}
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/getclktck.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/getclktck.c
new file mode 100644
index 0000000000..57215935e1
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/getclktck.c
@@ -0,0 +1,36 @@
+/* Copyright (C) 2000, 2002, 2004, 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <time.h>
+#include <ldsodefs.h>
+#include <sys/sysconfig.h>
+
+extern long _sysconfig (int which);
+
+/* Return frequency of times(). */
+int
+__getclktck ()
+{
+#ifdef HAVE_AUX_VECTOR
+ /* Did the kernel pass the clktck in the elf header? */
+ if (GLRO(dl_clktck) != 0)
+ return GLRO(dl_pagesize);
+#endif
+
+ return (int)_sysconfig (_CONFIG_CLK_TCK);
+}
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/getcwd.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/getcwd.c
new file mode 100644
index 0000000000..c353cf0be5
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/getcwd.c
@@ -0,0 +1,86 @@
+/* Determine current working directory. OpenSolaris version.
+ Copyright (C) 1997,1998,1999,2000,2002,2003,2006,2008
+ Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Based on Linux version contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+ OpenSolaris bits contributed by David Bartley
+ <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <inline-syscall.h>
+#include <errno.h>
+#include <unistd.h>
+#include <stddef.h>
+#include <limits.h>
+#include <memory.h>
+#include <bp-checks.h>
+#include <signal.h>
+#include <assert.h>
+#include <bits/libc-lock.h>
+
+DECLARE_INLINE_SYSCALL (int, getcwd, char *buf, size_t buflen);
+
+#ifndef MAX
+# define MAX(a, b) ((a) < (b) ? (b) : (a))
+#endif
+
+/* If we compile the file for use in ld.so we don't need the feature
+ that getcwd() allocates the buffers itself. */
+#ifdef IS_IN_rtld
+# define NO_ALLOCATION 1
+#endif
+
+char *
+__getcwd (char *buf, size_t size)
+{
+ char *path;
+
+#ifndef NO_ALLOCATION
+ size_t alloc_size = size;
+ if (size == 0)
+ {
+ if (buf != NULL)
+ {
+ __set_errno (EINVAL);
+ return NULL;
+ }
+ alloc_size = MAX (PATH_MAX, __getpagesize ());
+ }
+
+ if (buf == NULL)
+ {
+ path = malloc (alloc_size);
+ if (path == NULL)
+ return NULL;
+ }
+ else
+#else
+# define alloc_size size
+#endif
+ path = buf;
+
+ if (INLINE_SYSCALL (getcwd, 2, CHECK_STRING (path), alloc_size) == -1)
+ {
+ if (buf == NULL && path != NULL)
+ free(path);
+ path = NULL;
+ }
+
+ return path;
+}
+
+weak_alias (__getcwd, getcwd)
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/getdents.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/getdents.c
new file mode 100644
index 0000000000..73c8b5e5bd
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/getdents.c
@@ -0,0 +1,32 @@
+/* Copyright (C) 2009 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sys/types,h>
+
+#define __KERNEL_DIRENT
+struct kernel_dirent
+ {
+ __ino_t d_ino;
+ __off_t d_off;
+ unsigned short d_reclen;
+ char d_name[1];
+ };
+#endif
+
+#include <sysdeps/unix/sysv/linux/getdents.c>
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/getdents64.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/getdents64.c
new file mode 100644
index 0000000000..562e169fc2
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/getdents64.c
@@ -0,0 +1,34 @@
+/* Copyright (C) 2009 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sys/types,h>
+
+#define __KERNEL_DIRENT
+struct kernel_dirent
+ {
+ __ino64_t d_ino;
+ __off64_t d_off;
+ unsigned short d_reclen;
+ char d_name[1];
+ };
+#endif
+
+#define __GETDENTS __getdents64
+#define DIRENT_TYPE struct dirent64
+#include <sysdeps/unix/sysv/linux/getdents.c>
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/getdirentries.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/getdirentries.c
new file mode 100644
index 0000000000..38ce200b76
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/getdirentries.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/getdirentries.c>
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/getdirentries64.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/getdirentries64.c
new file mode 100644
index 0000000000..39d58d8781
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/getdirentries64.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/getdirentries64.c>
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/getdomain.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/getdomain.c
new file mode 100644
index 0000000000..103dfa2d09
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/getdomain.c
@@ -0,0 +1,31 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <unistd.h>
+#include <sys/systeminfo.h>
+
+int
+getdomainname (char *name, size_t len)
+{
+ /* Systeminfo returns the domain length on success but we want to return
+ zero on success. */
+ return sysinfo (SI_SRPC_DOMAIN, name, len) == -1 ? -1 : 0;
+}
+
+libc_hidden_def (getdomainname)
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/getdtsz.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/getdtsz.c
new file mode 100644
index 0000000000..c50d1013d3
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/getdtsz.c
@@ -0,0 +1,29 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sys/sysconfig.h>
+
+extern long _sysconfig (int which);
+
+int
+__getdtablesize (void)
+{
+ return (int)_sysconfig (_CONFIG_OPEN_FILES);
+}
+weak_alias (__getdtablesize, getdtablesize)
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/getexecname.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/getexecname.c
new file mode 100644
index 0000000000..dba963205f
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/getexecname.c
@@ -0,0 +1,28 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+/* Docs: http://docs.sun.com/app/docs/doc/816-5168/getexecname-3c */
+
+#include <stdlib.h>
+#include <ldsodefs.h>
+
+const char * getexecname (void)
+{
+ return GLRO(dl_sun_execname);
+}
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/gethostent.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/gethostent.c
new file mode 100644
index 0000000000..c97a26e742
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/gethostent.c
@@ -0,0 +1,50 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netdb.h>
+
+/* XXX: These are not reentrant. */
+
+struct hostent *getipnodebyname (const char *name, int af, int flags,
+ int *error_num)
+{
+ /* XXX: We ignore flags. */
+ struct hostent *hostent = gethostbyname2 (name, af);
+ if (!hostent && error_num)
+ *error_num = h_errno;
+ return hostent;
+}
+
+
+struct hostent *getipnodebyaddr (const void *addr, size_t len, int af,
+ int *error_num)
+{
+ struct hostent *hostent = gethostbyaddr (addr, len, af);
+ if (!hostent && error_num)
+ *error_num = h_errno;
+ return hostent;
+}
+
+
+void freehostent (struct hostent *ip)
+{
+ /* This does nothing by design. */
+}
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/gethostid.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/gethostid.c
new file mode 100644
index 0000000000..7aab664486
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/gethostid.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/gethostid.c>
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/gethostname.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/gethostname.c
new file mode 100644
index 0000000000..64826ae21d
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/gethostname.c
@@ -0,0 +1,33 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <unistd.h>
+#include <sys/systeminfo.h>
+
+int
+__gethostname (name, len)
+ char *name;
+ size_t len;
+{
+ /* Systeminfo returns the hostname length on success but we want to return
+ zero on success. */
+ return sysinfo (SI_HOSTNAME, name, len) == -1 ? -1 : 0;
+}
+
+weak_alias (__gethostname, gethostname)
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/gethrtime.S b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/gethrtime.S
new file mode 100644
index 0000000000..2ef92ea45f
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/gethrtime.S
@@ -0,0 +1,6 @@
+#include <sysdep.h>
+#include <sys/trap.h>
+
+PSEUDO_FASTTRAP (gethrtime, GETHRTIME, 0)
+ ret
+PSEUDO_END (gethrtime)
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/gethrvtime.S b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/gethrvtime.S
new file mode 100644
index 0000000000..6cd8d36cfe
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/gethrvtime.S
@@ -0,0 +1,6 @@
+#include <sysdep.h>
+#include <sys/trap.h>
+
+PSEUDO_FASTTRAP (gethrvtime, GETHRVTIME, 0)
+ ret
+PSEUDO_END (gethrvtime)
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/getipv4sourcefilter.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/getipv4sourcefilter.c
new file mode 100644
index 0000000000..5f17ba2b57
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/getipv4sourcefilter.c
@@ -0,0 +1,64 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <netinet/in.h>
+#include <alloca.h>
+#include <stdlib.h>
+#include <sys/ioctl.h>
+#include <sys/param.h>
+#include <string.h>
+
+
+int
+getipv4sourcefilter (int s, struct in_addr interface, struct in_addr group,
+ uint32_t *fmode, uint32_t *numsrc, struct in_addr *slist)
+{
+ /* The kernel assumes at least one in_addr. */
+ int imsf_len = IP_MSFILTER_SIZE (*numsrc ?: 1);
+ int use_alloca = __libc_use_alloca (imsf_len);
+ struct ip_msfilter *imsf;
+ if (use_alloca)
+ imsf = alloca (imsf_len);
+ else
+ {
+ imsf = malloc (imsf_len);
+ if (!imsf)
+ return -1;
+ }
+
+ imsf->imsf_multiaddr = group;
+ imsf->imsf_interface = interface;
+ imsf->imsf_numsrc = *numsrc;
+
+ int res = ioctl (s, SIOCGIPMSFILTER, imsf);
+ if (res == -1)
+ {
+ if (!use_alloca)
+ free (imsf);
+ return -1;
+ }
+
+ *fmode = imsf->imsf_fmode;
+ *numsrc = MIN (imsf->imsf_numsrc, *numsrc);
+ memcpy (slist, imsf->imsf_slist, *numsrc * sizeof (struct in_addr));
+
+ if (!use_alloca)
+ free (imsf);
+ return 0;
+}
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/getloadavg.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/getloadavg.c
new file mode 100644
index 0000000000..9bc0aeb852
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/getloadavg.c
@@ -0,0 +1,41 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <inline-syscall.h>
+#include <sys/loadavg.h>
+
+DECLARE_INLINE_SYSCALL (int, getloadavg, int *buf, int nelem);
+
+int
+getloadavg (double loadavg[], int nelem)
+{
+ int buf[LOADAVG_NSTATS], i;
+
+ if (nelem > LOADAVG_NSTATS)
+ nelem = LOADAVG_NSTATS;
+ int result = INLINE_SYSCALL (getloadavg, 2, buf, nelem);
+ if (result == -1)
+ return -1;
+
+ /* the results from the kernel are scaled by a factor of 256 */
+ for(i = 0; i < nelem; i++)
+ loadavg[i] = (double)buf[i] / 256;
+
+ return nelem;
+}
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/getpagesize.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/getpagesize.c
new file mode 100644
index 0000000000..59cbebd67f
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/getpagesize.c
@@ -0,0 +1,39 @@
+/* Copyright (C) 1991,1992,1995-1997,2000,2002,2004,2008
+ Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <unistd.h>
+#include <sys/param.h>
+#include <sys/sysconfig.h>
+#include <ldsodefs.h>
+
+extern long _sysconfig (int which);
+
+int
+__getpagesize ()
+{
+#ifdef HAVE_AUX_VECTOR
+ /* Did the kernel pass the pagesize in the elf header? */
+ if (GLRO(dl_pagesize) != 0)
+ return GLRO(dl_pagesize);
+#endif
+
+ return (int)_sysconfig (_CONFIG_PAGESIZE);
+}
+libc_hidden_def (__getpagesize)
+weak_alias (__getpagesize, getpagesize)
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/getpeername.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/getpeername.c
new file mode 100644
index 0000000000..bcbe0a100e
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/getpeername.c
@@ -0,0 +1,35 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <inline-syscall.h>
+#include <sys/socket.h>
+
+extern int _so_getpeername (int sock, __SOCKADDR_ARG name, socklen_t *namelenp,
+ int version);
+
+int
+__getpeername (fd, addr, len)
+ int fd;
+ __SOCKADDR_ARG addr;
+ socklen_t *len;
+{
+ return _so_getpeername (fd, addr, len, SOV_XPG4_2);
+}
+
+weak_alias (__getpeername, getpeername)
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/getpriority.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/getpriority.c
new file mode 100644
index 0000000000..e4c693ab24
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/getpriority.c
@@ -0,0 +1,47 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sys/time.h>
+#include <sys/resource.h>
+#include <sys/procset.h>
+#include <sys/priocntl.h>
+#include <limits.h>
+#include <errno.h>
+#include <priorityP.h>
+
+int
+getpriority (enum __priority_which which, id_t who)
+{
+ idtype_t type = __prio_to_p (which);
+ if (type == -1)
+ return -1;
+
+ if(who == 0)
+ who = P_MYID;
+
+ pcnice_t nice;
+ nice.pc_val = 0;
+ nice.pc_op = PC_GETNICE;
+ if (priocntl (type, who, PC_DONICE, &nice) == -1)
+ return -1;
+
+ return nice.pc_val;
+}
+
+libc_hidden_def (getpriority)
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/getpt.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/getpt.c
new file mode 100644
index 0000000000..5b4412b85b
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/getpt.c
@@ -0,0 +1,37 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <stdlib.h>
+#include <fcntl.h>
+
+#define _PATH_DEVPTMX "/dev/ptmx"
+
+int __getpt (void)
+{
+ return open (_PATH_DEVPTMX, O_RDWR);
+}
+weak_alias (__getpt, getpt)
+
+int
+__posix_openpt (oflag)
+ int oflag;
+{
+ return open (_PATH_DEVPTMX, oflag);
+}
+weak_alias (__posix_openpt, posix_openpt)
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/getrusage.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/getrusage.c
new file mode 100644
index 0000000000..ddfba7dc62
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/getrusage.c
@@ -0,0 +1,52 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sys/time.h>
+#include <sys/resource.h>
+#include <sys/syscall.h>
+#include <errno.h>
+
+DECLARE_INLINE_SYSCALL (int, rusagesys, int cmd, ...);
+
+int
+__getrusage (who, usage)
+ enum __rusage_who who;
+ struct rusage *usage;
+{
+ int cmd;
+ switch (who)
+ {
+ case RUSAGE_SELF:
+ cmd = SYS_SUB_getrusage;
+ break;
+ case RUSAGE_LWP:
+ cmd = SYS_SUB_getrusage_lwp;
+ break;
+ case RUSAGE_CHILDREN:
+ cmd = SYS_SUB_getrusage_chld;
+ break;
+ default:
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ return INLINE_SYSCALL (rusagesys, 2, cmd, usage);
+}
+
+weak_alias (__getrusage, getrusage)
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/getsockname.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/getsockname.c
new file mode 100644
index 0000000000..8a066d8aaf
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/getsockname.c
@@ -0,0 +1,36 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <inline-syscall.h>
+#include <sys/socket.h>
+
+extern int _so_getsockname (int sock, __SOCKADDR_ARG name, socklen_t *namelenp,
+ int version);
+
+/* Put the local address of FD into *ADDR and its length in *LEN. */
+int
+__getsockname (fd, addr, len)
+ int fd;
+ __SOCKADDR_ARG addr;
+ socklen_t *len;
+{
+ return _so_getsockname (fd, addr, len, SOV_XPG4_2);
+}
+
+weak_alias (__getsockname, getsockname)
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/getsockopt.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/getsockopt.c
new file mode 100644
index 0000000000..91e5d33b37
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/getsockopt.c
@@ -0,0 +1,35 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <inline-syscall.h>
+#include <sys/socket.h>
+
+extern int _so_getsockopt(int sock, int level, int option_name,
+ void *option_value, socklen_t *option_lenp, int version);
+
+int
+getsockopt (fd, level, optname, optval, optlen)
+ int fd;
+ int level;
+ int optname;
+ void *optval;
+ socklen_t *optlen;
+{
+ return _so_getsockopt (fd, level, optname, optval, optlen, SOV_XPG4_2);
+}
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/getsourcefilter.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/getsourcefilter.c
new file mode 100644
index 0000000000..900cc1abbf
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/getsourcefilter.c
@@ -0,0 +1,72 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <netinet/in.h>
+#include <alloca.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <sys/ioctl.h>
+#include <sys/param.h>
+#include <string.h>
+
+
+int
+getsourcefilter (int s, uint32_t interface, const struct sockaddr *group,
+ socklen_t grouplen, uint32_t *fmode, uint32_t *numsrc,
+ struct sockaddr_storage *slist)
+{
+ if (grouplen < SA_LEN (group))
+ {
+ __set_errno (ENOPROTOOPT);
+ return -1;
+ }
+
+ /* The kernel assumes at least one sockaddr_storage. */
+ int gf_len = GROUP_FILTER_SIZE (*numsrc ?: 1);
+ int use_alloca = __libc_use_alloca (gf_len);
+ struct group_filter *gf;
+ if (use_alloca)
+ gf = alloca (gf_len);
+ else
+ {
+ gf = malloc (gf_len);
+ if (!gf)
+ return -1;
+ }
+
+ gf->gf_interface = interface;
+ memcpy (&gf->gf_group, group, SA_LEN (group));
+ gf->gf_numsrc = *numsrc;
+
+ int res = ioctl (s, SIOCGMSFILTER, gf);
+ if (res == -1)
+ {
+ if (!use_alloca)
+ free (gf);
+ return -1;
+ }
+
+ *fmode = gf->gf_fmode;
+ *numsrc = MIN (gf->gf_numsrc, *numsrc);
+ memcpy (slist, gf->gf_slist, *numsrc * sizeof (struct sockaddr_storage));
+
+ if (!use_alloca)
+ free (gf);
+ return 0;
+}
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/getsysstats.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/getsysstats.c
new file mode 100644
index 0000000000..968d9cef59
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/getsysstats.c
@@ -0,0 +1,54 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sys/sysinfo.h>
+#include <sys/sysconfig.h>
+
+extern long _sysconfig (int which);
+
+int
+__get_nprocs ()
+{
+ return (int)_sysconfig (_CONFIG_NPROC_ONLN);
+}
+weak_alias (__get_nprocs, get_nprocs)
+
+
+int
+__get_nprocs_conf ()
+{
+ return (int)_sysconfig (_CONFIG_NPROC_CONF);
+}
+weak_alias (__get_nprocs_conf, get_nprocs_conf)
+
+
+long int
+__get_phys_pages ()
+{
+ return (int)_sysconfig (_CONFIG_PHYS_PAGES);
+}
+weak_alias (__get_phys_pages, get_phys_pages)
+
+
+long int
+__get_avphys_pages ()
+{
+ return (int)_sysconfig (_CONFIG_AVPHYS_PAGES);
+}
+weak_alias (__get_avphys_pages, get_avphys_pages)
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/grantpt.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/grantpt.c
new file mode 100644
index 0000000000..2eb2479df7
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/grantpt.c
@@ -0,0 +1,86 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <unistd.h>
+#include <streams/stropts.h>
+#include <sys/ptms.h>
+#include <grp.h>
+#include <stddef.h>
+#include <memory.h>
+#include <errno.h>
+
+#define INIT_GROUP_LEN 0x0100
+#define MAX_GROUP_LEN 0x8000
+
+int
+grantpt (int fd)
+{
+ pt_own_t pto;
+ pto.pto_ruid = getuid ();
+ pto.pto_rgid = -1;
+
+ /* Keep calling getgrnam with a bigger buffer. */
+ size_t len = INIT_GROUP_LEN;
+ char *buf = NULL;
+ struct group gr, *gro;
+ do
+ {
+ buf = realloc (buf, len);
+ if (!buf)
+ {
+ /* If we can't allocate 64 KB something is wrong. */
+ free(buf);
+ return -1;
+ }
+ gro = NULL;
+ int result = getgrnam_r ("tty", &gr, buf, len, &gro);
+ if(result == 0)
+ {
+ /* No entry found. */
+ if(gro == NULL)
+ break;
+ pto.pto_rgid = gro->gr_gid;
+ }
+ else if (errno != EINTR && errno != ERANGE && errno != ENOMEM)
+ {
+ /* Unknown error - assume failure. */
+ break;
+ }
+
+ len <<= 1;
+ }
+ while (len < MAX_GROUP_LEN);
+ free (buf);
+
+ /* If getgrnam fails we use the user's gid. */
+ if (pto.pto_rgid == -1)
+ pto.pto_rgid = getgid ();
+
+ /* Send OWNERPT down. */
+ struct strioctl si;
+ si.ic_cmd = OWNERPT;
+ si.ic_timout = 0;
+ si.ic_len = sizeof (pt_own_t);
+ si.ic_dp = (char *)&pto;
+
+ int res = (ioctl (fd, I_STR, &si) < 0) ? -1 : 0;
+ if (res != 0 && errno == ENOTTY)
+ __set_errno (EINVAL);
+ return res;
+}
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/htonll.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/htonll.c
new file mode 100644
index 0000000000..9c8e82adf4
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/htonll.c
@@ -0,0 +1,37 @@
+/* Copyright (C) 1993,97,2002,2009 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <netinet/in.h>
+#include <sys/byteorder.h>
+
+#undef htonll
+#undef ntohll
+
+uint64_t
+htonll (x)
+ uint64_t x;
+{
+#if BYTE_ORDER == BIG_ENDIAN
+ return x;
+#elif BYTE_ORDER == LITTLE_ENDIAN
+ return __bswap_64 (x);
+#else
+# error "What kind of system is this?"
+#endif
+}
+weak_alias (htonll, ntohll)
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/i386/Implies b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/i386/Implies
new file mode 100644
index 0000000000..772b20e20f
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/i386/Implies
@@ -0,0 +1 @@
+unix/sysv/solaris2/kopensolaris-gnu/x86
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/i386/Makefile b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/i386/Makefile
new file mode 100644
index 0000000000..91bd35800a
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/i386/Makefile
@@ -0,0 +1,3 @@
+ifeq ($(subdir),stdlib)
+gen-as-const-headers += ucontext_i.sym
+endif
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/i386/__door_return.S b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/i386/__door_return.S
new file mode 100644
index 0000000000..0eb08da270
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/i386/__door_return.S
@@ -0,0 +1,77 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sysdep.h>
+#include "door-offsets.h"
+
+/* The door_return call serves two purposes. First, it is called to transfer
+ the results of a door server back to the client. Second, it waits for a
+ client to pass in results destined for the server. The first part involves
+ no tricks; we simply call into the kernel. When the syscall returns, our
+ stack will have been adjusted; client args will have been copied onto the
+ stack. The stack pointer itself points to a struct door_results.
+
+ For the second part, we need to pass the door results to the server
+ function. The first few fields of door_results matches the arguments of
+ the server function (probably by design) so we can just call the server
+ function.
+
+ Since servers may block for any reason and to handle high-load doors, we
+ create a new server thread whenever there are none in the thread pool. */
+
+ENTRY (__door_return)
+L(restart):
+ DO_CALL (door, 6)
+
+ /* Check for error. */
+ jb SYSCALL_ERROR_LABEL;
+
+ /* TODO: adjust cfi. */
+
+ /* Check nservers. */
+ movl oDOOR_RESULTS_NSERVERS(%esp), %ecx
+ andl %ecx, %ecx
+ jg 1f
+
+ /* Create another server thread. */
+ movl oDOOR_RESULTS_DOOR_INFO(%esp), %ecx
+ pushl %ecx; cfi_adjust_cfa_offset (4);
+#ifdef PIC
+ call __i686.get_pc_thunk.cx
+ addl $_GLOBAL_OFFSET_TABLE_, %ecx
+#endif
+
+#ifdef PIC
+ movl door_server_create_proc@GOTOFF(%ecx), %ecx
+#else
+ movl door_server_create_proc, %ecx
+#endif
+ call *%ecx
+ addl $4, %esp; cfi_adjust_cfa_offset (-4);
+
+1:
+ /* Call server function. */
+ movl oDOOR_RESULTS_PC(%esp), %ecx
+ call *%ecx
+
+ /* The server function is supposed to call door_return... */
+ pushl $0; cfi_adjust_cfa_offset (4);
+ call __pthread_exit
+L(pseudo_end):
+PSEUDO_END (__door_return)
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/i386/getcontext.S b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/i386/getcontext.S
new file mode 100644
index 0000000000..e989d3efb4
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/i386/getcontext.S
@@ -0,0 +1,72 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sysdep.h>
+
+#include "ucontext_i.h"
+
+/* note: make sure that we do not use %edx as a scratch (see swapcontext.S) */
+
+ENTRY(__getcontext)
+ /* load ucp (arg) into %ecx */
+ movl 4(%esp), %ecx
+
+ /* load return address into %eax */
+ movl 0(%esp), %eax
+
+ /* push ucp, subcall number, and return address */
+ pushl %ecx; cfi_adjust_cfa_offset (4)
+ pushl $SYS_SUB_getcontext; cfi_adjust_cfa_offset (4)
+ pushl %eax; cfi_adjust_cfa_offset (4)
+
+ /* call context syscall */
+ DO_CALL(context, 2)
+
+ /* Jump if not error. */
+ jnb 1f;
+
+ /* pop args from stack */
+ addl $12, %esp; cfi_adjust_cfa_offset (-12)
+
+ /* Jump to error label. */
+ jmp SYSCALL_ERROR_LABEL;
+
+1:
+ /* pop args from stack */
+ addl $12, %esp; cfi_adjust_cfa_offset (-12);
+
+ /* load ucp (arg) into %ecx */
+ movl 4(%esp), %ecx
+
+ /* save %esp */
+ leal 4(%esp), %eax
+ movl %eax, oUESP(%ecx)
+
+ /* save %eip */
+ movl 0(%esp), %eax
+ movl %eax, oEIP(%ecx)
+
+ /* return 0 on success */
+ xorl %eax, %eax
+ movl %eax, oEAX(%ecx)
+L(pseudo_end):
+ ret
+PSEUDO_END(__getcontext)
+
+weak_alias (__getcontext, getcontext)
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/i386/lsee64.S b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/i386/lsee64.S
new file mode 100644
index 0000000000..b23cdc7671
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/i386/lsee64.S
@@ -0,0 +1,38 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sysdep.h>
+
+ENTRY (__libc_lseek64)
+ DO_CALL (llseek, 3)
+ jnb 1f
+ ret
+1:
+ jmp SYSCALL_ERROR_LABEL
+
+L(pseudo_end):
+
+ /* set the upper-64 bits to -1 */
+ orl $-1, %edx;
+ ret
+PSEUDO_END (__libc_lseek64)
+
+libc_hidden_def (__libc_lseek64)
+weak_alias (__libc_lseek64, __lseek64)
+weak_alias (__libc_lseek64, lseek64)
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/i386/makecontext.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/i386/makecontext.c
new file mode 100644
index 0000000000..2fcdb8f0d6
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/i386/makecontext.c
@@ -0,0 +1,50 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sys/types.h>
+#include <sys/regset.h>
+#include <sys/stack.h>
+#include <ucontext.h>
+#include <stdarg.h>
+#include <assert.h>
+
+void
+__restorecontext (void)
+{
+ ucontext_t uc;
+ assert (getcontext (&uc) == 0);
+ assert (setcontext (uc.uc_link) == 0);
+}
+
+void
+makecontext (ucontext_t *ucp, void (*func) (void), int argc, ...)
+{
+ /* setup the stack (note that it grows down) */
+ void *stack_addr = ucp->uc_stack.ss_sp + ucp->uc_stack.ss_size -
+ (argc + 1) * sizeof(uint32_t);
+ uint32_t *stack_ptr = (uint32_t *)((uint32_t)stack_addr &
+ ~(STACK_ALIGN - 1));
+ ucp->uc_mcontext.gregs[UESP] = (greg_t)stack_ptr;
+ *stack_ptr++ = (uint32_t)__restorecontext; /* return addr */
+ va_list ap;
+ va_start (ap, argc);
+ while (argc--)
+ *stack_ptr++ = (uint32_t)va_arg (ap, char *); /* arg */
+ ucp->uc_mcontext.gregs[EIP] = (greg_t)func;
+}
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/i386/profil-counter.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/i386/profil-counter.h
new file mode 100644
index 0000000000..8091fbce14
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/i386/profil-counter.h
@@ -0,0 +1,27 @@
+/* Machine-dependent SIGPROF signal handler. OpenSolaris i386 version.
+ Copyright (C) 1996, 1997, 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sys/ucontext.h>
+#include <sys/regset.h>
+
+static void
+profil_counter (int signr, int code, struct ucontext *ucp)
+{
+ profil_count ((void *) ucp->uc_mcontext.gregs[EIP]);
+}
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/i386/swapcontext.S b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/i386/swapcontext.S
new file mode 100644
index 0000000000..a7b9fe1b02
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/i386/swapcontext.S
@@ -0,0 +1,86 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sysdep.h>
+
+#include <ucontext_i.h>
+
+ENTRY(__swapcontext)
+
+ /* load ucp (arg) into %ecx */
+ movl 4(%esp), %ecx
+
+ /* load return address into %eax */
+ movl 0(%esp), %eax
+
+ /* push ucp, subcall number, and return address */
+ pushl %ecx; cfi_adjust_cfa_offset (4)
+ pushl $SYS_SUB_getcontext; cfi_adjust_cfa_offset (4)
+ pushl %eax; cfi_adjust_cfa_offset (4)
+
+ /* call context syscall */
+ DO_CALL(context, 2)
+
+ /* Jump if not error. */
+ jnb 1f;
+
+ /* pop args from stack */
+ addl $12, %esp; cfi_adjust_cfa_offset (-12);
+
+ /* Jump to error label. */
+ jmp SYSCALL_ERROR_LABEL;
+
+1:
+ /* pop args from stack */
+ addl $12, %esp; cfi_adjust_cfa_offset (-12);
+
+ /* load ucp (arg) into %ecx */
+ movl 4(%esp), %ecx
+
+ /* save %esp */
+ leal 4(%esp), %eax
+ movl %eax, oUESP(%ecx)
+
+ /* save %eip */
+ movl 0(%esp), %eax
+ movl %eax, oEIP(%ecx)
+
+ /* return 0 on success */
+ xorl %eax, %eax
+ movl %eax, oEAX(%ecx)
+
+ /* load ocp (arg 2) into %edx */
+ movl 8(%esp), %edx
+
+ /* push ucp */
+ pushl %edx; cfi_adjust_cfa_offset (4);
+
+ /* call __setcontext */
+ call __setcontext
+
+ /* pop ucp */
+ addl $4, %esp; cfi_adjust_cfa_offset (-4)
+
+ /* __setcontext sets the return (%eax) */
+L(pseudo_end):
+ ret
+
+PSEUDO_END(__swapcontext)
+
+weak_alias (__swapcontext, swapcontext)
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/i386/sys/trap.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/i386/sys/trap.h
new file mode 100644
index 0000000000..b455c86368
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/i386/sys/trap.h
@@ -0,0 +1,61 @@
+/* Declaration of traps.
+ Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _SYS_TRAP_H
+#define _SYS_TRAP_H
+
+/* traps */
+#define T_ZERODIV 0x0
+#define T_SGLSTP 0x1
+#define T_NMIFLT 0x2
+#define T_BPTFLT 0x3
+#define T_OVFLW 0x4
+#define T_BOUNDFLT 0x5
+#define T_ILLINST 0x6
+#define T_NOEXTFLT 0x7
+#define T_DBLFLT 0x8
+#define T_EXTOVRFLT 0x9
+#define T_TSSFLT 0xa
+#define T_SEGFLT 0xb
+#define T_STKFLT 0xc
+#define T_GPFLT 0xd
+#define T_PGFLT 0xe
+#define T_EXTERRFLT 0x10
+#define T_ALIGNMENT 0x11
+#define T_MCE 0x12
+#define T_SIMDFPE 0x13
+#define T_DBGENTR 0x14
+#define T_ENDPERR 0x21
+#define T_ENOEXTFLT 0x20
+#define T_FASTTRAP 0xd2
+#define T_SYSCALLINT 0x91
+#define T_DTRACE_RET 0x7f
+#define T_INT80 0x80
+#define T_SOFTINT 0x50fd
+
+/* fast traps */
+#define T_FNULL 0
+#define T_FGETFP 1
+#define T_FSETFP 2
+#define T_GETHRTIME 3
+#define T_GETHRVTIME 4
+#define T_GETHRESTIME 5
+#define T_GETLGRP 6
+
+#endif /* _SYS_TRAP_H */
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/i386/syscall.S b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/i386/syscall.S
new file mode 100644
index 0000000000..3228730758
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/i386/syscall.S
@@ -0,0 +1,51 @@
+/* Copyright (C) 1993, 1995-1998, 2002, 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sysdep.h>
+
+ .text;
+ENTRY (__syscall)
+ popl %ecx /* Pop return address into %ecx. */
+ popl %eax /* Pop syscall number into %eax. */
+ pushl %ecx /* Push back return adderss. */
+ int $0x91 /* Do the system call. */
+ pushl %ecx /* Push back return address. */
+ jb SYSCALL_ERROR_LABEL; /* Jump to error handler if error. */
+
+L(pseudo_end):
+ ret /* Return to caller. */
+PSEUDO_END (__syscall)
+weak_alias (__syscall, syscall)
+
+ .text;
+ENTRY (__systemcall)
+ popl %edx /* Pop return address into %edx. */
+ popl %ecx /* Pop sysret_t into %ecx. */
+ popl %eax /* Pop syscall number into %eax. */
+ pushl %edx /* Push return address onto stack. */
+ int $0x91 /* Do the system call. */
+ pushl %ecx /* Restore sysret_t on stack. */
+ movl 4(%esp), %edx /* Save return address into %edx. */
+ pushl %edx /* Restore return address on stack. */
+ jb 1f /* Jump to error handler if error. */
+ movl %eax, 0(%ecx) /* Set first 4 bytes of sysret_t. */
+ movl %edx, 4(%ecx) /* Set second 4 bytes of sysret_t. */
+ xorl %eax, %eax /* Set return to 0. */
+1:
+ ret
+PSEUDO_END (__syscall)
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/i386/sysdep.S b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/i386/sysdep.S
new file mode 100644
index 0000000000..68c63878a0
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/i386/sysdep.S
@@ -0,0 +1,40 @@
+/* Copyright (C) 1995-1998, 2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sysdep.h>
+#define _ERRNO_H
+#include <bits/errno.h>
+
+/* The following code is only used in the shared library when we
+ compile the reentrant version. Otherwise each system call defines
+ its own version. */
+
+#ifndef PIC
+
+/* The syscall stubs jump here when they detect an error.
+ The code for Solaris is identical to the canonical Unix/i386 code. */
+
+#undef CALL_MCOUNT
+#define CALL_MCOUNT /* Don't insert the profiling call, it clobbers %eax. */
+
+ .text
+ENTRY (__syscall_error)
+#define __syscall_error __syscall_error_1
+#include <sysdeps/unix/i386/sysdep.S>
+
+#endif /* !PIC */
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/i386/sysdep.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/i386/sysdep.h
new file mode 100644
index 0000000000..f93fdba57e
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/i386/sysdep.h
@@ -0,0 +1,324 @@
+/* Copyright (C) 1992,1993,1995-2000,2002-2006,2007,2008
+ Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper, <drepper@gnu.org>, August 1995.
+ OpenSolaris bits contributed by David Bartley
+ <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _OPENSOLARIS_I386_SYSDEP_H
+#define _OPENSOLARIS_I386_SYSDEP_H 1
+
+#define DECLARE_INLINE_SYSCALL(ret, name, args...) \
+ extern ret __syscall_##name (args)
+
+/* There is some commonality. */
+#include <sysdeps/unix/i386/sysdep.h>
+#include <bp-sym.h>
+#include <bp-asm.h>
+#include <syscallP.h>
+
+/* XXX: This needs to come before #include <tls.h>. */
+
+/* Pointer mangling support. */
+#if defined NOT_IN_libc && defined IS_IN_rtld
+/* We cannot use the thread descriptor because in ld.so we use setjmp
+ earlier than the descriptor is initialized. Using a global variable
+ is too complicated here since we have no PC-relative addressing mode. */
+#else
+# ifdef __ASSEMBLER__
+# define PTR_MANGLE(reg) xorl %gs:POINTER_GUARD, reg; \
+ roll $9, reg
+# define PTR_DEMANGLE(reg) rorl $9, reg; \
+ xorl %gs:POINTER_GUARD, reg
+# else
+# define PTR_MANGLE(var) asm ("xorl %%gs:%c2, %0\n" \
+ "roll $9, %0" \
+ : "=r" (var) \
+ : "0" (var), \
+ "i" (offsetof (tcbhead_t, \
+ pointer_guard)))
+# define PTR_DEMANGLE(var) asm ("rorl $9, %0\n" \
+ "xorl %%gs:%c2, %0" \
+ : "=r" (var) \
+ : "0" (var), \
+ "i" (offsetof (tcbhead_t, \
+ pointer_guard)))
+# endif
+#endif
+
+
+/* Defines RTLD_PRIVATE_ERRNO and USE_DL_SYSINFO. */
+#include <dl-sysdep.h>
+#include <tls.h>
+
+/* It's too much trouble to pull in all of errno.h just for this */
+#ifndef ERESTART
+# define ERESTART 91 /* Restartable system call. */
+# define EINTR 4 /* Interrupted system call. */
+#endif
+
+#ifdef __ASSEMBLER__
+
+/* This is needed so that we know when to set %edx to -1 on error. */
+#ifdef SYSCALL_64BIT_RETURN
+# define SYSCALL_64BIT_RETURN_ASM orl $-1, %edx;
+#else
+# define SYSCALL_64BIT_RETURN_ASM
+#endif
+
+#ifdef SYSCALL_RESTARTABLE
+# define DO_RESTART \
+ cmpl $ERESTART, %eax; \
+ je L(restart);
+#else
+# define DO_RESTART
+#endif
+
+/* We don't want the label for the error handle to be global when we define
+ it here. */
+#ifdef PIC
+# define SYSCALL_ERROR_LABEL 0f
+#else
+# define SYSCALL_ERROR_LABEL syscall_error
+#endif
+
+#undef PSEUDO
+#define PSEUDO(name, syscall_name, args) \
+ .text; \
+ ENTRY (name) \
+ L(restart): \
+ DO_CALL (syscall_name, args); \
+ jnb 2f; \
+ DO_RESTART \
+ jmp SYSCALL_ERROR_LABEL; \
+2: \
+ L(pseudo_end):
+
+#define PSEUDO_SUBCALL(name, syscall_name, subcall_name, args) \
+ .text; \
+ ENTRY (name) \
+ movl 0(%esp), %ecx; \
+ movl %ecx, -4(%esp); \
+ addl $-4, %esp; \
+ movl $SYS_ify (SUB_##subcall_name), 4(%esp); \
+ L(restart): \
+ DO_CALL (syscall_name, args); \
+ jnb 2f; \
+ DO_RESTART \
+ movl %ecx, 4(%esp); \
+ addl $4, %esp; \
+ jmp SYSCALL_ERROR_LABEL; \
+2: \
+ movl %ecx, 4(%esp); \
+ addl $4, %esp; \
+ L(pseudo_end):
+
+#undef PSEUDO_END
+#define PSEUDO_END(name) \
+ SYSCALL_ERROR_HANDLER \
+ END (name)
+
+#undef PSEUDO_NOERRNO
+#define PSEUDO_NOERRNO(name, syscall_name, args) \
+ .text; \
+ ENTRY (name) \
+ DO_CALL (syscall_name, args)
+
+#define PSEUDO_SUBCALL_NOERRNO(name, syscall_name, subcall_name, args) \
+ .text; \
+ ENTRY (name) \
+ movl 0(%esp), %ecx; \
+ movl %ecx, -4(%esp); \
+ addl $-4, %esp; \
+ movl $SYS_ify (SUB_##subcall_name), 4(%esp); \
+ DO_CALL (syscall_name, args); \
+ movl %ecx, 4(%esp); \
+ addl $4, %esp;
+
+#undef PSEUDO_END_NOERRNO
+#define PSEUDO_END_NOERRNO(name) \
+ END (name)
+
+#define ret_NOERRNO ret
+
+/* The function has to return the error code. */
+#undef PSEUDO_ERRVAL
+#define PSEUDO_ERRVAL(name, syscall_name, args) \
+ .text; \
+ ENTRY (name) \
+ DO_CALL (syscall_name, args); \
+ jnb 1f; \
+ cmpl $ERESTART, %eax; \
+ jne 2f; \
+ movl $EINTR, %eax; \
+ jmp 2f; \
+1: xorl %eax, %eax; \
+2:;
+
+#define PSEUDO_SUBCALL_ERRVAL(name, syscall_name, subcall_name, args) \
+ .text; \
+ ENTRY (name) \
+ movl 0(%esp), %ecx; \
+ movl %ecx, -4(%esp); \
+ addl $-4, %esp; \
+ movl $SYS_ify (SUB_##subcall_name), 4(%esp); \
+ L(restart): \
+ DO_CALL (syscall_name, args); \
+ jnb 1f; \
+ cmpl $ERESTART, %eax; \
+ jne 2f; \
+ movl $EINTR, %eax; \
+ jmp 2f; \
+1: xorl %eax, %eax; \
+2: \
+ movl %ecx, 4(%esp); \
+ addl $4, %esp;
+
+
+#undef PSEUDO_END_ERRVAL
+#define PSEUDO_END_ERRVAL(name) \
+ END (name)
+
+#define ret_ERRVAL ret
+
+#undef PSEUDO_FASTTRAP
+#define PSEUDO_FASTTRAP(name, trap_name, args) \
+ .text; \
+ ENTRY (name) \
+ movl $T_##trap_name, %eax; \
+ int $T_FASTTRAP; \
+ L(pseudo_end):
+
+
+#ifndef PIC
+# define SYSCALL_ERROR_HANDLER /* Nothing here; code in sysdep.S is used. */
+#else
+
+# if RTLD_PRIVATE_ERRNO
+# define SYSCALL_ERROR_HANDLER \
+0: SETUP_PIC_REG(cx); \
+ addl $_GLOBAL_OFFSET_TABLE_, %ecx; \
+ movl %eax, rtld_errno@GOTOFF(%ecx); \
+ orl $-1, %eax; \
+ SYSCALL_64BIT_RETURN_ASM \
+ jmp L(pseudo_end);
+
+# elif defined _LIBC_REENTRANT
+
+# if USE___THREAD
+# ifndef NOT_IN_libc
+# define SYSCALL_ERROR_ERRNO __libc_errno
+# else
+# define SYSCALL_ERROR_ERRNO errno
+# endif
+# define SYSCALL_ERROR_HANDLER \
+0: SETUP_PIC_REG (cx); \
+ addl $_GLOBAL_OFFSET_TABLE_, %ecx; \
+ movl SYSCALL_ERROR_ERRNO@GOTNTPOFF(%ecx), %ecx; \
+ SYSCALL_ERROR_HANDLER_TLS_STORE (%eax, %ecx); \
+ orl $-1, %eax; \
+ SYSCALL_64BIT_RETURN_ASM \
+ jmp L(pseudo_end);
+# ifndef NO_TLS_DIRECT_SEG_REFS
+# define SYSCALL_ERROR_HANDLER_TLS_STORE(src, destoff) \
+ movl src, %gs:(destoff)
+# else
+# define SYSCALL_ERROR_HANDLER_TLS_STORE(src, destoff) \
+ addl %gs:0, destoff; \
+ movl src, (destoff)
+# endif
+# else
+# define SYSCALL_ERROR_HANDLER \
+0:pushl %ebx; \
+ cfi_adjust_cfa_offset (4); \
+ cfi_rel_offset (ebx, 0); \
+ SETUP_PIC_REG (bx); \
+ addl $_GLOBAL_OFFSET_TABLE_, %ebx; \
+ pushl %eax; \
+ cfi_adjust_cfa_offset (4); \
+ PUSH_ERRNO_LOCATION_RETURN; \
+ call BP_SYM (__errno_location)@PLT; \
+ POP_ERRNO_LOCATION_RETURN; \
+ popl %ecx; \
+ cfi_adjust_cfa_offset (-4); \
+ popl %ebx; \
+ cfi_adjust_cfa_offset (-4); \
+ cfi_restore (ebx); \
+ movl %ecx, (%eax); \
+ orl $-1, %eax; \
+ SYSCALL_64BIT_RETURN_ASM \
+ jmp L(pseudo_end);
+/* A quick note: it is assumed that the call to `__errno_location' does
+ not modify the stack! */
+# endif
+# else
+/* Store (%eax) into errno through the GOT. */
+# define SYSCALL_ERROR_HANDLER \
+0:SETUP_PIC_REG(cx); \
+ addl $_GLOBAL_OFFSET_TABLE_, %ecx; \
+ movl errno@GOT(%ecx), %ecx; \
+ movl %eax, (%ecx); \
+ orl $-1, %eax; \
+ SYSCALL_64BIT_RETURN_ASM \
+ jmp L(pseudo_end);
+# endif /* _LIBC_REENTRANT */
+#endif /* PIC */
+
+/* TODO: use sysenter instead of int */
+#undef DO_CALL
+#define DO_CALL(syscall_name, args) \
+ movl $SYS_ify (syscall_name), %eax; \
+ int $0x91
+
+#else /* !__ASSEMBLER__ */
+
+/* Consistency check for position-independent code. */
+#ifdef __PIC__
+# define check_consistency() \
+ ({ int __res; \
+ __asm__ __volatile__ \
+ ("call __i686.get_pc_thunk.cx;" \
+ "addl $_GLOBAL_OFFSET_TABLE_, %%ecx;" \
+ "subl %%ebx, %%ecx;" \
+ "je 1f;" \
+ "ud2;" \
+ "1:\n" \
+ ".section .gnu.linkonce.t.__i686.get_pc_thunk.cx,\"ax\",@progbits;" \
+ ".globl __i686.get_pc_thunk.cx;" \
+ ".hidden __i686.get_pc_thunk.cx;" \
+ ".type __i686.get_pc_thunk.cx,@function;" \
+ "__i686.get_pc_thunk.cx:" \
+ "movl (%%esp), %%ecx;" \
+ "ret;" \
+ ".previous" \
+ : "=c" (__res)); \
+ __res; })
+#endif
+
+/* TODO: This is a terrible implementation of INTERNAL_SYSCALL. */
+
+/* Some NPTL code calls these macros. */
+# include <errno.h>
+# define INTERNAL_SYSCALL(name, err, nr, args...) __internal_##name##_##nr (&(err), args)
+# define INTERNAL_SYSCALL_DECL(err) int err = 0;
+# define INTERNAL_SYSCALL_ERROR_P(val, err) (err != 0)
+# define INTERNAL_SYSCALL_ERRNO(val, err) (err)
+
+#endif /* __ASSEMBLER__ */
+
+#endif /* _OPENSOLARIS_I386_SYSDEP_H */
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/i386/ucontext_i.sym b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/i386/ucontext_i.sym
new file mode 100644
index 0000000000..d57e0254e6
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/i386/ucontext_i.sym
@@ -0,0 +1,31 @@
+#include <stddef.h>
+#include <signal.h>
+#include <sys/ucontext.h>
+#include <sys/regset.h>
+
+--
+
+SIG_BLOCK
+SIG_SETMASK
+
+#define ucontext(member) offsetof (ucontext_t, member)
+#define mcontext(member) ucontext (uc_mcontext.member)
+#define mreg(reg) mcontext (gregs[reg])
+
+oLINK ucontext (uc_link)
+oSS_SP ucontext (uc_stack.ss_sp)
+oSS_SIZE ucontext (uc_stack.ss_size)
+oGS mreg (GS)
+oFS mreg (FS)
+oEDI mreg (EDI)
+oESI mreg (ESI)
+oEBP mreg (EBP)
+oESP mreg (ESP)
+oUESP mreg (UESP)
+oEBX mreg (EBX)
+oEDX mreg (EDX)
+oECX mreg (ECX)
+oEAX mreg (EAX)
+oEIP mreg (EIP)
+oFPREGS mcontext (fpregs)
+oSIGMASK ucontext (uc_sigmask)
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/i386/vfork.S b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/i386/vfork.S
new file mode 100644
index 0000000000..08e02a969e
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/i386/vfork.S
@@ -0,0 +1,59 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sysdep.h>
+
+ENTRY (__vfork)
+
+ /* save the return address */
+ popl %ecx; cfi_adjust_cfa_offset (-4)
+
+ /* call vforkx(0) */
+ pushl $0; cfi_adjust_cfa_offset (4)
+ pushl $SYS_SUB_vforkx; cfi_adjust_cfa_offset (4)
+ pushl %ecx; cfi_adjust_cfa_offset (4)
+ DO_CALL (forksys, 1)
+ jb 2f
+
+ /* pop vforkx args */
+ addl $12, %esp; cfi_adjust_cfa_offset (-12)
+
+ /* In the parent process, %edx == 0, %eax == child pid.
+ In the child process, %edx == 1, %eax == parent pid. */
+ decl %edx
+ andl %edx, %eax
+
+ /* jump to the old return address */
+ jmp *%ecx
+
+2:
+ /* pop vforkx args */
+ addl $12, %esp; cfi_adjust_cfa_offset (-12)
+
+ /* restore the return address and jump to the syscall error label */
+ pushl %ecx; cfi_adjust_cfa_offset (4)
+ jmp SYSCALL_ERROR_LABEL
+
+L(pseudo_end):
+ ret
+
+PSEUDO_END (__vfork)
+
+libc_hidden_def (__vfork)
+weak_alias (__vfork, vfork)
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/if_index.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/if_index.c
new file mode 100644
index 0000000000..c6d776749e
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/if_index.c
@@ -0,0 +1,165 @@
+/* Copyright (C) 1997,98,99,2000,02,08 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ OpenSolaris bits contributed by David Bartley
+ <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <net/if.h>
+#include <sys/ioctl.h>
+#include <errno.h>
+#include <stddef.h>
+#include <string.h>
+#include <not-cancel.h>
+#include <memory.h>
+
+unsigned int
+if_nametoindex (const char *ifname)
+{
+ struct lifreq lifr;
+ int fd = __opensock ();
+
+ if (fd < 0)
+ return 0;
+
+ strncpy (lifr.lifr_name, ifname, sizeof (lifr.lifr_name));
+ if (__ioctl (fd, SIOCGLIFINDEX, &lifr) < 0)
+ {
+ close_not_cancel_no_status (fd);
+ return -1;
+ }
+ close_not_cancel_no_status (fd);
+ return lifr.lifr_index;
+}
+libc_hidden_def (if_nametoindex)
+
+
+char *
+if_indextoname (unsigned int ifindex, char *ifname)
+{
+ struct if_nameindex *idx;
+ struct if_nameindex *p;
+ char *result = NULL;
+
+ idx = if_nameindex ();
+
+ if (idx != NULL)
+ {
+ for (p = idx; p->if_index || p->if_name; ++p)
+ if (p->if_index == ifindex)
+ {
+ result = strncpy (ifname, p->if_name, IFNAMSIZ);
+ break;
+ }
+
+ if_freenameindex (idx);
+
+ if (result == NULL)
+ __set_errno (ENXIO);
+ }
+ return result;
+}
+libc_hidden_def (if_indextoname)
+
+
+void
+if_freenameindex (struct if_nameindex *ifn)
+{
+ struct if_nameindex *ptr = ifn;
+ while (ptr->if_name || ptr->if_index)
+ {
+ free (ptr->if_name);
+ ++ptr;
+ }
+ free (ifn);
+}
+libc_hidden_def (if_freenameindex)
+
+
+/* XXX: if_nameindex is O(n^2) in the number of interfaces. */
+struct if_nameindex *
+if_nameindex (void)
+{
+ int fd = __opensock ();
+ int flags = LIFC_NOXMIT | LIFC_TEMPORARY | LIFC_ALLZONES;
+ unsigned int nifs, i, j, k;
+ char *buf = NULL;
+ struct if_nameindex *idx = NULL;
+ struct lifnum lifn;
+ struct lifconf lifc;
+ struct lifreq *lifr;
+
+ if (fd < 0)
+ return NULL;
+
+ /* Determine number of interfaces. */
+ lifn.lifn_family = AF_UNSPEC;
+ lifn.lifn_flags = flags;
+ if (__ioctl (fd, SIOCGLIFNUM, &lifn) != 0)
+ goto error;
+ nifs = lifn.lifn_count;
+
+ /* Get interfaces. */
+ lifc.lifc_family = AF_UNSPEC;
+ lifc.lifc_flags = flags;
+ lifc.lifc_len = nifs * sizeof(struct lifreq);
+ buf = malloc (lifc.lifc_len);
+ lifc.lifc_buf = buf;
+ if (buf == NULL)
+ goto error;
+ if (__ioctl (fd, SIOCGLIFCONF, &lifc) != 0)
+ goto error;
+ lifr = lifc.lifc_req;
+
+ idx = malloc ((nifs + 1) * sizeof (struct if_nameindex));
+ if (idx == NULL)
+ goto error;
+
+ for (i = 0, j = 0, k = 0; i < nifs; ++i)
+ {
+ /* Check if we already have seen this interface. */
+ for (j = 0; j < i; ++j)
+ {
+ if (strcmp (idx[j].if_name, lifr[i].lifr_name) == 0)
+ goto A;
+ }
+
+ idx[k].if_name = __strdup (lifr[i].lifr_name);
+ if (idx[k].if_name == NULL)
+ {
+ for (i = 0; i <= k; ++i)
+ free (idx[i].if_name);
+ free (idx);
+ goto error;
+ }
+ idx[k].if_index = if_nametoindex (idx[k].if_name);
+ ++k;
+A:;
+ }
+
+ idx[k].if_index = 0;
+ idx[k].if_name = NULL;
+
+ close_not_cancel_no_status (fd);
+ free (buf);
+ return idx;
+
+error:
+ close_not_cancel_no_status (fd);
+ free (buf);
+ return NULL;
+}
+libc_hidden_def (if_nameindex)
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/ifreq.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/ifreq.c
new file mode 100644
index 0000000000..af6e551510
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/ifreq.c
@@ -0,0 +1,56 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <net/if.h>
+#include <sys/ioctl.h>
+#include <errno.h>
+#include <stddef.h>
+#include <string.h>
+#include <not-cancel.h>
+#include <memory.h>
+
+void
+__ifreq (struct ifreq **ifreqs, int *num_ifs, int sockfd)
+{
+ struct ifconf ifc;
+ int nifs;
+ char *buf = NULL;
+
+ /* Determine number of interfaces. */
+ if (__ioctl (sockfd, SIOCGIFNUM, &nifs) != 0)
+ goto error;
+
+ /* Get interfaces. */
+ ifc.ifc_len = nifs * sizeof(struct ifreq);
+ buf = malloc (ifc.ifc_len);
+ ifc.ifc_buf = buf;
+ if (buf == NULL)
+ goto error;
+ if (__ioctl (sockfd, SIOCGIFCONF, &ifc) != 0)
+ goto error;
+
+ *ifreqs = (struct ifreq *)buf;
+ *num_ifs = nifs;
+ return;
+
+error:
+ *ifreqs = NULL;
+ *num_ifs = 0;
+ free (buf);
+}
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/inet_ntoa_r.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/inet_ntoa_r.c
new file mode 100644
index 0000000000..6f960033bc
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/inet_ntoa_r.c
@@ -0,0 +1,34 @@
+/* Convert Inet number to ASCII representation.
+ Copyright (C) 1997, 1998, 2000, 2001, 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <arpa/inet.h>
+
+
+char *
+inet_ntoa_r (struct in_addr in, char *buffer)
+{
+ unsigned char *bytes = (unsigned char *) &in;
+ __snprintf (buffer, sizeof (buffer), "%d.%d.%d.%d",
+ bytes[0], bytes[1], bytes[2], bytes[3]);
+
+ return buffer;
+}
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/init-first.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/init-first.c
new file mode 100644
index 0000000000..0e585b9d07
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/init-first.c
@@ -0,0 +1,133 @@
+/* Initialization code run first thing by the ELF startup code.
+ OpenSolaris version.
+ Copyright (C) 1995-2004, 2005, 2007 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sysdep.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <fpu_control.h>
+#include <sys/param.h>
+#include <sys/types.h>
+#include <libc-internal.h>
+#include <ucontext.h>
+#include <sys/resource.h>
+
+#include <ldsodefs.h>
+
+/* Set nonzero if we have to be prepared for more then one libc being
+ used in the process. Safe assumption if initializer never runs. */
+int __libc_multiple_libcs attribute_hidden = 1;
+
+/* Remember the command line argument and enviroment contents for
+ later calls of initializers for dynamic libraries. */
+int __libc_argc attribute_hidden;
+char **__libc_argv attribute_hidden;
+
+stack_t _dl_stack;
+int _dl_malloc_prot_exec;
+
+
+void
+__libc_init_first (int argc, char **argv, char **envp)
+{
+#ifdef SHARED
+ /* For DSOs we do not need __libc_init_first but instead _init. */
+}
+
+void
+attribute_hidden
+_init (int argc, char **argv, char **envp)
+{
+#endif
+#ifdef USE_NONOPTION_FLAGS
+ extern void __getopt_clean_environment (char **);
+#endif
+
+ __libc_multiple_libcs = &_dl_starting_up && !_dl_starting_up;
+
+ /* Make sure we don't initialize twice. */
+ if (!__libc_multiple_libcs)
+ {
+ /* Set the FPU control word to the proper default value if the
+ kernel would use a different value. (In a static program we
+ don't have this information.) */
+#ifdef SHARED
+ if (__fpu_control != GLRO(dl_fpu_control))
+#endif
+ __setfpucw (__fpu_control);
+
+ /* Setup stack. */
+ ucontext_t ctx;
+ struct rlimit rlim;
+ if (getrlimit (RLIMIT_STACK, &rlim) == 0 &&
+ rlim.rlim_cur != RLIM_INFINITY && getcontext (&ctx) == 0)
+ {
+ _dl_stack.ss_sp = ctx.uc_stack.ss_sp +
+ ctx.uc_stack.ss_size - rlim.rlim_cur;
+ _dl_stack.ss_size = rlim.rlim_cur;
+ }
+ else
+ {
+ _dl_stack.ss_sp = ctx.uc_stack.ss_sp;
+ _dl_stack.ss_size = 0;
+ }
+ _dl_stack.ss_flags = 0;
+ setustack (&_dl_stack);
+ }
+
+ /* Save the command-line arguments. */
+ __libc_argc = argc;
+ __libc_argv = argv;
+ __environ = envp;
+
+#ifndef SHARED
+ __libc_init_secure ();
+
+ /* First the initialization which normally would be done by the
+ dynamic linker. */
+ _dl_non_dynamic_init ();
+#endif
+
+ __init_misc (argc, argv, envp);
+
+#ifdef USE_NONOPTION_FLAGS
+ /* This is a hack to make the special getopt in GNU libc working. */
+ __getopt_clean_environment (envp);
+#endif
+
+#ifdef SHARED
+ __libc_global_ctors ();
+#endif
+}
+
+
+/* This function is defined here so that if this file ever gets into
+ ld.so we will get a link error. Having this file silently included
+ in ld.so causes disaster, because the _init definition above will
+ cause ld.so to gain an init function, which is not a cool thing. */
+
+extern void _dl_start (void) __attribute__ ((noreturn));
+
+void
+_dl_start (void)
+{
+ abort ();
+}
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/inline-syscall.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/inline-syscall.h
new file mode 100644
index 0000000000..63faea7afd
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/inline-syscall.h
@@ -0,0 +1,35 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _INLINE_SYSCALL_H
+#define _INLINE_SYSCALL_H
+
+#include <sys/types.h>
+#include <syscallP.h>
+#include <sysdep.h>
+
+typedef union rval
+{
+ sysret_t rvals;
+ int64_t rval64;
+} rval_t;
+#define rval1 rvals.sys_rval1
+#define rval2 rvals.sys_rval2
+
+#endif /* _INLINE_SYSCALL_H */
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/iopopen.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/iopopen.c
new file mode 100644
index 0000000000..ef564ec887
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/iopopen.c
@@ -0,0 +1,90 @@
+/* Copyright (C) 1993, 1997-2002, 2003, 2004, 2007, 2008
+ Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Written by Per Bothner <bothner@cygnus.com>.
+ OpenSolaris bits contributed by David Bartley
+ <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA.
+
+ As a special exception, if you link the code in this file with
+ files compiled with a GNU compiler to produce an executable,
+ that does not cause the resulting executable to be covered by
+ the GNU Lesser General Public License. This exception does not
+ however invalidate any other reasons why the executable file
+ might be covered by the GNU Lesser General Public License.
+ This exception applies to code released by its copyright holders
+ in files containing the exception. */
+
+#include <libio/iopopen.c>
+
+/* OpenSolaris's libgen expects two exports: _insert and _delete. It uses
+ these to insert/delete from proc_file_chain in its implementation of
+ p2open. */
+
+int _insert (pid_t pid, int fd)
+{
+ _IO_proc_file *fp = malloc (sizeof (_IO_proc_file));
+ if (!fp)
+ return -1;
+
+ fp->pid = pid;
+
+ /* The only thing we ever call on fp is _IO_fileno, so this is the only
+ field that we need to worry about. */
+ fp->file.file._fileno = fd;
+
+ /* Link into proc_file_chain. */
+#ifdef _IO_MTSAFE_IO
+ _IO_cleanup_region_start_noarg (unlock);
+ _IO_lock_lock (proc_file_chain_lock);
+#endif
+ fp->next = proc_file_chain;
+ proc_file_chain = fp;
+#ifdef _IO_MTSAFE_IO
+ _IO_lock_unlock (proc_file_chain_lock);
+ _IO_cleanup_region_end (0);
+#endif
+
+ return 0;
+}
+
+pid_t _delete (int fd)
+{
+ pid_t pid = (pid_t)-1;
+#ifdef _IO_MTSAFE_IO
+ _IO_cleanup_region_start_noarg (unlock);
+ _IO_lock_lock (proc_file_chain_lock);
+#endif
+ _IO_proc_file **ptr = &proc_file_chain;
+ for ( ; *ptr != NULL; ptr = &(*ptr)->next)
+ {
+ if ((*ptr)->file.file._fileno == fd)
+ {
+ _IO_proc_file *fp = *ptr;
+ pid = fp->pid;
+ *ptr = fp->next;
+ free (fp);
+ break;
+ }
+ }
+#ifdef _IO_MTSAFE_IO
+ _IO_lock_unlock (proc_file_chain_lock);
+ _IO_cleanup_region_end (0);
+#endif
+
+ return pid;
+}
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/ipsecalg.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/ipsecalg.c
new file mode 100644
index 0000000000..9581478ec5
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/ipsecalg.c
@@ -0,0 +1,42 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <assert.h>
+#include <stddef.h>
+
+// TODO
+
+struct ipsecalgent *getipsecalgbyname (const char *alg_name,
+ int protocol_num, int *errnop)
+{
+ assert ("getipsecalgbyname not implmemented" == NULL);
+}
+
+
+struct ipsecalgent *getipsecalgbynum (int alg_num, int protocol_num,
+ int *errnop)
+{
+ assert ("getipsecalgbynum not implmemented" == NULL);
+}
+
+
+void freeipsecalgent (struct ipsecalgent *ptr)
+{
+ assert ("freeipsecalgent not implmemented" == NULL);
+}
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/kernel-features.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/kernel-features.h
new file mode 100644
index 0000000000..8a39a4d155
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/kernel-features.h
@@ -0,0 +1,38 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+/* pthread_setXid not supported/needed. */
+#define NO_SETXID_SUPPORT
+
+/* Disable robust list. */
+#define NO_ROBUST_LIST_SUPPORT
+
+/* Disable futex support. */
+#define NO_FUTEX_SUPPORT
+
+/* Make sure SIGCANCEL sanity check compiles. */
+#define SI_TKILL SI_LWP
+#define __ASSUME_CORRECT_SI_PID
+
+/* We support tkill. */
+#undef __NR_tgkill
+#undef __ASSUME_TGKILL
+
+/* We don't have set_thread_area. */
+#define NO_SET_THREAD_AREA
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/klogctl.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/klogctl.c
new file mode 100644
index 0000000000..c8ce0eb0ab
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/klogctl.c
@@ -0,0 +1,31 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sys/klog.h>
+
+int klogctl (type, bufp, len)
+ int type;
+ char *bufp;
+ int len;
+{
+ switch (type)
+ {
+ }
+ return 0;
+}
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/ldsodefs.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/ldsodefs.h
new file mode 100644
index 0000000000..c4b6aa2818
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/ldsodefs.h
@@ -0,0 +1,53 @@
+/* Run-time dynamic linker data structures for loaded ELF shared objects.
+ Copyright (C) 2001, 2002, 2003, 2006, 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _LDSODEFS_H
+
+#include <kernel-features.h>
+
+#define PLATFORM_RTLD_GLOBAL_RO_FIELDS \
+ EXTERN const char * _dl_sun_execname; \
+ EXTERN int _dl_malloc_prot_exec;
+extern const char * _dl_sun_execname;
+extern int _dl_malloc_prot_exec;
+
+/* Since we use __thread in a few places in libc, we need a bit more surplus. */
+#define TLS_STATIC_EXTRA_SURPLUS 4096
+
+/* Get the real definitions. */
+#include_next <ldsodefs.h>
+
+/* Now define our stuff. */
+
+/* OpenSolaris provides an auxv_t only for dynamic executables. */
+#if defined SHARED || defined IS_IN_rtld
+# define HAVE_AUX_VECTOR
+# define HAVE_AUX_PAGESIZE
+#endif
+
+/* Initialization which is normally done by the dynamic linker. */
+extern void _dl_non_dynamic_init (void) internal_function;
+
+/* We want to enable th rtld_db hooks. */
+#define ENABLE_RTLD_DB
+
+# define DLOPEN_ALLOWED_FLAGS (RTLD_BINDING_MASK | RTLD_NOLOAD | \
+ RTLD_DEEPBIND | RTLD_GLOBAL | RTLD_LOCAL | RTLD_NODELETE)
+
+#endif /* ldsodefs.h */
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/linux/posix_types.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/linux/posix_types.h
new file mode 100644
index 0000000000..affdde1e73
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/linux/posix_types.h
@@ -0,0 +1 @@
+/* This file left intentionally blank. */
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/listen.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/listen.c
new file mode 100644
index 0000000000..55754dce94
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/listen.c
@@ -0,0 +1,33 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <inline-syscall.h>
+#include <sys/socket.h>
+
+extern int _so_listen (int sock, int backlog, int version);
+
+int
+__listen (fd, n)
+ int fd;
+ int n;
+{
+ return _so_listen (fd, n, SOV_XPG4_2);
+}
+
+weak_alias (__listen, listen)
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/lltostr.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/lltostr.c
new file mode 100644
index 0000000000..fe3413da18
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/lltostr.c
@@ -0,0 +1,30 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+/* Docs: http://docs.sun.com/app/docs/doc/816-0213/6m6ne385a */
+
+char *lltostr (long long value, char *endptr)
+{
+ while (value)
+ {
+ *--endptr = '0' + (value % 10);
+ value /= 10;
+ }
+ return endptr;
+}
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/lseek64.S b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/lseek64.S
new file mode 100644
index 0000000000..5fd9448be1
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/lseek64.S
@@ -0,0 +1,16 @@
+#define SYSCALL_64BIT_RETURN
+#include <sysdep-cancel.h>
+PSEUDO (__libc_lseek64, llseek, 3)
+ ret
+PSEUDO_END(__libc_lseek64)
+libc_hidden_def (__libc_lseek64)
+weak_alias (__libc_lseek64, __llseek)
+libc_hidden_weak (__llseek)
+weak_alias (__libc_lseek64, llseek)
+libc_hidden_weak (llseek)
+weak_alias (__libc_lseek64, __lseek64)
+libc_hidden_weak (__lseek64)
+weak_alias (__libc_lseek64, lseek64)
+libc_hidden_weak (lseek64)
+weak_alias (__libc_lseek64, llseek)
+libc_hidden_weak (llseek)
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/lxstat.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/lxstat.c
new file mode 100644
index 0000000000..04e1d407f6
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/lxstat.c
@@ -0,0 +1,39 @@
+/* Copyright (C) 1991, 1995, 1996, 1997, 2002, 2008
+ Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <inline-syscall.h>
+#include <errno.h>
+#include <sys/stat.h>
+#include <bp-checks.h>
+
+DECLARE_INLINE_SYSCALL (int, lstat, const char *path, struct stat *buf);
+
+int
+__lxstat (int vers, const char *file, struct stat *buf)
+{
+ if(vers != _STAT_VER)
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ return INLINE_SYSCALL (lstat, 2, file, CHECK_1 (buf));
+}
+
+hidden_def (__lxstat)
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/lxstat64.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/lxstat64.c
new file mode 100644
index 0000000000..9bb45b2e32
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/lxstat64.c
@@ -0,0 +1,39 @@
+/* Copyright (C) 1991, 1995, 1996, 1997, 2002, 2008
+ Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <inline-syscall.h>
+#include <errno.h>
+#include <sys/stat.h>
+#include <bp-checks.h>
+
+DECLARE_INLINE_SYSCALL (int, lstat64, const char *path, struct stat64 *buf);
+
+int
+__lxstat64 (int vers, const char *file, struct stat64 *buf)
+{
+ if(vers != _STAT_VER)
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ return INLINE_SYSCALL (lstat64, 2, file, CHECK_1 (buf));
+}
+
+hidden_def (__lxstat64)
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/madvise.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/madvise.c
new file mode 100644
index 0000000000..5688e110b2
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/madvise.c
@@ -0,0 +1,29 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sys/types.h>
+#include <sys/mman.h>
+
+int
+madvise (__ptr_t addr, size_t len, int advice)
+{
+ return memcntl (addr, len, MC_ADVISE, (caddr_t)advice, 0, 0);
+}
+
+libc_hidden_def (madvise)
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/malloc-machine.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/malloc-machine.h
new file mode 100644
index 0000000000..1db0b590e0
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/malloc-machine.h
@@ -0,0 +1,28 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _MALLOC_MACHINE_H
+#define _MALLOC_MACHINE_H
+
+#include <ldsodefs.h>
+#define MALLOC_PROT_EXEC GLRO(dl_malloc_prot_exec)
+
+#include <sysdeps/generic/malloc-machine.h>
+
+#endif /* _MALLOC_MACHINE_H */
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/meminfo.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/meminfo.c
new file mode 100644
index 0000000000..e3523726ba
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/meminfo.c
@@ -0,0 +1,38 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <inline-syscall.h>
+#include <sys/types.h>
+#include <sys/mman.h>
+
+DECLARE_INLINE_SYSCALL (int, meminfo, int addr_count, struct meminfo *mip);
+
+int meminfo (const uint64_t *inaddr, int addr_count,
+ const unsigned int *info_req, int info_count, uint64_t *outdata,
+ unsigned int *validity)
+{
+ meminfo_t mi;
+ mi.mi_inaddr = inaddr;
+ mi.mi_info_req = info_req;
+ mi.mi_outdata = outdata;
+ mi.mi_validity = validity;
+ mi.mi_info_count = info_count;
+
+ return INLINE_SYSCALL (meminfo, 2, addr_count, &mi);
+}
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/mknodat.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/mknodat.c
new file mode 100644
index 0000000000..f2a2a97109
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/mknodat.c
@@ -0,0 +1,52 @@
+/* Copyright (C) 1995, 1996, 2001, 2005, 2006, 2008
+ Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ In addition to the permissions in the GNU Lesser General Public
+ License, the Free Software Foundation gives you unlimited
+ permission to link the compiled version of this file with other
+ programs, and to distribute those programs without any restriction
+ coming from the use of this file. (The GNU Lesser General Public
+ License restrictions do apply in other respects; for example, they
+ cover modification of the file, and distribution when not linked
+ into another program.)
+
+ Note that people who make modified versions of this file are not
+ obligated to grant this special exception for their modified
+ versions; it is their choice whether to do so. The GNU Lesser
+ General Public License gives permission to release a modified
+ version without this exception; this exception also makes it
+ possible to release a modified version which carries forward this
+ exception.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <errno.h>
+
+
+int
+attribute_hidden
+mknodat (int fd, const char *path, mode_t mode, dev_t dev)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+stub_warning (mknodat)
+#include <stub-tag.h>
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/mlock.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/mlock.c
new file mode 100644
index 0000000000..d224a38c33
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/mlock.c
@@ -0,0 +1,26 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sys/mman.h>
+
+int
+mlock (const void *addr, size_t len)
+{
+ return memcntl ((void*)addr, len, MC_LOCK, 0, 0, 0);
+}
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/mlockall.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/mlockall.c
new file mode 100644
index 0000000000..52018d30b2
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/mlockall.c
@@ -0,0 +1,27 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sys/types.h>
+#include <sys/mman.h>
+
+int
+mlockall (int flags)
+{
+ return memcntl (0, 0, MC_LOCKAS, (caddr_t)flags, 0, 0);
+}
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/mntent.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/mntent.h
new file mode 100644
index 0000000000..bf9b756c0b
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/mntent.h
@@ -0,0 +1,100 @@
+/* Utilities for reading/writing fstab, mtab, etc.
+ Copyright (C) 1995, 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _SYS_MNTTAB_H
+#ifndef _MNTENT_H
+#define _MNTENT_H 1
+
+#include <features.h>
+#define __need_FILE
+#include <stdio.h>
+#include <paths.h>
+
+
+/* File listing canonical interesting mount points. */
+#define MNTTAB _PATH_MNTTAB /* Deprecated alias. */
+
+/* File listing currently active mount points. */
+#define MOUNTED _PATH_MOUNTED /* Deprecated alias. */
+
+
+/* General filesystem types. */
+#define MNTTYPE_IGNORE "ignore" /* Ignore this entry. */
+#define MNTTYPE_NFS "nfs" /* Network file system. */
+#define MNTTYPE_SWAP "swap" /* Swap device. */
+
+
+/* Generic mount options. */
+#define MNTOPT_DEFAULTS "defaults" /* Use all default options. */
+#define MNTOPT_RO "ro" /* Read only. */
+#define MNTOPT_RW "rw" /* Read/write. */
+#define MNTOPT_SUID "suid" /* Set uid allowed. */
+#define MNTOPT_NOSUID "nosuid" /* No set uid allowed. */
+#define MNTOPT_NOAUTO "noauto" /* Do not auto mount. */
+
+
+__BEGIN_DECLS
+
+/* Structure describing a mount table entry. */
+struct mntent
+ {
+ char *mnt_fsname; /* Device or server for filesystem. */
+ char *mnt_dir; /* Directory mounted on. */
+ char *mnt_type; /* Type of filesystem: ufs, nfs, etc. */
+ char *mnt_opts; /* Comma-separated options for fs. */
+ int mnt_freq; /* Dump frequency (in days). */
+ int mnt_passno; /* Pass number for `fsck'. */
+ };
+
+
+/* Prepare to begin reading and/or writing mount table entries from the
+ beginning of FILE. MODE is as for `fopen'. */
+extern FILE *setmntent (__const char *__file, __const char *__mode) __THROW;
+
+/* Read one mount table entry from STREAM. Returns a pointer to storage
+ reused on the next call, or null for EOF or error (use feof/ferror to
+ check). */
+extern struct mntent *getmntent (FILE *__stream) __THROW;
+
+#ifdef __USE_MISC
+/* Reentrant version of the above function. */
+extern struct mntent *getmntent_r (FILE *__restrict __stream,
+ struct mntent *__restrict __result,
+ char *__restrict __buffer,
+ int __bufsize) __THROW;
+#endif
+
+/* Write the mount table entry described by MNT to STREAM.
+ Return zero on success, nonzero on failure. */
+extern int addmntent (FILE *__restrict __stream,
+ __const struct mntent *__restrict __mnt) __THROW;
+
+/* Close a stream opened with `setmntent'. */
+extern int endmntent (FILE *__stream) __THROW;
+
+/* Search MNT->mnt_opts for an option matching OPT.
+ Returns the address of the substring, or null if none found. */
+extern char *hasmntopt (__const struct mntent *__mnt,
+ __const char *__opt) __THROW;
+
+
+__END_DECLS
+
+#endif /* mntent.h */
+#endif
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/mntent_sun.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/mntent_sun.c
new file mode 100644
index 0000000000..820b115286
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/mntent_sun.c
@@ -0,0 +1,119 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <mntentP.h>
+#include <stdio.h>
+#include <string.h>
+#include <ctype.h>
+#include <sys/ioctl.h>
+
+/* Docs: http://docs.sun.com/app/docs/doc/816-5168/resetmnttab-3c */
+
+#define _MNT_CMP(x, y, f) \
+ (!y->f || (y->f && strcmp (x->f, y->f) == 0))
+
+
+int getmntent (FILE *fp, struct mnttab *mt)
+{
+ struct extmnttab emt;
+ int res = ioctl (fileno (fp), MNTIOC_GETMNTENT, &emt);
+ if (res != 0)
+ return -1;
+
+ mt->mnt_special = emt.mnt_special;
+ mt->mnt_mountp = emt.mnt_mountp;
+ mt->mnt_fstype = emt.mnt_fstype;
+ mt->mnt_mntopts = emt.mnt_mntopts;
+ mt->mnt_time = emt.mnt_time;
+
+ return 0;
+}
+
+int getmntany (FILE *fp, struct mnttab *mt, struct mnttab *mtpref)
+{
+ int res;
+ while ((res = getmntent (fp, mt)) == 0)
+ {
+ if (_MNT_CMP (mt, mtpref, mnt_special) &&
+ _MNT_CMP (mt, mtpref, mnt_mountp) &&
+ _MNT_CMP (mt, mtpref, mnt_fstype) &&
+ _MNT_CMP (mt, mtpref, mnt_mntopts) &&
+ _MNT_CMP (mt, mtpref, mnt_time))
+ return 0;
+ }
+
+ return res;
+}
+
+
+int getextmntent(FILE *fp, struct extmnttab *emt, int len)
+{
+ int res = ioctl (fileno (fp), MNTIOC_GETMNTENT, emt);
+ if (res != 0)
+ return -1;
+ return 0;
+}
+
+
+char *mntopt (char **opts)
+{
+ char *optsp = *opts;
+
+ /* Strip leading spaces. */
+ while (*optsp == ' ')
+ optsp++;
+
+ /* Find comma. */
+ char *ret = optsp;
+ while (*optsp != ',' && *optsp != '\0')
+ optsp++;
+
+ /* Replace comma with null terminator. */
+ if (*optsp == ',')
+ optsp++;
+ *opts = optsp;
+
+ return ret;
+}
+
+
+char * hasmntopt (struct mnttab *mt, char *opt)
+{
+ /* We make a copy of mnt_mntopts since we modify it. */
+ char buf[MNT_LINE_MAX + 1];
+ strncpy (buf, mt->mnt_mntopts, sizeof (buf))[MNT_LINE_MAX] = '\0';
+
+ char *opts = buf;
+ char *optp;
+ size_t len = strlen (opt);
+ while (*(optp = mntopt (&opts)))
+ {
+ /* Check if opt matched, taking into account delimiters (e.g. '='). */
+ if (strncmp (optp, opt, len) == 0 && !isalnum (optp[len]))
+ return mt->mnt_mntopts + (optp - buf);
+ }
+
+ return NULL;
+}
+
+
+void resetmnttab (FILE *fp)
+{
+ rewind (fp);
+}
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/mnttab.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/mnttab.c
new file mode 100644
index 0000000000..5f0a07b386
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/mnttab.c
@@ -0,0 +1,121 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <stdio.h>
+#include <string.h>
+#include <ctype.h>
+#include <sys/ioctl.h>
+#include <sys/mnttab.h>
+#include <sys/mntio.h>
+
+/* Docs: http://docs.sun.com/app/docs/doc/816-5168/resetmnttab-3c */
+
+#define _MNT_CMP(x, y, f) \
+ (!y->f || (y->f && strcmp (x->f, y->f) == 0))
+
+
+int __getmntent_sun (FILE *fp, struct mnttab *mt)
+{
+ struct extmnttab emt;
+ int res = ioctl (fileno (fp), MNTIOC_GETMNTENT, &emt);
+ if (res != 0)
+ return -1;
+
+ mt->mnt_special = emt.mnt_special;
+ mt->mnt_mountp = emt.mnt_mountp;
+ mt->mnt_fstype = emt.mnt_fstype;
+ mt->mnt_mntopts = emt.mnt_mntopts;
+ mt->mnt_time = emt.mnt_time;
+
+ return 0;
+}
+
+
+int getmntany (FILE *fp, struct mnttab *mt, struct mnttab *mtpref)
+{
+ int res;
+ while ((res = getmntent (fp, mt)) == 0)
+ {
+ if (_MNT_CMP (mt, mtpref, mnt_special) &&
+ _MNT_CMP (mt, mtpref, mnt_mountp) &&
+ _MNT_CMP (mt, mtpref, mnt_fstype) &&
+ _MNT_CMP (mt, mtpref, mnt_mntopts) &&
+ _MNT_CMP (mt, mtpref, mnt_time))
+ return 0;
+ }
+
+ return res;
+}
+
+
+int getextmntent (FILE *fp, struct extmnttab *emt, size_t len)
+{
+ int res = ioctl (fileno (fp), MNTIOC_GETMNTENT, emt);
+ if (res != 0)
+ return -1;
+ return 0;
+}
+
+
+char *mntopt (char **opts)
+{
+ char *optsp = *opts;
+
+ /* Strip leading spaces. */
+ while (*optsp == ' ')
+ optsp++;
+
+ /* Find comma. */
+ char *ret = optsp;
+ while (*optsp != ',' && *optsp != '\0')
+ optsp++;
+
+ /* Replace comma with null terminator. */
+ if (*optsp == ',')
+ optsp++;
+ *opts = optsp;
+
+ return ret;
+}
+
+
+char * __hasmntopt_sun (struct mnttab *mt, char *opt)
+{
+ /* We make a copy of mnt_mntopts since we modify it. */
+ char buf[MNT_LINE_MAX + 1];
+ strncpy (buf, mt->mnt_mntopts, sizeof (buf))[MNT_LINE_MAX] = '\0';
+
+ char *opts = buf;
+ char *optp;
+ size_t len = strlen (opt);
+ while (*(optp = mntopt (&opts)))
+ {
+ /* Check if opt matched, taking into account delimiters (e.g. '='). */
+ if (strncmp (optp, opt, len) == 0 && !isalnum (optp[len]))
+ return mt->mnt_mntopts + (optp - buf);
+ }
+
+ return NULL;
+}
+
+
+void resetmnttab (FILE *fp)
+{
+ rewind (fp);
+}
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/msync.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/msync.c
new file mode 100644
index 0000000000..5c8dfd156d
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/msync.c
@@ -0,0 +1,37 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sysdep-cancel.h>
+#include <sys/types.h>
+#include <sys/mman.h>
+
+int
+msync (__ptr_t addr, size_t len, int flags)
+{
+ if (SINGLE_THREAD_P)
+ return memcntl (addr, len, MC_SYNC, (caddr_t)flags, 0, 0);
+
+ int oldtype = LIBC_CANCEL_ASYNC ();
+
+ int res = memcntl (addr, len, MC_SYNC, (caddr_t)flags, 0, 0);
+
+ LIBC_CANCEL_RESET (oldtype);
+
+ return res;
+}
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/munlock.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/munlock.c
new file mode 100644
index 0000000000..c4e2755f2a
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/munlock.c
@@ -0,0 +1,26 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sys/mman.h>
+
+int
+munlock (const void *addr, size_t len)
+{
+ return memcntl ((void*)addr, len, MC_UNLOCK, 0, 0, 0);
+}
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/munlockall.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/munlockall.c
new file mode 100644
index 0000000000..55bf17e42d
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/munlockall.c
@@ -0,0 +1,26 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sys/mman.h>
+
+int
+munlockall (void)
+{
+ return memcntl (0, 0, MC_UNLOCKAS, 0, 0, 0);
+}
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/net/if.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/net/if.h
new file mode 100644
index 0000000000..ec68c8bcba
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/net/if.h
@@ -0,0 +1,574 @@
+/* net/if.h -- declarations for inquiring about network interfaces
+ Copyright (C) 1997,98,99,2000,2001, 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _NET_IF_H
+#define _NET_IF_H 1
+
+#include <features.h>
+
+#ifdef __USE_MISC
+# include <sys/types.h>
+# include <sys/socket.h>
+#endif
+
+
+/* Length of interface name. */
+#define IF_NAMESIZE 16
+#define LIF_NAMESIZE 32
+
+struct if_nameindex
+ {
+ unsigned int if_index; /* 1, 2, ... */
+ char *if_name; /* null terminated name: "eth0", ... */
+ };
+
+
+#ifdef __USE_MISC
+/* Standard interface flags. */
+enum
+ {
+ IFF_UP = 0x1, /* Interface is up. */
+# define IFF_UP IFF_UP
+ IFF_BROADCAST = 0x2, /* Broadcast address valid. */
+# define IFF_BROADCAST IFF_BROADCAST
+ IFF_DEBUG = 0x4, /* Turn on debugging. */
+# define IFF_DEBUG IFF_DEBUG
+ IFF_LOOPBACK = 0x8, /* Is a loopback net. */
+# define IFF_LOOPBACK IFF_LOOPBACK
+ IFF_POINTOPOINT = 0x10, /* Interface is point-to-point link. */
+# define IFF_POINTOPOINT IFF_POINTOPOINT
+ IFF_NOTRAILERS = 0x20, /* Avoid use of trailers. */
+# define IFF_NOTRAILERS IFF_NOTRAILERS
+ IFF_RUNNING = 0x40, /* Resources allocated. */
+# define IFF_RUNNING IFF_RUNNING
+ IFF_NOARP = 0x80, /* No address resolution protocol. */
+# define IFF_NOARP IFF_NOARP
+ IFF_PROMISC = 0x100, /* Receive all packets. */
+# define IFF_PROMISC IFF_PROMISC
+
+ /* Not supported */
+ IFF_ALLMULTI = 0x200, /* Receive all multicast packets. */
+# define IFF_ALLMULTI IFF_ALLMULTI
+
+ IFF_INTELLIGENT = 0x400, /* Protocol code on board. */
+# define IFF_INTELLIGENT IFF_INTELLIGENT
+
+ IFF_MULTICAST = 0x800, /* Supports multicast. */
+# define IFF_MULTICAST IFF_MULTICAST
+
+ IFF_MULTI_BCAST = 0x1000, /* Multicast using broadcast address. */
+# define IFF_MULTI_BCAST IFF_MULTI_BCAST
+ IFF_UNNUMBERED = 0x2000, /* Non-unique address. */
+# define IFF_DHCPRUNNING IFF_DHCPRUNNING
+ IFF_DHCPRUNNING = 0x4000, /* DHCP controls this interface. */
+# define IFF_DHCPRUNNING IFF_DHCPRUNNING
+ IFF_PRIVATE = 0x8000, /* Do not advertise. */
+# define IFF_PRIVATE IFF_PRIVATE
+
+ IFF_NOXMIT = 0x10000, /* Do not transmit packets. */
+# define IFF_NOXMIT IFF_NOXMIT
+ IFF_NOLOCAL = 0x20000, /* No address - just on-link subnet. */
+# define IFF_NOLOCAL IFF_NOLOCAL
+ IFF_DEPRECATED = 0x40000, /* Interface address deprecated. */
+# define IFF_DEPRECATED IFF_DEPRECATED
+ IFF_ADDRCONF = 0x80000, /* Address from stateless addrconf. */
+# define IFF_ADDRCONF IFF_ADDRCONF
+
+ IFF_ROUTER = 0x100000, /* Router on this interface. */
+# define IFF_ROUTER IFF_ROUTER
+ IFF_NONUD = 0x200000, /* No NUD on this interface. */
+# define IFF_NONUD IFF_NONUD
+ IFF_ANYCAST = 0x400000, /* Anycast address. */
+# define IFF_ANYCAST IFF_ANYCAST
+ IFF_NORTEXCH = 0x800000, /* Do not exchange routing info. */
+# define IFF_NORTEXCH IFF_NORTEXCH
+
+ IFF_IPV4 = 0x1000000, /* IPv4 interface. */
+# define IFF_IPV4 IFF_IPV4
+ IFF_IPV6 = 0x2000000, /* IPv6 interface. */
+# define IFF_IPV6 IFF_IPV6
+ /* IFF_MIPRUNNING = 0x4000000, */
+ IFF_NOFAILOVER = 0x8000000, /* Don't failover on NIC failure. */
+# define IFF_NOFAILOVER IFF_NOFAILOVER
+
+ IFF_FAILED = 0x10000000, /* NIC has failed. */
+# define IFF_FAILED IFF_FAILED
+ IFF_STANDBY = 0x2000000, /* Standby NIC to be used on failures. */
+# define IFF_STANDBY IFF_STANDBY
+ IFF_INACTIVE = 0x4000000, /* NIC active or not. */
+# define IFF_INACTIVE IFF_INACTIVE
+ IFF_OFFLINE = 0x80000000, /* NIC has been offlined. */
+# define IFF_OFFLINE IFF_OFFLINE
+
+ IFF_XRESOLV = 0x0100000000ll,
+# define IFF_XRESOLV IFF_XRESOLV
+ IFF_COS_ENABLED = 0x0200000000ll,
+# define IFF_COS_ENABLED IFF_COS_ENABLED
+ IFF_PREFERRED = 0x0400000000ll,
+# define IFF_PREFERRED IFF_PREFERRED
+ IFF_TEMPORARY = 0x0800000000ll,
+# define IFF_TEMPORARY IFF_TEMPORARY
+
+ IFF_FIXEDMTU = 0x1000000000ll,
+# define IFF_FIXEDMTU IFF_FIXEDMTU
+ IFF_VIRTUAL = 0x2000000000ll,
+# define IFF_VIRTUAL IFF_VIRTUAL
+ IFF_DUPLICATE = 0x4000000000ll
+# define IFF_DUPLICATE IFF_DUPLICATE
+ };
+
+/* The ifaddr structure contains information about one address of an
+ interface. They are maintained by the different address families,
+ are allocated and attached when an address is set, and are linked
+ together so all addresses for an interface can be located. */
+
+struct ifaddr
+ {
+ struct sockaddr ifa_addr; /* Address of interface. */
+ union
+ {
+ struct sockaddr ifu_broadaddr;
+ struct sockaddr ifu_dstaddr;
+ } ifa_ifu;
+ struct iface *ifa_ifp; /* Back-pointer to interface. */
+ struct ifaddr *ifa_next; /* Next address for interface. */
+ };
+
+# define ifa_broadaddr ifa_ifu.ifu_broadaddr /* broadcast address */
+# define ifa_dstaddr ifa_ifu.ifu_dstaddr /* other end of link */
+
+/* Device mapping structure. I'd just gone off and designed a
+ beautiful scheme using only loadable modules with arguments for
+ driver options and along come the PCMCIA people 8)
+
+ Ah well. The get() side of this is good for WDSETUP, and it'll be
+ handy for debugging things. The set side is fine for now and being
+ very small might be worth keeping for clean configuration. */
+
+struct ifmap
+ {
+ unsigned long int mem_start;
+ unsigned long int mem_end;
+ unsigned short int base_addr;
+ unsigned char irq;
+ unsigned char dma;
+ unsigned char port;
+ /* 3 bytes spare */
+ };
+
+/* Interface request structure used for socket ioctl's. All interface
+ ioctl's must have parameter definitions which begin with ifr_name.
+ The remainder may be interface specific. Note that OpenSolaris marks
+ this as deprecated (in favour of struct lifreq). */
+
+struct ifreq
+ {
+# define IFHWADDRLEN 6
+# define IFNAMSIZ IF_NAMESIZE
+ char ifr_name[IFNAMSIZ]; /* Interface name, e.g. "en0". */
+ union
+ {
+ struct sockaddr ifru_addr;
+ struct sockaddr ifru_dstaddr;
+ char ifru_oname[IFNAMSIZ];
+ struct sockaddr ifru_broadaddr;
+ int ifru_index;
+ short ifru_flags;
+ int ifru_metric;
+ char ifru_data[1];
+ char ifru_enaddr[6];
+ int if_muxid[2];
+
+ struct ifr_ppaflags
+ {
+ short ifrup_flags;
+ short ifrup_filler;
+ unsigned int ifrup_ppa;
+ } ifru_ppaflags;
+
+ struct ifr_dnld_reqs
+ {
+ __uint32_t v_addr;
+ __uint32_t m_addr;
+ __uint32_t ex_addr;
+ __uint32_t size;
+ } ifru_dnld_req;
+
+ struct ifr_fddi_stats
+ {
+ __uint32_t stat_size;
+ __uint32_t fddi_stats;
+ } ifru_fddi_stat;
+
+ struct ifr_netmapents
+ {
+ __uint32_t map_ent_size;
+ __uint32_t entry_number;
+ __uint32_t fddi_map_ent;
+ } ifru_netmapent;
+
+ struct ifr_fddi_gen_struct
+ {
+ __uint32_t ifru_fddi_gioctl;
+ __uint32_t ifru_fddi_gaddr;
+ } ifru_fddi_gstruct;
+
+ } ifr_ifru;
+ };
+# define ifr_addr ifr_ifru.ifru_addr /* address */
+# define ifr_dstaddr ifr_ifru.ifru_dstaddr /* other end of p-p lnk */
+# define ifr_oaddr ifr_ifru.ifru_oname /* other if name */
+# define ifr_broadaddr ifr_ifru.ifru_broadaddr /* broadcast address */
+# define ifr_flags ifr_ifru.ifru_flags /* flags */
+# define ifr_metric ifr_ifru.ifru_metric /* metric */
+# define ifr_data ifr_ifru.ifru_data /* for use by interface */
+# define ifr_enaddr ifr_ifru.ifru_enaddr /* ethernet address */
+# define ifr_index ifr_ifru.ifru_index /* interface index */
+# define ifr_ppa ifr_ifru.ifru_ppaflags.ifrup_ppa
+# define ifr_dnld_req ifr_ifru.ifru_dnld_req
+# define ifr_fddi_stat ifr_ifru.ifru_fddi_stat
+# define ifr_fddi_netmap ifr_ifru.ifru_netmapent
+# define ifr_fddi_gstruct ifr_ifru.ifru_fddi_gstruct
+# define ifr_ip_muxid ifr_ifru.if_muxid[0]
+# define ifr_arp_muxid ifr_ifru.if_muxid[1]
+
+# define ifr_netmask ifr_addr
+# define ifr_ifindex ifr_index
+# define _IOT_ifreq _IOT(_IOTS(char),IFNAMSIZ,_IOTS(char),16,0,0)
+# define _IOT_ifreq_short _IOT(_IOTS(char),IFNAMSIZ,_IOTS(short),1,0,0)
+# define _IOT_ifreq_int _IOT(_IOTS(char),IFNAMSIZ,_IOTS(int),1,0,0)
+
+#if 0
+# define ifr_hwaddr ifr_ifru.ifru_hwaddr /* MAC address */
+# define ifr_mtu ifr_ifru.ifru_mtu /* mtu */
+# define ifr_map ifr_ifru.ifru_map /* device map */
+# define ifr_slave ifr_ifru.ifru_slave /* slave device */
+# define ifr_bandwidth ifr_ifru.ifru_ivalue /* link bandwidth */
+# define ifr_qlen ifr_ifru.ifru_ivalue /* queue length */
+# define ifr_newname ifr_ifru.ifru_newname /* New name */
+#endif
+
+
+/* Structure used in SIOCGIFCONF request. Used to retrieve interface
+ configuration for machine (useful for programs which must know all
+ networks accessible). Note that OpenSolaris marks this as
+ deprecated (in favour of struct lifconf). */
+
+struct ifconf
+ {
+ int ifc_len; /* Size of buffer. */
+ union
+ {
+ __caddr_t ifcu_buf;
+ struct ifreq *ifcu_req;
+ } ifc_ifcu;
+ };
+# define ifc_buf ifc_ifcu.ifcu_buf /* Buffer address. */
+# define ifc_req ifc_ifcu.ifcu_req /* Array of structures. */
+# define _IOT_ifconf _IOT(_IOTS(struct ifconf),1,0,0,0,0) /* not right */
+
+/* Structure used in SIOCLIF*ND requests. */
+typedef struct lif_nd_req
+ {
+# define ND_MAX_HDW_LEN 64
+ struct sockaddr_storage lnr_addr;
+ __uint8_t lnr_state_create;
+ __uint8_t lnr_state_same_lla;
+ __uint8_t lnr_state_diff_lla;
+ int lnr_hdw_len;
+ int lnr_flags;
+ int lnr_pad0;
+ char lnr_hdw_addr[ND_MAX_HDW_LEN];
+ } lif_nd_req_t;
+
+# define ND_UNCHANGED 0
+# define ND_INCOMPLETE 1
+# define ND_REACHABLE 2
+# define ND_STALE 3
+# define ND_DELAY 4
+# define ND_PROBE 5
+# define ND_UNREACHABLE 6
+# define ND_INITIAL 7
+# define ND_STATE_VALID_MIN 0
+# define ND_STATE_VALID_MAX 7
+
+# define NDF_ISROUTER_ON 0x1
+# define NDF_ISROUTER_OFF 0x2
+# define NDF_ANYCAST_ON 0x4
+# define NDF_ANYCAST_OFF 0x8
+# define NDF_PROXY_ON 0x10
+# define NDF_PROXY_OFF 0x20
+
+/* Structure used for the SIOC[GS]LIFLNKINFO requests. */
+typedef struct lif_ifinfo_req
+ {
+ __uint8_t lir_maxhops;
+ __uint32_t lir_reachtime;
+ __uint32_t lir_reachretrans;
+ __uint32_t lir_maxmtu;
+ } lif_ifinfo_req_t;
+
+/* Recommended replacement structure for ifreq. */
+struct lifreq
+ {
+# define LIFNAMSIZ LIF_NAMESIZE
+# define LIFGRNAMSIZ LIF_NAMESIZE
+ char lifr_name[LIFNAMSIZ];
+ union
+ {
+ int lifru_addrlen;
+ unsigned int lifru_ppa;
+ } lifr_lifru1;
+ unsigned int lifr_movetoindex;
+ union
+ {
+ struct sockaddr_storage lifru_addr;
+ struct sockaddr_storage lifru_dstaddr;
+ struct sockaddr_storage lifru_broadaddr;
+ struct sockaddr_storage lifru_token;
+ struct sockaddr_storage lifru_subnet;
+ int lifru_index;
+ uint64_t lifru_flags;
+ int lifru_metric;
+ unsigned int lifru_mtu;
+ char lifru_data[1];
+ char lifru_enaddr[6];
+ int lif_muxid[2];
+ struct lif_nd_req lifru_nd_req;
+ struct lif_ifinfo_req lifru_ifinfo_req;
+ char lifru_groupname[LIFGRNAMSIZ];
+ unsigned int lifru_delay;
+ zoneid_t lifru_zoneid;
+ } lifr_lifru;
+};
+# define lifr_addrlen lifr_lifru1.lifru_addrlen
+# define lifr_ppa lifr_lifru1.lifru_ppa /* driver's ppa */
+# define lifr_addr lifr_lifru.lifru_addr /* address */
+# define lifr_dstaddr lifr_lifru.lifru_dstaddr /* other end of p-to-p link */
+# define lifr_broadaddr lifr_lifru.lifru_broadaddr /* broadcast address */
+# define lifr_token lifr_lifru.lifru_token /* address token */
+# define lifr_subnet lifr_lifru.lifru_subnet /* subnet prefix */
+# define lifr_index lifr_lifru.lifru_index /* interface index */
+# define lifr_flags lifr_lifru.lifru_flags /* flags */
+# define lifr_metric lifr_lifru.lifru_metric /* metric */
+# define lifr_mtu lifr_lifru.lifru_mtu /* mtu */
+# define lifr_data lifr_lifru.lifru_data /* for use by interface */
+# define lifr_enaddr lifr_lifru.lifru_enaddr /* ethernet address */
+# define lifr_index lifr_lifru.lifru_index /* interface index */
+# define lifr_ip_muxid lifr_lifru.lif_muxid[0]
+# define lifr_arp_muxid lifr_lifru.lif_muxid[1]
+# define lifr_nd lifr_lifru.lifru_nd_req
+# define lifr_ifinfo lifr_lifru.lifru_ifinfo_req
+# define lifr_groupname lifr_lifru.lifru_groupname
+# define lifr_delay lifr_lifru.lifru_delay
+# define lifr_zoneid lifr_lifru.lifru_zoneid
+
+/* Structure used in SIOCT* requests. */
+struct sioc_addrreq
+ {
+ struct sockaddr_storage sa_addr;
+ int sa_res;
+ int sa_pad;
+ };
+
+/* Structure used in SIOCGETLSGCNT requests. */
+struct sioc_lsg_req
+ {
+ struct sockaddr_storage slr_src;
+ struct sockaddr_storage slr_grp;
+ unsigned int slr_pktcnt;
+ unsigned int slr_bytecnt;
+ unsigned int slr_wrong_if;
+ unsigned int slr_pad;
+ };
+
+/* Structure used in SIOCGLIFNUM request. */
+struct lifnum
+ {
+ sa_family_t lifn_family;
+ int lifn_flags;
+ int lifn_count;
+ };
+
+/* Structure used in SIOCGLIFCONF request. */
+struct lifconf
+ {
+ sa_family_t lifc_family;
+ int lifc_flags;
+ int lifc_len;
+ union
+ {
+ __caddr_t lifcu_buf;
+ struct lifreq *lifcu_req;
+ } lifc_lifcu;
+ };
+# define lifc_buf lifc_lifcu.lifcu_buf
+# define lifc_req lifc_lifcu.lifcu_req
+
+/* Structure used in SIOCGLIFSRCOF request. */
+struct lifsrcof
+ {
+ unsigned int lifs_ifindex;
+ size_t lifs_maxlen;
+ size_t lifs_len;
+ union
+ {
+ __caddr_t lifsu_buf;
+ struct lifreq *lifsu_req;
+ } lifs_lifsu;
+ };
+# define lifs_buf lifs_lifsu.lifsu_buf
+# define lifs_req lifs_lifsu.lifsu_req
+
+# define LIFC_NOXMIT 0x01
+# define LIFC_EXTERNAL_SOURCE 0x02
+# define LIFC_TEMPORARY 0x04
+# define LIFC_ALLZONES 0x08
+
+typedef struct if_data
+ {
+ unsigned char ifi_type;
+ unsigned char ifi_addrlen;
+ unsigned char ifi_hdrlen;
+ unsigned int ifi_mtu;
+ unsigned int ifi_metric;
+ unsigned int ifi_baudrate;
+ unsigned int ifi_ipackets;
+ unsigned int ifi_ierrors;
+ unsigned int ifi_opackets;
+ unsigned int ifi_oerrors;
+ unsigned int ifi_collisions;
+ unsigned int ifi_ibytes;
+ unsigned int ifi_obytes;
+ unsigned int ifi_imcasts;
+ unsigned int ifi_omcasts;
+ unsigned int ifi_iqdrops;
+ unsigned int ifi_noproto;
+ } if_data_t;
+
+typedef struct if_msghdr
+ {
+ unsigned short ifm_msglen;
+ unsigned char ifm_version;
+ unsigned char ifm_type;
+ int ifm_addrs;
+ int ifm_flags;
+ unsigned short ifm_index;
+ struct if_data ifm_data;
+ } if_msghdr_t;
+
+typedef struct ifa_msghdr
+ {
+ unsigned short ifam_msglen;
+ unsigned char ifam_version;
+ unsigned char ifam_type;
+ int ifam_addrs;
+ int ifam_flags;
+ unsigned short ifam_index;
+ int ifam_metric;
+ } ifa_msghdr_t;
+
+enum ifta_proto
+ {
+ IFTAP_INVALID,
+ IFTAP_IPV4,
+ IFTAP_IPV6
+ };
+
+# define IFTUN_VERSION 1
+
+/* Structure used in SIOCTUN[SG]PARAM requests. */
+struct iftun_req
+ {
+# define IFTUN_SECINFOLEN 8
+ char ifta_lifr_name[LIFNAMSIZ];
+ struct sockaddr_storage ifta_saddr;
+ struct sockaddr_storage ifta_daddr;
+ unsigned int ifta_flags;
+ enum ifta_proto ifta_upper;
+ enum ifta_proto ifta_lower;
+ unsigned int ifta_vers;
+ __uint32_t ifta_secinfo[IFTUN_SECINFOLEN];
+ __int16_t ifta_encap_lim;
+ __uint8_t ifta_hop_limit;
+ __uint8_t ifta_spare0;
+ __uint32_t ifta_spare1;
+ };
+
+# define IFTUN_SRC 0x01
+# define IFTUN_DST 0x02
+# define IFTUN_SECURITY 0x04
+# define IFTUN_ENCAP 0x08
+# define IFTUN_HOPLIMIT 0x10
+# define IFTUN_COMPLEX_SECURITY 0x20
+
+struct ifnet
+ {
+ char *if_name;
+ short if_unit;
+ short if_mtu;
+ short if_flags;
+ short if_timer;
+ unsigned short if_promisc;
+ int if_metric;
+ struct ifaddr *if_addrlist;
+ struct ifqueue
+ {
+ struct mbuf *ifq_head;
+ struct mbuf *ifq_tail;
+ int ifq_len;
+ int ifq_maxlen;
+ int ifq_drops;
+ } if_snd;
+ int (*if_init)(void);
+ int (*if_output)(void);
+ int (*if_ioctl)(void);
+ int (*if_reset)(void);
+ int (*if_watchdog)(void);
+ int if_ipackets;
+ int if_ierrors;
+ int if_opackets;
+ int if_oerrors;
+ int if_collisions;
+ struct ifnet *if_next;
+ struct ifnet *if_upper;
+ struct ifnet *if_lower;
+ int (*if_input)(void);
+ int (*if_ctlin)(void);
+ int (*if_ctlout)(void);
+ struct map *if_memmap;
+ };
+
+#endif /* Misc. */
+
+__BEGIN_DECLS
+
+/* Convert an interface name to an index, and vice versa. */
+extern unsigned int if_nametoindex (__const char *__ifname) __THROW;
+extern char *if_indextoname (unsigned int __ifindex, char *__ifname) __THROW;
+
+/* Return a list of all interfaces and their indices. */
+extern struct if_nameindex *if_nameindex (void) __THROW;
+
+/* Free the data returned from if_nameindex. */
+extern void if_freenameindex (struct if_nameindex *__ptr) __THROW;
+
+__END_DECLS
+
+#endif /* net/if.h */
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/net/if_dl.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/net/if_dl.h
new file mode 100644
index 0000000000..a3e3d84828
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/net/if_dl.h
@@ -0,0 +1,37 @@
+/* net/if.h -- declarations for a link-level socket
+ Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _NET_IF_DL_H
+#define _NET_IF_DL_H 1
+
+#include <bits/sockaddr.h>
+
+struct sockaddr_dl
+{
+ __SOCKADDR_COMMON(sdl_);
+ unsigned short sdl_index;
+ unsigned char sdl_type;
+ unsigned char sdl_nlen;
+ unsigned char sdl_alen;
+ unsigned char sdl_slen;
+ char sdl_data[244];
+};
+
+#endif /* _NET_IF_DL_H */
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/netinet/tcp.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/netinet/tcp.h
new file mode 100644
index 0000000000..5179240ee8
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/netinet/tcp.h
@@ -0,0 +1,217 @@
+/*
+ * Copyright (c) 1982, 1986, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * @(#)tcp.h 8.1 (Berkeley) 6/10/93
+ */
+
+#ifndef _NETINET_TCP_H
+#define _NETINET_TCP_H 1
+
+#include <features.h>
+
+/*
+ * User-settable options (used with setsockopt).
+ */
+#ifndef TCP_NODELAY
+# define TCP_NODELAY 0x01
+#endif
+#ifndef TCP_MAXSEG
+# define TCP_MAXSEG 0x02
+#endif
+#ifndef TCP_KEEPALIVE
+# define TCP_KEEPALIVE 0x08
+#endif
+#define TCP_NOTIFY_THRESHOLD 0x10
+#define TCP_ABORT_THRESHOLD 0x11
+#define TCP_CONN_NOTIFY_THRESHOLD 0x12
+#define TCP_CONN_ABORT_THRESHOLD 0x13
+#define TCP_RECVDSTADDR 0x14
+#define TCP_INIT_CWND 0x15
+#define TCP_KEEPALIVE_THRESHOLD 0x16
+#define TCP_KEEPALIVE_ABORT_THRESHOLD 0x17
+#define TCP_CORK 0x18
+#define TCP_ANONPRIVBIND 0x20
+#define TCP_EXCLBIND 0x21
+
+
+#ifdef __USE_MISC
+# include <sys/types.h>
+# include <sys/socket.h>
+
+typedef u_int32_t tcp_seq;
+/*
+ * TCP header.
+ * Per RFC 793, September, 1981.
+ */
+struct tcphdr
+ {
+ u_int16_t th_sport; /* source port */
+ u_int16_t th_dport; /* destination port */
+ tcp_seq th_seq; /* sequence number */
+ tcp_seq th_ack; /* acknowledgement number */
+# if __BYTE_ORDER == __LITTLE_ENDIAN
+ u_int8_t th_x2:4; /* (unused) */
+ u_int8_t th_off:4; /* data offset */
+# endif
+# if __BYTE_ORDER == __BIG_ENDIAN
+ u_int8_t th_off:4; /* data offset */
+ u_int8_t th_x2:4; /* (unused) */
+# endif
+ u_int8_t th_flags;
+# define TH_FIN 0x01
+# define TH_SYN 0x02
+# define TH_RST 0x04
+# define TH_PUSH 0x08
+# define TH_ACK 0x10
+# define TH_URG 0x20
+ u_int16_t th_win; /* window */
+ u_int16_t th_sum; /* checksum */
+ u_int16_t th_urp; /* urgent pointer */
+};
+
+enum
+{
+ TCP_ESTABLISHED = 1,
+ TCP_SYN_SENT,
+ TCP_SYN_RECV,
+ TCP_FIN_WAIT1,
+ TCP_FIN_WAIT2,
+ TCP_TIME_WAIT,
+ TCP_CLOSE,
+ TCP_CLOSE_WAIT,
+ TCP_LAST_ACK,
+ TCP_LISTEN,
+ TCP_CLOSING /* now a valid state */
+};
+
+# define TCPOPT_EOL 0
+# define TCPOPT_NOP 1
+# define TCPOPT_MAXSEG 2
+# define TCPOPT_WSCALE 3
+# define TCPOLEN_MAXSEG 4
+# define TCPOPT_WINDOW 3
+# define TCPOLEN_WINDOW 3
+# define TCPOPT_SACK_PERMITTED 4 /* Experimental */
+# define TCPOLEN_SACK_PERMITTED 2
+# define TCPOPT_SACK 5 /* Experimental */
+# define TCPOPT_TIMESTAMP 8
+# define TCPOLEN_TIMESTAMP 10
+# define TCPOLEN_TSTAMP_APPA (TCPOLEN_TIMESTAMP+2) /* appendix A */
+
+# define TCPOPT_TSTAMP_HDR \
+ (TCPOPT_NOP<<24|TCPOPT_NOP<<16|TCPOPT_TIMESTAMP<<8|TCPOLEN_TIMESTAMP)
+
+/*
+ * Default maximum segment size for TCP.
+ * With an IP MSS of 576, this is 536,
+ * but 512 is probably more convenient.
+ * This should be defined as MIN(512, IP_MSS - sizeof (struct tcpiphdr)).
+ */
+# define TCP_MSS 512
+
+# define TCP_MAXWIN 65535 /* largest value for (unscaled) window */
+
+# define TCP_MAX_WINSHIFT 14 /* maximum window shift */
+
+# define SOL_TCP 6 /* TCP level */
+
+
+# define TCPI_OPT_TIMESTAMPS 1
+# define TCPI_OPT_SACK 2
+# define TCPI_OPT_WSCALE 4
+# define TCPI_OPT_ECN 8
+
+/* Values for tcpi_state. */
+enum tcp_ca_state
+{
+ TCP_CA_Open = 0,
+ TCP_CA_Disorder = 1,
+ TCP_CA_CWR = 2,
+ TCP_CA_Recovery = 3,
+ TCP_CA_Loss = 4
+};
+
+struct tcp_info
+{
+ u_int8_t tcpi_state;
+ u_int8_t tcpi_ca_state;
+ u_int8_t tcpi_retransmits;
+ u_int8_t tcpi_probes;
+ u_int8_t tcpi_backoff;
+ u_int8_t tcpi_options;
+ u_int8_t tcpi_snd_wscale : 4, tcpi_rcv_wscale : 4;
+
+ u_int32_t tcpi_rto;
+ u_int32_t tcpi_ato;
+ u_int32_t tcpi_snd_mss;
+ u_int32_t tcpi_rcv_mss;
+
+ u_int32_t tcpi_unacked;
+ u_int32_t tcpi_sacked;
+ u_int32_t tcpi_lost;
+ u_int32_t tcpi_retrans;
+ u_int32_t tcpi_fackets;
+
+ /* Times. */
+ u_int32_t tcpi_last_data_sent;
+ u_int32_t tcpi_last_ack_sent; /* Not remembered, sorry. */
+ u_int32_t tcpi_last_data_recv;
+ u_int32_t tcpi_last_ack_recv;
+
+ /* Metrics. */
+ u_int32_t tcpi_pmtu;
+ u_int32_t tcpi_rcv_ssthresh;
+ u_int32_t tcpi_rtt;
+ u_int32_t tcpi_rttvar;
+ u_int32_t tcpi_snd_ssthresh;
+ u_int32_t tcpi_snd_cwnd;
+ u_int32_t tcpi_advmss;
+ u_int32_t tcpi_reordering;
+
+ u_int32_t tcpi_rcv_rtt;
+ u_int32_t tcpi_rcv_space;
+
+ u_int32_t tcpi_total_retrans;
+};
+
+
+/* For TCP_MD5SIG socket option. */
+#define TCP_MD5SIG_MAXKEYLEN 80
+
+struct tcp_md5sig
+{
+ struct sockaddr_storage tcpm_addr; /* Address associated. */
+ u_int16_t __tcpm_pad1; /* Zero. */
+ u_int16_t tcpm_keylen; /* Key length. */
+ u_int32_t __tcpm_pad2; /* Zero. */
+ u_int8_t tcpm_key[TCP_MD5SIG_MAXKEYLEN]; /* Key (binary). */
+};
+
+#endif /* Misc. */
+
+#endif /* netinet/tcp.h */
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/netinet/udp.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/netinet/udp.h
new file mode 100644
index 0000000000..3557766763
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/netinet/udp.h
@@ -0,0 +1,75 @@
+/* Copyright (C) 1991, 92, 93, 95, 96, 97, 2004 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+/*
+ * Copyright (C) 1982, 1986 Regents of the University of California.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef __NETINET_UDP_H
+#define __NETINET_UDP_H 1
+
+#include <features.h>
+#include <sys/types.h>
+
+
+/* UDP header as specified by RFC 768, August 1980. */
+struct udphdr
+{
+ u_int16_t uh_sport; /* source port */
+ u_int16_t uh_dport; /* destination port */
+ u_int16_t uh_ulen; /* udp length */
+ u_int16_t uh_sum; /* udp checksum */
+};
+
+#define SOL_UDP 17 /* sockopt level for UDP */
+
+/* Option definitions. */
+#define UDP_ANONPRIVBIND 0x0100
+#define UDP_EXCLBIND 0x0101
+#define UDP_RCVHDR 0x0102
+#define UDP_NAT_T_ENDPOINT 0x0103
+#ifndef UDP_CHECKSUM
+# define UDP_CHECKSUM 0x0600
+#endif
+
+#endif /* netinet/udp.h */
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/netmask.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/netmask.c
new file mode 100644
index 0000000000..f6628b778e
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/netmask.c
@@ -0,0 +1,29 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <netinet/in.h>
+#include <errno.h>
+
+// TODO
+
+int getnetmaskbyaddr(const struct in_addr addr, struct in_addr *mask)
+{
+ __set_errno(ENOSYS);
+ return -1;
+}
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/netmasks-lookup.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/netmasks-lookup.c
new file mode 100644
index 0000000000..26a59f893c
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/netmasks-lookup.c
@@ -0,0 +1,23 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#define DATABASE_NAME netmasks
+#define DEFAULT_CONFIG "nis [NOTFOUND=return] files"
+
+#include "XXX-lookup.c"
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/not-cancel.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/not-cancel.h
new file mode 100644
index 0000000000..6335a3e93e
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/not-cancel.h
@@ -0,0 +1,98 @@
+/* Uncancelable versions of cancelable interfaces. OpenSolaris version.
+ Copyright (C) 2003, 2006, 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sys/syscall.h>
+#include <sys/types.h>
+
+extern int open_not_cancel(const char *name, int flags, mode_t mode);
+#define open_not_cancel_2(name, flags) \
+ open_not_cancel((name), (flags), 0)
+
+extern int open64_not_cancel(const char *name, int flags, mode_t mode);
+#define open64_not_cancel_2(name, flags) \
+ open64_not_cancel((name), (flags), 0)
+
+extern int openat_not_cancel(int dirfd, const char *name,
+ int flags, mode_t mode);
+#define openat_not_cancel_3(fd, name, flags) \
+ openat_not_cancel((fd), (name), (flags), 0)
+
+extern int openat64_not_cancel(int dirfd, const char *name,
+ int flags, mode_t mode);
+#define openat64_not_cancel_3(fd, name, flags) \
+ openat64_not_cancel((fd), (name), (flags), 0)
+
+#define close_not_cancel(fd) \
+ syscall (SYS_close, fd)
+#define close_not_cancel_no_status(fd) \
+ ({sysret_t __ret; \
+ (void)__systemcall (&__ret, SYS_close, (fd));})
+
+#define read_not_cancel(fd, buf, n) \
+ ({int __fd = (fd); \
+ void *__buf = (buf); \
+ size_t __n = (n); \
+ int __ret; \
+ while ((__ret = syscall (SYS_read, __fd, __buf, __n)) == -1 && \
+ errno == ERESTART); \
+ __ret;})
+#define write_not_cancel(fd, buf, n) \
+ ({int __fd = (fd); \
+ const void *__buf = (buf); \
+ size_t __n = (n); \
+ int __ret; \
+ while ((__ret = syscall (SYS_write, __fd, __buf, __n)) == -1 && \
+ errno == ERESTART); \
+ __ret;})
+
+#define writev_not_cancel_no_status(fd, iov, n) \
+ ({sysret_t __ret; \
+ int __fd = (fd); \
+ const struct iovec *__iov = (iov); \
+ size_t __n = (n); \
+ while (__systemcall (&__ret, SYS_writev, __fd, __iov, __n) == \
+ ERESTART);})
+
+extern int __fcntl_not_cancel (int fd, int cmd, ...);
+#define fcntl_not_cancel(fd, cmd, val) \
+ __fcntl_not_cancel ((fd), (cmd), (val))
+
+extern __pid_t __waitpid_not_cancel(__pid_t pid, int *stat_loc, int options);
+#define waitpid_not_cancel(pid, stat_loc, options) \
+ __waitpid_not_cancel ((pid), (stat_loc), (options))
+
+# define pause_not_cancel() \
+ syscall (SYS_pause)
+
+# define nanosleep_not_cancel(requested_time, remaining) \
+ syscall (SYS_nanosleep, (requested_time), (remaining))
+
+#define sigsuspend_not_cancel(set) \
+ syscall (SYS_sigsuspend, (set))
+
+#define waitid_not_cancel(idtype, id, infop, options) \
+ ({idtype_t __idtype = (idtype); \
+ id_t __id = (id); \
+ siginfo_t *__infop = (infop); \
+ int __options = (options); \
+ int __ret; \
+ while ((__ret = syscall (SYS_waitid, __idtype, __id, __infop, \
+ __options)) == -1 && errno == ERESTART); \
+ __ret;})
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/open-func.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/open-func.c
new file mode 100644
index 0000000000..65b5b5b823
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/open-func.c
@@ -0,0 +1,112 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sysdep-cancel.h>
+#include <not-cancel.h>
+#include <inline-syscall.h>
+#include <stdarg.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <sys/ioctl.h>
+#include <errno.h>
+
+#ifndef OPEN_FUNC_PRE_FILE_PARAM_DECLS
+# define OPEN_FUNC_PRE_FILE_PARAM_DECLS
+#endif
+#ifndef OPEN_FUNC_PRE_FILE_ARGS
+# define OPEN_FUNC_PRE_FILE_ARGS
+#endif
+
+/* rtld doesn't use O_DIRECT or O_DIRECTORY so just use the syscall */
+
+int
+OPEN_NOT_CANCEL_FUNC_NAME (OPEN_FUNC_PRE_FILE_PARAM_DECLS
+ const char *file, int oflag, mode_t mode)
+{
+ /* ensure we don't pass O_DIRECT and O_DIRECTORY down */
+ int saved_oflag = oflag;
+ oflag = oflag & ~(O_DIRECT | O_DIRECTORY);
+
+ if (saved_oflag & O_DIRECT)
+ oflag |= O_SYNC | O_RSYNC;
+
+ int fd = OPEN_FUNC_SYSCALL;
+ if (fd == -1)
+ return -1;
+
+ /* verify that opened file was a directory */
+ if (saved_oflag & O_DIRECTORY)
+ {
+ OPEN_FUNC_STAT_BUF buf;
+ int res = OPEN_FUNC_STAT;
+ if (res == -1)
+ {
+ close_not_cancel_no_status (fd);
+ return -1;
+ }
+ if (!S_ISDIR (buf.st_mode))
+ {
+ close_not_cancel_no_status (fd);
+ __set_errno (ENOTDIR);
+ return -1;
+ }
+ }
+
+ /* enable direct i/o via _FIODIRECTIO */
+ if (saved_oflag & O_DIRECT)
+ {
+ int res = ioctl (fd, _FIODIRECTIO, DIRECTIO_ON);
+ if (res == -1)
+ {
+ close_not_cancel_no_status(fd);
+ return -1;
+ }
+ }
+
+ return fd;
+}
+
+int
+OPEN_FUNC_NAME (OPEN_FUNC_PRE_FILE_PARAM_DECLS
+ const char *file, int oflag, ...)
+{
+ int mode = 0;
+
+ if (oflag & O_CREAT)
+ {
+ va_list arg;
+ va_start (arg, oflag);
+ mode = va_arg (arg, int);
+ va_end (arg);
+ }
+
+ if (SINGLE_THREAD_P)
+ return OPEN_NOT_CANCEL_FUNC_NAME (OPEN_FUNC_PRE_FILE_ARGS
+ file, oflag, mode);
+
+ int oldtype = LIBC_CANCEL_ASYNC ();
+
+ int res = OPEN_NOT_CANCEL_FUNC_NAME (OPEN_FUNC_PRE_FILE_ARGS
+ file, oflag, mode);
+
+ LIBC_CANCEL_RESET (oldtype);
+
+ return res;
+}
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/open.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/open.c
new file mode 100644
index 0000000000..80c16c2344
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/open.c
@@ -0,0 +1,35 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <inline-syscall.h>
+
+DECLARE_INLINE_SYSCALL (int, open, const char *pathname, int flags,
+ mode_t mode);
+
+#define OPEN_FUNC_NAME __libc_open
+#define OPEN_NOT_CANCEL_FUNC_NAME open_not_cancel
+#define OPEN_FUNC_SYSCALL INLINE_SYSCALL(open, 3, file, oflag, mode)
+#define OPEN_FUNC_STAT fstat(fd, &buf)
+#define OPEN_FUNC_STAT_BUF struct stat
+#include "open-func.c"
+
+libc_hidden_def (__libc_open)
+weak_alias (__libc_open, __open)
+libc_hidden_weak (__open)
+weak_alias (__libc_open, open)
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/open64.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/open64.c
new file mode 100644
index 0000000000..bc05609009
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/open64.c
@@ -0,0 +1,34 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <inline-syscall.h>
+
+DECLARE_INLINE_SYSCALL (int, open64, const char *pathname, int flags,
+ mode_t mode);
+
+#define OPEN_FUNC_NAME __libc_open64
+#define OPEN_NOT_CANCEL_FUNC_NAME open64_not_cancel
+#define OPEN_FUNC_SYSCALL INLINE_SYSCALL(open64, 3, file, oflag, mode)
+#define OPEN_FUNC_STAT fstat64(fd, &buf)
+#define OPEN_FUNC_STAT_BUF struct stat64
+#include "open-func.c"
+
+weak_alias (__libc_open64, __open64)
+libc_hidden_weak (__open64)
+weak_alias (__libc_open64, open64)
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/openat.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/openat.c
new file mode 100644
index 0000000000..245fab32f8
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/openat.c
@@ -0,0 +1,35 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <inline-syscall.h>
+
+DECLARE_INLINE_SYSCALL (int, openat, int dirfd, const char *pathname,
+ int flags, mode_t mode);
+
+#define OPEN_FUNC_NAME __openat
+#define OPEN_NOT_CANCEL_FUNC_NAME openat_not_cancel
+#define OPEN_FUNC_SYSCALL INLINE_SYSCALL (openat, 4, dirfd, file, oflag, mode)
+#define OPEN_FUNC_PRE_FILE_PARAM_DECLS int dirfd,
+#define OPEN_FUNC_PRE_FILE_ARGS dirfd,
+#define OPEN_FUNC_STAT fstat(fd, &buf)
+#define OPEN_FUNC_STAT_BUF struct stat
+#include "open-func.c"
+
+libc_hidden_def (__openat)
+weak_alias (__openat, openat)
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/openat64.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/openat64.c
new file mode 100644
index 0000000000..780f0ea946
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/openat64.c
@@ -0,0 +1,35 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <inline-syscall.h>
+
+DECLARE_INLINE_SYSCALL (int, openat64, int dirfd, const char *pathname,
+ int flags, mode_t mode);
+
+#define OPEN_FUNC_NAME __openat64
+#define OPEN_NOT_CANCEL_FUNC_NAME openat64_not_cancel
+#define OPEN_FUNC_SYSCALL INLINE_SYSCALL (openat64, 4, dirfd, file, oflag, mode)
+#define OPEN_FUNC_PRE_FILE_PARAM_DECLS int dirfd,
+#define OPEN_FUNC_PRE_FILE_ARGS dirfd,
+#define OPEN_FUNC_STAT fstat64(fd, &buf)
+#define OPEN_FUNC_STAT_BUF struct stat64
+#include "open-func.c"
+
+libc_hidden_def (__openat64)
+weak_alias (__openat64, openat64)
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/openpty.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/openpty.c
new file mode 100644
index 0000000000..d2b109c3c4
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/openpty.c
@@ -0,0 +1,30 @@
+/* Copyright (C) 2009 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2009.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <streams/stropts.h>
+
+#define __OPENPTY_INIT_SLAVE(slave) \
+ if (ioctl(slave, I_PUSH, "ptem") == -1 || \
+ ioctl(slave, I_PUSH, "ldterm") == -1 || \
+ ioctl(slave, I_PUSH, "ttcompat") == -1) { \
+ if (buf != _buf) \
+ free (buf); \
+ }
+
+#include <login/openpty.c>
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/paths.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/paths.h
new file mode 100644
index 0000000000..d872938792
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/paths.h
@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) 1989, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * @(#)paths.h 8.1 (Berkeley) 6/2/93
+ */
+
+#ifndef _PATHS_H_
+#define _PATHS_H_
+
+/* Default search path. */
+#define _PATH_DEFPATH "/usr/bin:/bin"
+/* All standard utilities path. */
+#define _PATH_STDPATH \
+ "/usr/bin:/bin:/usr/sbin:/sbin:/usr/contrib/bin:/usr/old/bin"
+
+#define _PATH_BSHELL "/bin/sh"
+#define _PATH_CONSOLE "/dev/console"
+#define _PATH_CSHELL "/bin/csh"
+#define _PATH_DEVDB "/var/run/dev.db"
+#define _PATH_DEVNULL "/dev/null"
+#define _PATH_DRUM "/dev/drum"
+#define _PATH_KMEM "/dev/kmem"
+#define _PATH_MAILDIR "/var/mail"
+#define _PATH_LASTLOG "/var/log/lastlog"
+#define _PATH_MAN "/usr/man"
+#define _PATH_MEM "/dev/mem"
+#define _PATH_MNTTAB "/etc/vfstab"
+#define _PATH_MOUNTED "/etc/mnttab"
+#define _PATH_NOLOGIN "/etc/nologin"
+#define _PATH_PRESERVE "/var/preserve"
+#define _PATH_RWHODIR "/var/rwho"
+#define _PATH_SENDMAIL "/usr/sbin/sendmail"
+#define _PATH_SHADOW "/etc/shadow"
+#define _PATH_SHELLS "/etc/shells"
+#define _PATH_TTY "/dev/tty"
+#define _PATH_UNIX "/vmunix"
+#define _PATH_UTMP "/var/run/utmp"
+#define _PATH_UTMP_DB "/var/run/utmp.db"
+#define _PATH_VI "/usr/bin/vi"
+#define _PATH_WTMP "/var/log/wtmp"
+
+/* Provide trailing slash, since mostly used for building pathnames. */
+#define _PATH_DEV "/dev/"
+#define _PATH_TMP "/tmp/"
+#define _PATH_VARDB "/var/db/"
+#define _PATH_VARRUN "/var/run/"
+#define _PATH_VARTMP "/var/tmp/"
+
+#endif /* !_PATHS_H_ */
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/pcsample.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/pcsample.h
new file mode 100644
index 0000000000..04f1395275
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/pcsample.h
@@ -0,0 +1,31 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _PCSAMPLE_H
+#define _PCSAMPLE_H
+
+#include <sys/types.h>
+#include <features.h>
+
+__BEGIN_DECLS
+
+long pcsample (uintptr_t [], long);
+
+__END_DECLS
+
+#endif /* _PCSAMPLE_H */
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/pipe.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/pipe.c
new file mode 100644
index 0000000000..09abf082f7
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/pipe.c
@@ -0,0 +1,51 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <inline-syscall.h>
+#include <unistd.h>
+#include <stddef.h>
+#include <errno.h>
+
+DECLARE_INLINE_SYSCALL (int64_t, pipe, void);
+
+int
+__pipe (__pipedes)
+ int __pipedes[2];
+{
+ if (__pipedes == NULL)
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ rval_t result;
+ result.rval64 = INLINE_SYSCALL (pipe, 0);
+
+ /* Only the lower 32-bits are set to -1 on error (see NOTES.opensolaris). */
+ if (result.rval1 == -1)
+ return -1;
+
+ __pipedes[0] = result.rval1;
+ __pipedes[1] = result.rval2;
+
+ return 0;
+}
+
+libc_hidden_def (__pipe)
+weak_alias (__pipe, pipe)
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/poll.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/poll.c
new file mode 100644
index 0000000000..6f25160d72
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/poll.c
@@ -0,0 +1,43 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sysdep-cancel.h>
+#include <sys/poll.h>
+
+int
+__poll (fds, nfds, timeout)
+ struct pollfd *fds;
+ nfds_t nfds;
+ int timeout;
+{
+ struct timespec *ts = NULL;
+ if (timeout >= 0)
+ {
+ ts = alloca (sizeof(struct timespec));
+ ts->tv_sec = timeout / 1000;
+ ts->tv_nsec = (timeout % 1000) * 1000000;
+ }
+
+ return ppoll (fds, nfds, ts, NULL);
+}
+
+libc_hidden_def (__poll)
+weak_alias (__poll, poll)
+strong_alias (__poll, __libc_poll)
+LIBC_CANCEL_HANDLED (); /* ppoll handles cancellation */
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/port.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/port.c
new file mode 100644
index 0000000000..cc3fe94b92
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/port.c
@@ -0,0 +1,127 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <inline-syscall.h>
+#include <port.h>
+#include <sys/port_impl.h>
+
+/* SYS_port returns a 64-bit int but the port_* calls return a 32-bit int, so
+ we can't implement these directly in syscalls.list. Whenever the 2nd
+ argument is not a port we need to specify PORT_SYS_NOPORT.
+
+ port_getn and port_sendn are special in that they may return after only
+ some of the ports have been acted on before the timeout occured. In this
+ case, the first 32-bits of the the return specify the number of acted on
+ ports, and the second 32-bits specify the error that occured (currently
+ this is always ETIME). */
+
+DECLARE_INLINE_SYSCALL (int64_t, port, int, ...);
+
+
+int port_create (void)
+{
+ /* The 2nd argument is the version of port_create, currently 0. */
+ rval_t ret;
+ ret.rval64 = INLINE_SYSCALL (port, 2,
+ SYS_SUB_port_create | PORT_SYS_NOPORT, 0);
+ return ret.rval1;
+}
+
+int port_associate (int port, int source, uintptr_t object,
+ int events, void *user)
+{
+ rval_t ret;
+ ret.rval64 = INLINE_SYSCALL (port, 6, SYS_SUB_port_associate, port, source,
+ object, events, user);
+ return ret.rval1;
+}
+
+int port_dissociate (int port, int source, uintptr_t object)
+{
+ rval_t ret;
+ ret.rval64 = INLINE_SYSCALL (port, 4, SYS_SUB_port_dissociate, port,
+ source, object);
+ return ret.rval1;
+}
+
+int port_send (int port, int events, void *user)
+{
+ rval_t ret;
+ ret.rval64 = INLINE_SYSCALL (port, 4, SYS_SUB_port_send, port, events, user);
+ return ret.rval1;
+}
+
+int port_sendn (int ports[], int errors[], unsigned int nent,
+ int events, void *user)
+{
+ /* Note that we cannot have more than PORT_MAX_LIST ports in a single
+ syscall so we may need to split ports across multiple syscalls. */
+
+ rval_t ret;
+ int nevents = 0;
+ for (unsigned int i = 0; i < nent; i += PORT_MAX_LIST)
+ {
+ int errval = __systemcall (&ret.rvals, SYS_port, SYS_SUB_port_sendn |
+ PORT_SYS_NOPORT, &ports[i], &errors[i], MIN (nent - i, PORT_MAX_LIST),
+ events, user);
+ if (errval == 0 || errval == ETIME)
+ nevents += ret.rval1;
+ if (errval != 0)
+ {
+ __set_errno (errval);
+ break;
+ }
+ }
+
+ return nevents;
+}
+
+int port_get (int port, port_event_t *pe, struct timespec *to)
+{
+ time_t sec = to ? to->tv_sec : 0;
+ long nsec = to ? to->tv_nsec : 0;
+ rval_t ret;
+ ret.rval64 = INLINE_SYSCALL (port, 6, SYS_SUB_port_get, port, pe, sec, nsec, to);
+ return ret.rval1;
+}
+
+int port_getn (int port, port_event_t list[], unsigned int max,
+ unsigned int *nget, struct timespec *timeout)
+{
+ rval_t ret;
+ int errval = __systemcall (&ret.rvals, SYS_port, SYS_SUB_port_getn, port, list,
+ max, *nget, timeout);
+ if (errval == 0 || errval == ETIME)
+ *nget = ret.rval1;
+
+ if (errval != 0)
+ {
+ __set_errno (errval);
+ return -1;
+ }
+ return 0;
+}
+
+int port_alert (int port, int flags, int events, void *user)
+{
+ rval_t ret;
+ ret.rval64 = INLINE_SYSCALL (port, 5, SYS_SUB_port_alert, port, flags,
+ events, user);
+ return ret.rval1;
+}
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/port.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/port.h
new file mode 100644
index 0000000000..37915d76a9
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/port.h
@@ -0,0 +1,35 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _PORT_H
+#define _PORT_H
+
+#include <sys/types.h>
+#include <sys/port.h>
+
+int port_create (void);
+int port_associate (int, int, uintptr_t, int, void *);
+int port_dissociate (int, int, uintptr_t);
+int port_send (int, int, void *);
+int port_sendn (int [], int [], uint_t, int, void *);
+int port_get (int, port_event_t *, struct timespec *);
+int port_getn (int, port_event_t [], uint_t, uint_t *, struct timespec *);
+int port_alert (int, int, int, void *);
+
+#endif /* _PORT_H */
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/posix_fallocate.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/posix_fallocate.c
new file mode 100644
index 0000000000..0db3aaafc5
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/posix_fallocate.c
@@ -0,0 +1,33 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <inline-syscall.h>
+#include <fcntl.h>
+
+int
+posix_fallocate (int fd, __off_t offset, __off_t len)
+{
+ struct flock fl;
+ fl.l_whence = 0;
+ fl.l_len = len;
+ fl.l_start = offset;
+ fl.l_type = F_WRLCK;
+
+ return fcntl (fd, F_ALLOCSP, &fl);
+}
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/posix_fallocate64.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/posix_fallocate64.c
new file mode 100644
index 0000000000..e717a9faaa
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/posix_fallocate64.c
@@ -0,0 +1,33 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <inline-syscall.h>
+#include <fcntl.h>
+
+int
+posix_fallocate64 (int fd, __off64_t offset, __off64_t len)
+{
+ struct flock64 fl;
+ fl.l_whence = 0;
+ fl.l_len = len;
+ fl.l_start = offset;
+ fl.l_type = F_WRLCK;
+
+ return fcntl (fd, F_ALLOCSP64, &fl);
+}
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/posix_madvise.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/posix_madvise.c
new file mode 100644
index 0000000000..afd6f715e7
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/posix_madvise.c
@@ -0,0 +1,27 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sys/types.h>
+#include <sys/mman.h>
+
+int
+posix_madvise (void *addr, size_t len, int advice)
+{
+ return memcntl (addr, len, MC_ADVISE, (caddr_t)advice, 0, 0);
+}
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/printers-lookup.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/printers-lookup.c
new file mode 100644
index 0000000000..2e9dfdb8fb
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/printers-lookup.c
@@ -0,0 +1,23 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#define DATABASE_NAME printers
+#define DEFAULT_CONFIG "user files nis nisplus"
+
+#include "XXX-lookup.c"
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/priocntl.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/priocntl.c
new file mode 100644
index 0000000000..5e7dc72870
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/priocntl.c
@@ -0,0 +1,79 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <inline-syscall.h>
+#include <sys/priocntl.h>
+#include <sys/procset.h>
+#include <stdarg.h>
+#include <errno.h>
+
+DECLARE_INLINE_SYSCALL (int, priocntlsys, int pc_version, procset_t *psp,
+ int cmd, ...);
+
+/* Docs: http://docs.sun.com/app/docs/doc/816-0212/6m6nd4ncg?a=view
+ http://docs.sun.com/app/docs/doc/816-0212/6m6nd4nch?a=view */
+
+static long __priocntl_common (procset_t *ps, int cmd, va_list ap)
+{
+ void *arg = va_arg (ap, void *);
+
+ if (cmd == PC_GETXPARMS || cmd == PC_SETXPARMS)
+ {
+ /* fetch up to PC_VAPARMCNT key/values */
+ pc_vaparms_t vp;
+ int i;
+ for (i = 0; ; i++)
+ {
+ if (i >= PC_VAPARMCNT)
+ return EINVAL;
+
+ /* fetch key/value */
+ int key = va_arg (ap, int);
+ if (key == PC_KY_NULL)
+ break;
+ vp.pc_parms[i].pc_key = key;
+ vp.pc_parms[i].pc_parm = (uintptr_t)va_arg (ap, void *);
+ }
+ vp.pc_vaparmscnt = i;
+
+ return INLINE_SYSCALL (priocntlsys, 5, PC_VERSION, ps, cmd, arg, &vp);
+ }
+ else
+ {
+ return INLINE_SYSCALL (priocntlsys, 4, PC_VERSION, ps, cmd, arg);
+ }
+}
+
+long priocntl (idtype_t idtype, id_t id, int cmd, ...)
+{
+ /* convert idtype/id to procset_t */
+ procset_t ps;
+ setprocset (&ps, POP_AND, idtype, id, P_ALL, 0);
+
+ va_list ap;
+ va_start (ap, cmd);
+ return __priocntl_common (&ps, cmd, ap);
+}
+
+long priocntlset (procset_t *ps, int cmd, ...)
+{
+ va_list ap;
+ va_start (ap, cmd);
+ return __priocntl_common (ps, cmd, ap);
+}
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/priorityP.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/priorityP.h
new file mode 100644
index 0000000000..5ed2b5dbb5
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/priorityP.h
@@ -0,0 +1,55 @@
+ /* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sys/time.h>
+#include <sys/resource.h>
+#include <sys/procset.h>
+#include <sys/priocntl.h>
+
+static inline
+idtype_t __prio_to_p (enum __priority_which which)
+{
+ /* convert from PRIO_* to P_* */
+ switch(which)
+ {
+ case PRIO_PROCESS:
+ return P_PID;
+ case PRIO_PGRP:
+ return P_PGID;
+ case PRIO_USER:
+ return P_UID;
+ case PRIO_GROUP:
+ return P_GID;
+ case PRIO_SESSION:
+ return P_SID;
+ case PRIO_LWP:
+ return P_LWPID;
+ case PRIO_TASK:
+ return P_TASKID;
+ case PRIO_PROJECT:
+ return P_PROJID;
+ case PRIO_ZONE:
+ return P_ZONEID;
+ case PRIO_CONTRACT:
+ return P_CTID;
+ default:
+ __set_errno(EINVAL);
+ return -1;
+ }
+}
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/priv.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/priv.c
new file mode 100644
index 0000000000..184cb7ef54
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/priv.c
@@ -0,0 +1,326 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <inline-syscall.h>
+#include <privP.h>
+#include <sys/priocntl.h>
+#include <string.h>
+#include <assert.h>
+#include <stdarg.h>
+
+DECLARE_INLINE_SYSCALL (int, privsys, int code, priv_op_t op,
+ priv_ptype_t type, void *buf, size_t bufsize);
+
+/* Docs: http://docs.sun.com/app/docs/doc/816-5168/6mbb3hrjc
+ http://docs.sun.com/app/docs/doc/816-5168/6mbb3hrj7
+ http://docs.sun.com/app/docs/doc/816-5167/setppriv-2
+ http://docs.sun.com/app/docs/doc/816-5175/privileges-5 */
+
+__libc_lock_define_initialized_recursive (, __priv_lock);
+libc_freeres_ptr (static priv_impl_info_t *__info);
+
+/* Note: Almost everything that uses getprivimplinfo assumes it won't fail so
+ we assert that this call succeeds. */
+const priv_impl_info_t * getprivimplinfo (void)
+{
+ if (__info)
+ return __info;
+
+ __libc_lock_lock_recursive (__priv_lock);
+
+ /* First call: get header. */
+ priv_impl_info_t _info;
+ int res = INLINE_SYSCALL (privsys, 5, SYS_SUB_getimplinfo, 0, 0, &_info,
+ sizeof(_info));
+ if (res == 0)
+ {
+ /* Second call: alloc and get full priv_impl_info_t. */
+ size_t info_size = PRIV_IMPL_INFO_SIZE (&_info);
+ __info = malloc (info_size);
+ assert (__info);
+ res = INLINE_SYSCALL (privsys, 5, SYS_SUB_getimplinfo, 0, 0, __info,
+ info_size);
+ assert (res == 0);
+ }
+
+ __libc_lock_unlock_recursive (__priv_lock);
+ return __info;
+}
+
+
+int getppriv (priv_ptype_t which, priv_set_t *set)
+{
+ int setn = priv_getsetbyname (which);
+ if (setn == -1)
+ return -1;
+
+ return INLINE_SYSCALL (privsys, 5, SYS_SUB_getppriv, 0, (priv_ptype_t)setn,
+ (void *)set, __PRIVSETSIZE);
+}
+
+
+int setppriv (priv_op_t op, priv_ptype_t which, const priv_set_t *set)
+{
+ int setn = priv_getsetbyname (which);
+ if (setn == -1)
+ return -1;
+
+ return INLINE_SYSCALL (privsys, 5, SYS_SUB_setppriv, op, (priv_ptype_t)setn,
+ (void *)set, __PRIVSETSIZE);
+}
+
+
+priv_set_t *priv_allocset (void)
+{
+ return malloc (__PRIVSETSIZE);
+}
+
+
+void priv_freeset (priv_set_t *sp)
+{
+ free (sp);
+}
+
+
+int priv_getbyname (const char *privname)
+{
+ const priv_data_t *pd = __priv_parse_data_cached ();
+ if (!pd)
+ return -1;
+
+ for (uint32_t i = 0; i < pd->pd_privnames_cnt; i++)
+ {
+ if (strcasecmp (pd->pd_privnames[i], privname) == 0)
+ return i;
+ }
+
+ __set_errno (EINVAL);
+ return -1;
+}
+
+
+const char *priv_getbynum (int privnum)
+{
+ const priv_data_t *pd = __priv_parse_data_cached ();
+ if (!pd)
+ return NULL;
+
+ if (privnum < 0 || privnum >= pd->pd_privnames_cnt)
+ {
+ __set_errno (EINVAL);
+ return NULL;
+ }
+
+ return pd->pd_privnames[privnum];
+}
+
+
+int priv_getsetbyname (const char *privsetname)
+{
+ const priv_data_t *pd = __priv_parse_data_cached ();
+ if (!pd)
+ return -1;
+
+ for (uint32_t i = 0; i < pd->pd_setnames_cnt; i++)
+ {
+ if (strcasecmp (pd->pd_setnames[i], privsetname) == 0)
+ return i;
+ }
+
+ __set_errno (EINVAL);
+ return -1;
+}
+
+
+const char *priv_getsetbynum (int privsetnum)
+{
+ const priv_data_t *pd = __priv_parse_data_cached ();
+ if (!pd)
+ return NULL;
+
+ if (privsetnum < 0 || privsetnum >= pd->pd_setnames_cnt)
+ {
+ __set_errno (EINVAL);
+ return NULL;
+ }
+
+ return pd->pd_setnames[privsetnum];
+}
+
+
+void priv_emptyset (priv_set_t *sp)
+{
+ memset (sp, 0, __PRIVSETSIZE);
+}
+
+
+void priv_fillset(priv_set_t *sp)
+{
+ memset (sp, ~0, __PRIVSETSIZE);
+}
+
+
+void priv_copyset (const priv_set_t *src, priv_set_t *dst)
+{
+ memcpy (dst, src, __PRIVSETSIZE);
+}
+
+
+int priv_addset (priv_set_t *sp, const char *priv)
+{
+ int privn = priv_getbyname (priv);
+ if (privn == -1)
+ return -1;
+
+ ((priv_chunk_t *)sp)[__PRIVELT (privn)] |= __PRIVMASK (privn);
+ return 0;
+}
+
+
+int priv_delset (priv_set_t *sp, const char *priv)
+{
+ int privn = priv_getbyname (priv);
+ if (privn == -1)
+ return -1;
+
+ ((priv_chunk_t *)sp)[__PRIVELT (privn)] &= ~__PRIVMASK (privn);
+ return 0;
+}
+
+
+void priv_intersect (const priv_set_t *src, priv_set_t *dst)
+{
+ priv_chunk_t *pcsrc = (priv_chunk_t *)src;
+ priv_chunk_t *pcdst = (priv_chunk_t *)dst;
+ for (int i = 0; i < __PRIVSETCHUNKS; i++)
+ pcdst[__PRIVELT (i)] &= pcsrc[__PRIVELT (i)];
+}
+
+
+void priv_union (const priv_set_t *src, priv_set_t *dst)
+{
+ priv_chunk_t *pcsrc = (priv_chunk_t *)src;
+ priv_chunk_t *pcdst = (priv_chunk_t *)dst;
+ for (int i = 0; i < __PRIVSETCHUNKS; i++)
+ pcdst[__PRIVELT (i)] |= pcsrc[__PRIVELT (i)];
+}
+
+
+void priv_inverse(priv_set_t *sp)
+{
+ priv_chunk_t *pcsp = (priv_chunk_t *)sp;
+ for (int i = 0; i < __PRIVSETCHUNKS; i++)
+ pcsp[i] = ~pcsp[i];
+}
+
+
+boolean_t priv_isemptyset (const priv_set_t *sp)
+{
+ priv_chunk_t *pcsp = (priv_chunk_t *)sp;
+ for (int i = 0; i < __PRIVSETCHUNKS; i++)
+ if (pcsp[i])
+ return _B_FALSE;
+ return _B_TRUE;
+}
+
+
+boolean_t priv_isfullset (const priv_set_t *sp)
+{
+ priv_chunk_t *pcsp = (priv_chunk_t *)sp;
+ for (int i = 0; i < __PRIVSETCHUNKS; i++)
+ if (~pcsp[i])
+ return _B_FALSE;
+ return _B_TRUE;
+}
+
+
+boolean_t priv_ismember (const priv_set_t *sp, const char *priv)
+{
+ int privn = priv_getbyname (priv);
+ if (privn == -1)
+ return _B_FALSE;
+
+ return (((priv_chunk_t *)sp)[__PRIVELT (privn)] & __PRIVMASK (privn)) ?
+ _B_TRUE : _B_FALSE;
+}
+
+
+boolean_t priv_issubset (const priv_set_t *src, const priv_set_t *dst)
+{
+ priv_chunk_t *pcsrc = (priv_chunk_t *)src;
+ priv_chunk_t *pcdst = (priv_chunk_t *)dst;
+ for (int i = 0; i < __PRIVSETCHUNKS; i++)
+ if ((pcsrc[__PRIVELT (i)] & pcdst[__PRIVELT (i)]) != pcsrc[__PRIVELT (i)])
+ return _B_FALSE;
+ return _B_TRUE;
+}
+
+
+int priv_set (priv_op_t op, priv_ptype_t which, ...)
+{
+ va_list ap;
+ va_start (ap, which);
+
+ priv_set_t *pset = priv_allocset ();
+ if (!pset)
+ return -1;
+
+ const char *priv;
+ while ((priv = va_arg (ap, const char *)))
+ {
+ if (priv_addset (pset, priv) == -1)
+ return -1;
+ }
+
+ int ret;
+ if (which == NULL)
+ {
+ /* Set all sets. */
+ for (int i = 0; i < __PRIVSETCHUNKS; i++)
+ {
+ ret = setppriv (op, which, pset);
+ if (ret == -1)
+ break;
+ }
+ }
+ else
+ {
+ ret = setppriv (op, which, pset);
+ }
+
+ priv_freeset (pset);
+ return 0;
+}
+
+boolean_t priv_ineffect (const char *priv)
+{
+ priv_set_t *pset = priv_allocset ();
+ if (!pset)
+ return _B_FALSE;
+
+ int res = getppriv (PRIV_EFFECTIVE, pset);
+ if (res == -1)
+ return _B_FALSE;
+
+ boolean_t ret = priv_ismember (pset, priv);
+
+ priv_freeset (pset);
+
+ return ret;
+}
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/priv.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/priv.h
new file mode 100644
index 0000000000..62329916b4
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/priv.h
@@ -0,0 +1,75 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _PRIV_H
+#define _PRIV_H
+
+#include <sys/priv.h>
+#include <features.h>
+
+#define PRIV_STR_PORT 0x00
+#define PRIV_STR_LIT 0x01
+#define PRIV_STR_SHORT 0x02
+
+#define PRIV_ALLSETS (priv_ptype_t)0
+
+__BEGIN_DECLS
+
+extern int setppriv (priv_op_t, priv_ptype_t, const priv_set_t *);
+extern int getppriv (priv_ptype_t, priv_set_t *);
+extern int setpflags (unsigned int, unsigned int);
+extern unsigned int getpflags (unsigned int);
+extern const priv_impl_info_t *getprivimplinfo (void);
+
+extern int priv_set (priv_op_t, priv_ptype_t, ...);
+extern boolean_t priv_ineffect(const char *);
+
+extern priv_set_t *priv_str_to_set (const char *, const char *, const char **);
+extern char *priv_set_to_str (const priv_set_t *, char, int);
+
+extern int priv_getbyname (const char *);
+extern const char *priv_getbynum (int);
+extern int priv_getsetbyname (const char *);
+extern const char *priv_getsetbynum (int);
+
+extern char *priv_gettext (const char *);
+
+extern priv_set_t *priv_allocset (void);
+extern void priv_freeset (priv_set_t *);
+
+extern void priv_emptyset (priv_set_t *);
+extern void priv_fillset (priv_set_t *);
+
+extern boolean_t priv_isemptyset (const priv_set_t *);
+extern boolean_t priv_isfullset (const priv_set_t *);
+extern boolean_t priv_isequalset (const priv_set_t *, const priv_set_t *);
+extern boolean_t priv_issubset (const priv_set_t *, const priv_set_t *);
+extern boolean_t priv_ismember (const priv_set_t *, const char *);
+
+extern void priv_intersect (const priv_set_t *, priv_set_t *);
+extern void priv_union (const priv_set_t *, priv_set_t *);
+extern void priv_inverse (priv_set_t *);
+
+extern int priv_addset (priv_set_t *, const char *);
+extern void priv_copyset (const priv_set_t *, priv_set_t *);
+extern int priv_delset (priv_set_t *, const char *);
+
+__END_DECLS
+
+#endif /* _PRIV_H */
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/privP.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/privP.c
new file mode 100644
index 0000000000..0c2f296d26
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/privP.c
@@ -0,0 +1,285 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <privP.h>
+#include <stdarg.h>
+#include <grp.h>
+#include <unistd.h>
+#include <bits/libc-lock.h>
+
+__libc_lock_define_recursive (extern, __priv_lock);
+libc_freeres_ptr (static priv_data_t *__data);
+static priv_set_t *__suidset = NULL;
+
+priv_data_t * __priv_parse_info (const priv_impl_info_t *pii)
+{
+ priv_data_t *data = malloc (sizeof (priv_data_t));
+ if (!data)
+ return NULL;
+ memset (data, 0, sizeof (*data));
+ data->pd_setsize = pii->priv_setsize * sizeof (priv_chunk_t);
+
+ /* Iterate over all priv_info_t's. Note that the first priv_info_t follows
+ the header. */
+ priv_info_t *pi = (priv_info_t *)((char *)pii + pii->priv_headersize);
+ uint32_t left = pii->priv_globalinfosize;
+ while (left)
+ {
+ switch (pi->priv_info_type)
+ {
+ case PRIV_INFO_SETNAMES:
+ case PRIV_INFO_PRIVNAMES:
+ if ((pi->priv_info_type == PRIV_INFO_SETNAMES &&
+ data->pd_setnames) || (pi->priv_info_type ==
+ PRIV_INFO_PRIVNAMES && data->pd_privnames))
+ break;
+
+ /* XXX: In priv_get*byname we linearlly scan the list of strins;
+ we could speed this up by sorting the strings here. */
+
+ priv_info_names_t *pi_names = (priv_info_names_t *)pi;
+
+ /* Allocate memory for the index. */
+ char **name_list = malloc (sizeof (char *) * pi_names->cnt);
+ if (!name_list)
+ goto err;
+ if (pi->priv_info_type == PRIV_INFO_SETNAMES)
+ {
+ data->pd_setnames = name_list;
+ data->pd_setnames_cnt = pi_names->cnt;
+ }
+ else
+ {
+ data->pd_privnames = name_list;
+ data->pd_privnames_cnt = pi_names->cnt;
+ }
+ data->pd_privnames_cnt = pi_names->cnt;
+
+ /* Setup the index. */
+ char *names_ptr = pi_names->names;
+ for (int i = 0; i < pi_names->cnt; i++)
+ {
+ name_list[i] = names_ptr;
+ names_ptr += strlen (names_ptr) + 1;
+ }
+
+ break;
+
+ case PRIV_INFO_BASICPRIVS:
+ if (data->pd_basicprivs)
+ break;
+
+ if (pi->priv_info_size != data->pd_setsize)
+ break;
+ data->pd_basicprivs = (priv_set_t *)((priv_info_set_t *)pi)->set;
+
+ break;
+ }
+
+ left -= pi->priv_info_size;
+ pi = (priv_info_t *)((char *)pi + pi->priv_info_size);
+ }
+
+ return data;
+
+err:
+
+ free (data->pd_setnames);
+ free (data->pd_privnames);
+ free (data);
+
+ return NULL;
+}
+
+
+void __priv_free_info (priv_data_t *data)
+{
+ free (data->pd_setnames);
+ free (data->pd_privnames);
+ free (data);
+}
+
+
+const priv_data_t * __priv_parse_data_cached (void)
+{
+ if (__data)
+ return __data;
+
+ __libc_lock_lock_recursive (__priv_lock);
+ __data = __priv_parse_info (getprivimplinfo ());
+ __libc_lock_unlock_recursive (__priv_lock);
+
+ return __data;
+}
+
+
+/* Specify what privileges an suid root binary needs. */
+int __init_suid_priv (int flags, ...)
+{
+ int res = 0;
+ priv_set_t *permit = NULL, *inherit = NULL, *scratch = NULL;
+
+ /* Check flags. */
+ if (flags != PU_LIMITPRIVS && flags != PU_CLEARLIMITSET)
+ return -1;
+
+ /* We can only initialize once. */
+ if (__suidset)
+ return -1;
+
+ /* Do nothing if we are running as root but not setuid root. */
+ uid_t uid = getuid ();
+ uid_t euid = geteuid ();
+ if (uid == 0 && euid == 0)
+ return 0;
+
+ /* Allocate a scratch set. */
+ scratch = priv_allocset ();
+ if (!scratch)
+ goto error;
+
+ /* Get the basic set. */
+ const priv_data_t *pd = __priv_parse_data_cached ();
+ if (!pd)
+ goto error;
+ priv_set_t *basic = pd->pd_basicprivs;
+
+ /* Get the inherited set. */
+ inherit = priv_allocset ();
+ if (!inherit)
+ goto error;
+ if (getppriv (PRIV_INHERITABLE, inherit) != 0)
+ goto error;
+
+ /* Get the permitted set. */
+ permit = priv_allocset ();
+ if (!permit)
+ goto error;
+ if (getppriv (PRIV_PERMITTED, permit) != 0)
+ goto error;
+
+ /* Get passed privileges. */
+ __suidset = priv_allocset ();
+ if (!__suidset)
+ goto error;
+ priv_emptyset (__suidset);
+ va_list ap;
+ va_start (ap, flags);
+ const char *priv;
+ while ((priv = va_arg (ap, const char *)))
+ if (priv_addset (__suidset, priv) != 0)
+ goto error;
+
+ /* Make sure that the passed privileges are a subset of the current
+ permitted privileges. */
+ if (priv_issubset (__suidset, permit) != _B_TRUE)
+ goto error;
+
+ /* Set the effective privileges to the inherited ones. */
+ if (setppriv (PRIV_SET, PRIV_EFFECTIVE, inherit) != 0)
+ goto error;
+
+ /* Set the permitted privileges to those currently permitted privileges in
+ set of the ones passed in, the inherited ones, and the basic set. */
+ priv_copyset (__suidset, scratch);
+ priv_union (inherit, scratch);
+ if (basic)
+ priv_union (basic, scratch);
+ priv_intersect (permit, scratch);
+ if (setppriv (PRIV_SET, PRIV_PERMITTED, scratch) != 0)
+ goto error;
+
+ /* Check if we need to set the limit set. */
+ if (flags & PU_CLEARLIMITSET)
+ {
+ priv_emptyset (scratch);
+ if (setppriv (PRIV_SET, PRIV_LIMIT, scratch) != 0)
+ goto error;
+ }
+ else if (flags & PU_LIMITPRIVS)
+ {
+ if (setppriv (PRIV_SET, PRIV_LIMIT, scratch) != 0)
+ goto error;
+ }
+
+ /* Change the uid to the caller's uid if we're setuid root. */
+ if (euid == 0 && setreuid (uid, uid) != 0)
+ goto error;
+
+ goto out;
+
+error:
+ res = -1;
+ if (__suidset)
+ {
+ priv_freeset (__suidset);
+ __suidset = NULL;
+ }
+ if (euid == 0)
+ setreuid (uid, uid);
+
+out:
+ priv_freeset (permit);
+ priv_freeset (inherit);
+ priv_freeset (scratch);
+
+ return res;
+}
+
+
+// TODO
+#if 0
+int __init_daemon_priv (int flags, uid_t uid, gid_t gid, ...)
+{
+}
+
+
+void __fini_daemon_priv (const char *priv, ...)
+{
+}
+#endif
+
+
+/* Enable or disable those privileges passed in __init_suid_priv. */
+int __priv_bracket (priv_op_t op)
+{
+ if (op != PRIV_ON && op != PRIV_OFF)
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ /* We can only toggle privileges if __init_suid_priv was called. */
+ if (__suidset)
+ return setppriv (op, PRIV_EFFECTIVE, __suidset);
+ else
+ return 0;
+}
+
+
+/* Permanently disable those privileges passed in __init_suid_priv. */
+void __priv_relinquish (void)
+{
+ if (__suidset)
+ {
+ setppriv (PRIV_OFF, PRIV_PERMITTED, __suidset);
+ priv_freeset (__suidset);
+ __suidset = NULL;
+ }
+}
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/privP.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/privP.h
new file mode 100644
index 0000000000..38045247b9
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/privP.h
@@ -0,0 +1,48 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _PRIVP_H
+#define _PRIVP_H
+
+#include <priv.h>
+
+typedef struct priv_data
+ {
+ size_t pd_setsize;
+ uint32_t pd_setnames_cnt;
+ char **pd_setnames;
+ uint32_t pd_privnames_cnt;
+ char **pd_privnames;
+ priv_set_t *pd_basicprivs;
+ } priv_data_t;
+
+extern const priv_data_t * __priv_parse_data_cached (void);
+
+#define __NPRIVBITS (8 * sizeof (priv_chunk_t))
+#define __PRIVELT(pr) ((pr) / __NPRIVBITS)
+#define __PRIVMASK(pr) ((priv_chunk_t) 1 << ((pr) % __NPRIVBITS))
+#define __PRIVSETCHUNKS (getprivimplinfo()->priv_setsize)
+#define __PRIVSETSIZE (__PRIVSETCHUNKS * sizeof (priv_chunk_t))
+
+#define PU_RESETGROUPS 0x01
+#define PU_LIMITPRIVS 0x02
+#define PU_INHERITPRIVS 0x04
+#define PU_CLEARLIMITSET 0x08
+
+#endif /* _PRIVP_H */
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/priv_str.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/priv_str.c
new file mode 100644
index 0000000000..f4db0c2b2b
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/priv_str.c
@@ -0,0 +1,104 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <privP.h>
+#include <priv.h>
+#include <zone.h>
+#include <string.h>
+#include <stdlib.h>
+#include <errno.h>
+
+/* Docs: http://docs.sun.com/app/docs/doc/816-5168/priv-str-to-set-3c */
+
+priv_set_t *priv_str_to_set (const char *buf, const char *sep,
+ const char **endptr)
+{
+ /* Take a copy of the string since strtok_r will modify it. */
+ char *str = strdup (buf);
+ if (!str)
+ return NULL;
+
+ priv_set_t *set = priv_allocset ();
+ if (!set)
+ {
+ free (str);
+ return NULL;
+ }
+ priv_emptyset (set);
+ const priv_data_t *data = __priv_parse_data_cached ();
+ if (!data)
+ return NULL;
+ priv_set_t *basic = data->pd_basicprivs;
+
+ char *saveptr;
+ char *priv = strtok_r (str, sep, &saveptr);
+ if (!priv)
+ return set;
+ do
+ {
+ if (strcmp (priv, "basic") == 0 && basic)
+ priv_union (basic, set);
+ else if (strcmp (priv, "all") == 0)
+ priv_fillset (set);
+ else if (strcmp (priv, "none") == 0)
+ priv_emptyset (set);
+ else if (strcmp (priv, "zone") == 0)
+ {
+ priv_set_t *zone = priv_allocset ();
+ if (!zone)
+ goto inval;
+ if (zone_getattr (getzoneid (), ZONE_ATTR_PRIVSET,
+ zone, __PRIVSETSIZE) == 0)
+ priv_union (zone, set);
+ priv_freeset (zone);
+ }
+ else
+ {
+ int negate = *str == '-' || *str == '!';
+ if (negate)
+ str++;
+
+ int res;
+ if (negate)
+ res = priv_delset (set, str);
+ else
+ res = priv_addset (set, str);
+ if (res == -1)
+ goto inval;
+ }
+ }
+ while ((priv = strtok_r (NULL, sep, &saveptr))) ;
+
+ free (str);
+ return set;
+
+inval:
+
+ priv_freeset (set);
+ free (str);
+ __set_errno (EINVAL);
+ return NULL;
+}
+
+
+char * priv_set_to_str (const priv_set_t *pset, char separator, int flag)
+{
+ // TODO
+ return NULL;
+}
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/proc_service.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/proc_service.h
new file mode 100644
index 0000000000..38d92adc66
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/proc_service.h
@@ -0,0 +1,106 @@
+/* Callback interface for libthread_db, functions users must define.
+ Copyright (C) 1999,2002,2003 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _PROC_SERVICE_H
+#define _PROC_SERVICE_H
+
+/* The definitions in this file must correspond to those in the debugger. */
+#include <sys/procfs_isa.h>
+#include <elf.h>
+#include <features.h>
+
+#ifdef _LP64
+typedef Elf64_Sym ps_sym_t;
+#else
+typedef Elf32_Sym ps_sym_t;
+#endif
+
+/* Functions in this interface return one of these status codes. */
+typedef enum
+{
+ PS_OK, /* Generic "call succeeded". */
+ PS_ERR, /* Generic error. */
+ PS_BADPID, /* Bad process handle. */
+ PS_BADLID, /* Bad LWP identifier. */
+ PS_BADADDR, /* Bad address. */
+ PS_NOSYM, /* Could not find given symbol. */
+ PS_NOFREGS /* FPU register set not available for given LWP. */
+} ps_err_e;
+
+#define PS_OBJ_EXEC ((const char *)0x0)
+#define PS_OBJ_LDSO ((const char *)0x1)
+
+/* This type is opaque in this interface.
+ It's defined by the user of libthread_db. */
+struct ps_prochandle;
+
+__BEGIN_DECLS
+
+/* Read or write process memory at the given address. */
+extern ps_err_e ps_pread(struct ps_prochandle *,
+ psaddr_t, void *, size_t);
+extern ps_err_e ps_pwrite(struct ps_prochandle *,
+ psaddr_t, const void *, size_t);
+extern ps_err_e ps_pdread (struct ps_prochandle *,
+ psaddr_t, void *, size_t);
+extern ps_err_e ps_pdwrite (struct ps_prochandle *,
+ psaddr_t, const void *, size_t);
+extern ps_err_e ps_ptread (struct ps_prochandle *,
+ psaddr_t, void *, size_t);
+extern ps_err_e ps_ptwrite (struct ps_prochandle *,
+ psaddr_t, const void *, size_t);
+
+
+/* Get and set the given LWP's general or FPU register set. */
+extern ps_err_e ps_lgetregs (struct ps_prochandle *,
+ lwpid_t, prgregset_t);
+extern ps_err_e ps_lsetregs (struct ps_prochandle *,
+ lwpid_t, const prgregset_t);
+extern ps_err_e ps_lgetfpregs (struct ps_prochandle *,
+ lwpid_t, prfpregset_t *);
+extern ps_err_e ps_lsetfpregs (struct ps_prochandle *,
+ lwpid_t, const prfpregset_t *);
+
+/* Fetch the special per-thread address associated with the given LWP.
+ This call is only used on a few platforms (most use a normal register).
+ The meaning of the `int' parameter is machine-dependent. */
+extern ps_err_e ps_get_thread_area (const struct ps_prochandle *,
+ lwpid_t, int, psaddr_t *);
+
+
+/* Look up the named symbol in the named DSO in the symbol tables
+ associated with the process being debugged, filling in *SYM_ADDR
+ with the corresponding run-time address. */
+extern ps_err_e ps_pglobal_lookup (struct ps_prochandle *,
+ const char *object_name,
+ const char *sym_name,
+ psaddr_t *sym_addr);
+
+
+/* Stop or continue the entire process. */
+extern ps_err_e ps_pstop (struct ps_prochandle *);
+extern ps_err_e ps_pcontinue (struct ps_prochandle *);
+
+/* Stop or continue the given LWP alone. */
+extern ps_err_e ps_lstop (struct ps_prochandle *, lwpid_t);
+extern ps_err_e ps_lcontinue (struct ps_prochandle *, lwpid_t);
+
+__END_DECLS
+
+#endif /* _PROC_SERVICE_H */
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/procfs.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/procfs.h
new file mode 100644
index 0000000000..6b06e5b7a0
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/procfs.h
@@ -0,0 +1,30 @@
+/* Include file for getting new procfs API
+ Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _PROCFS_H
+#define _PROCFS_H
+
+#ifdef _STRUCTURED_PROC
+# undef _STRUCTURED_PROC
+#endif
+#define _STRUCTURED_PROC 1
+
+#include <sys/procfs.h>
+
+#endif /* _PROCFS_H */
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/prof_attr-lookup.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/prof_attr-lookup.c
new file mode 100644
index 0000000000..b88e630134
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/prof_attr-lookup.c
@@ -0,0 +1,23 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#define DATABASE_NAME prof_attr
+#define DEFAULT_CONFIG "files nis"
+
+#include "XXX-lookup.c"
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/prof_attrP.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/prof_attrP.h
new file mode 100644
index 0000000000..cb6f6852f5
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/prof_attrP.h
@@ -0,0 +1,43 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _PROF_ATTRP_H
+#define _PROF_ATTRP_H
+
+#include <sys/types.h>
+#include <nss/nss.h>
+
+#define NSS_BUFLEN_PROFATTR 1024
+
+typedef struct profstr_s
+ {
+ char *name;
+ char *res1;
+ char *res2;
+ char *desc;
+ char *attr;
+} profstr_t;
+
+struct parser_data;
+extern int _nss_files_parse_profattr (char *line, struct profstr_s *result,
+ struct parser_data *data,
+ size_t datalen, int *errnop);
+libnss_files_hidden_proto (_nss_files_parse_profattr)
+
+#endif /* _PROF_ATTRP_H */
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/profil.S b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/profil.S
new file mode 100644
index 0000000000..8e595943e4
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/profil.S
@@ -0,0 +1,7 @@
+#include <sysdep.h>
+PSEUDO (__profil, profil, 2)
+ ret
+PSEUDO_END(__profil)
+libc_hidden_def (__profil)
+weak_alias (__profil, profil)
+libc_hidden_weak (profil)
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/project-lookup.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/project-lookup.c
new file mode 100644
index 0000000000..0828c58a61
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/project-lookup.c
@@ -0,0 +1,23 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#define DATABASE_NAME project
+#define DEFAULT_CONFIG "files nis"
+
+#include "XXX-lookup.c"
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/projectP.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/projectP.h
new file mode 100644
index 0000000000..722a7716c8
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/projectP.h
@@ -0,0 +1,44 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _PROJECTP_H
+#define _PROJECTP_H
+
+#include <sys/types.h>
+#include <nss/nss.h>
+
+#define NSS_BUFLEN_PROJECT ((4 * 1024) + (800 * sizeof (char *)))
+
+struct project
+ {
+ char *pj_name;
+ projid_t pj_projid;
+ char *pj_comment;
+ char **pj_users;
+ char **pj_groups;
+ char *pj_attr;
+ };
+
+struct parser_data;
+extern int _nss_files_parse_proj (char *line, struct project *result,
+ struct parser_data *data,
+ size_t datalen, int *errnop);
+libnss_files_hidden_proto (_nss_files_parse_proj)
+
+#endif /* _PROJECTP_H */
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/pselect.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/pselect.c
new file mode 100644
index 0000000000..8ed82c446e
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/pselect.c
@@ -0,0 +1,140 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sysdep-cancel.h>
+#include <sys/select.h>
+#include <sys/poll.h>
+#include <errno.h>
+#include <memory.h>
+#include <assert.h>
+
+int
+__pselect (int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds,
+ const struct timespec *timeout, const sigset_t *sigmask)
+{
+ if (nfds < 0 || nfds > FD_SETSIZE)
+ {
+ __set_errno(EINVAL);
+ return -1;
+ }
+
+ /* Fill pollfd structure. */
+ int pfd_len = nfds * sizeof(struct pollfd);
+ int use_alloca = __libc_use_alloca (pfd_len);
+ struct pollfd *pfd;
+ if (use_alloca)
+ pfd = alloca (pfd_len);
+ else
+ {
+ pfd = malloc (pfd_len);
+ if (!pfd)
+ return -1;
+ }
+
+ int fd;
+ nfds_t i = 0;
+ for (fd = 0; fd < nfds; fd++)
+ {
+ if ((readfds && FD_ISSET (fd, readfds)) ||
+ (writefds && FD_ISSET (fd, writefds)) ||
+ (exceptfds && FD_ISSET (fd, exceptfds)))
+ {
+ pfd[i].fd = fd;
+ pfd[i].events = 0;
+ pfd[i].revents = 0;
+ if (readfds && FD_ISSET (fd, readfds))
+ pfd[i].events |= POLLRDNORM;
+ if (writefds && FD_ISSET (fd, writefds))
+ pfd[i].events |= POLLWRNORM;
+ if (exceptfds && FD_ISSET (fd, exceptfds))
+ pfd[i].events |= POLLRDBAND;
+ i++;
+ }
+ }
+ nfds_t num_pfd = i;
+
+ /* ppoll is cancelable so don't implement cancellation here. */
+ int result = ppoll (pfd, num_pfd, timeout, sigmask);
+ if (result == -1)
+ {
+ if (!use_alloca)
+ free (pfd);
+ return -1;
+ }
+
+ /* Check for POLLNVAL. */
+ for (i = 0; i < num_pfd; i++)
+ {
+ if (pfd[i].revents & POLLNVAL)
+ {
+ if (!use_alloca)
+ free (pfd);
+ __set_errno (EBADFD);
+ return -1;
+ }
+ }
+
+ /* clear fd_set's */
+ for (fd = 0; fd < nfds; fd++)
+ {
+ if (readfds)
+ FD_CLR (fd, readfds);
+ if (writefds)
+ FD_CLR (fd, writefds);
+ if (exceptfds)
+ FD_CLR (fd, exceptfds);
+ }
+
+ /* Fill fd_set's. */
+ int bits = 0;
+ for (i = 0; i < num_pfd; i++)
+ {
+ fd = pfd[i].fd;
+ int events = pfd[i].events;
+ int revents = pfd[i].revents;
+ assert (fd < nfds);
+
+ if (readfds && ((revents & POLLRDNORM) || ((events & POLLRDNORM)
+ && (revents & (POLLHUP | POLLERR)))))
+ {
+ __FD_SET (fd, readfds);
+ bits++;
+ }
+ if (writefds && ((revents & POLLWRNORM) || ((events & POLLWRNORM)
+ && (revents & (POLLHUP | POLLERR)))))
+ {
+ __FD_SET (fd, writefds);
+ bits++;
+ }
+ if (exceptfds && ((revents & POLLRDBAND) || ((events & POLLRDBAND)
+ && (revents & (POLLHUP | POLLERR)))))
+ {
+ __FD_SET (fd, exceptfds);
+ bits++;
+ }
+ }
+
+ if (!use_alloca)
+ free (pfd);
+ return bits;
+}
+
+weak_alias (__pselect, pselect)
+strong_alias (__pselect, __libc_pselect)
+LIBC_CANCEL_HANDLED (); /* handled by ppoll */
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/pset_getloadavg.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/pset_getloadavg.c
new file mode 100644
index 0000000000..73f3d18776
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/pset_getloadavg.c
@@ -0,0 +1,42 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <inline-syscall.h>
+#include <sys/pset.h>
+#include <sys/loadavg.h>
+
+DECLARE_INLINE_SYSCALL (int, pset_getloadavg, int *buf, int nelem);
+
+int
+pset_getloadavg (psetid_t pset, double loadavg[], int nelem)
+{
+ int buf[LOADAVG_NSTATS], i;
+
+ if (nelem > LOADAVG_NSTATS)
+ nelem = LOADAVG_NSTATS;
+ int result = INLINE_SYSCALL (pset_getloadavg, 2, buf, nelem);
+ if (result == -1)
+ return -1;
+
+ /* the results from the kernel are scaled by a factor of 256 */
+ for(i = 0; i < nelem; i++)
+ loadavg[i] = (double)buf[i] / 256;
+
+ return nelem;
+}
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/ptsname.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/ptsname.c
new file mode 100644
index 0000000000..7ec30529ad
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/ptsname.c
@@ -0,0 +1,100 @@
+/* Copyright (C) 1998, 2000, 2001, 2002, 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Zack Weinberg <zack@rabi.phys.columbia.edu>, 1998.
+ OpenSolaris bits contributed by David Bartley
+ <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sys/stat.h>
+#include <sys/ioctl.h>
+#include <unistd.h>
+#include <string.h>
+#include <stdio-common/_itoa.h>
+#include <errno.h>
+#include <sys/ptms.h>
+#include <streams/stropts.h>
+#include <sys/sysmacros.h>
+
+/* Directory where we can find the slave pty nodes. */
+#define _PATH_DEVPTS "/dev/pts/"
+
+/* Static buffer for `ptsname'. */
+static char buffer[sizeof (_PATH_DEVPTS) + 20];
+
+/* Return the pathname of the pseudo terminal slave assoicated with
+ the master FD is open on, or NULL on errors.
+ The returned storage is good until the next call to this function. */
+char *
+ptsname (int fd)
+{
+ return __ptsname_r (fd, buffer, sizeof (buffer)) != 0 ? NULL : buffer;
+}
+
+
+/* Store at most BUFLEN characters of the pathname of the slave pseudo
+ terminal associated with the master FD is open on in BUF.
+ Return 0 on success, otherwise an error number. */
+int
+__ptsname_r (int fd, char *buf, size_t buflen)
+{
+ if (buf == NULL)
+ {
+ __set_errno (EINVAL);
+ return EINVAL;
+ }
+
+ /* isatty doesn't work on ptm's. */
+ struct strioctl si;
+ si.ic_cmd = ISPTM;
+ si.ic_len = 0;
+ si.ic_timout = 0;
+ si.ic_dp = NULL;
+ if (ioctl(fd, I_STR, &si) != 0)
+ {
+ __set_errno (ENOTTY);
+ return ENOTTY;
+ }
+
+ /* Get the minor number of the pts. */
+ struct stat st;
+ if (fstat (fd, &st) < 0)
+ return -1;
+ int ptyno = minor (st.st_rdev);
+
+ /* Buffer we use to print the number in. For a maximum size for
+ `int' of 8 bytes we never need more than 20 digits. */
+ char numbuf[21];
+ const char *devpts = _PATH_DEVPTS;
+ const size_t devptslen = strlen (_PATH_DEVPTS);
+ char *p;
+
+ numbuf[sizeof (numbuf) - 1] = '\0';
+ p = _itoa_word (ptyno, &numbuf[sizeof (numbuf) - 1], 10, 0);
+
+ if (buflen < devptslen + (&numbuf[sizeof (numbuf)] - p))
+ {
+ __set_errno (ERANGE);
+ return ERANGE;
+ }
+
+ memcpy (__stpcpy (buf, devpts), p, &numbuf[sizeof (numbuf)] - p);
+
+ access (buf, F_OK);
+
+ return 0;
+}
+weak_alias (__ptsname_r, ptsname_r)
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/putmsg.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/putmsg.c
new file mode 100644
index 0000000000..56881f5c61
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/putmsg.c
@@ -0,0 +1,35 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <inline-syscall.h>
+#include <stropts.h>
+
+DECLARE_INLINE_SYSCALL (int, putmsg, int fildes, const struct strbuf *ctlptr,
+ const struct strbuf *dataptr, int flags);
+
+int
+putmsg (fildes, ctlptr, dataptr, flags)
+ int fildes;
+ const struct strbuf *ctlptr;
+ const struct strbuf *dataptr;
+ int flags;
+{
+ return INLINE_SYSCALL (putmsg, 4, fildes, ctlptr, dataptr, flags | MSG_XPG4);
+}
+
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/putpmsg.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/putpmsg.c
new file mode 100644
index 0000000000..c6db5a82a3
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/putpmsg.c
@@ -0,0 +1,37 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <inline-syscall.h>
+#include <stropts.h>
+
+DECLARE_INLINE_SYSCALL (int, putpmsg, int fildes, const struct strbuf *ctlptr,
+ const struct strbuf *dataptr, int band, int flags);
+
+int
+putpmsg (fildes, ctlptr, dataptr, band, flags)
+ int fildes;
+ const struct strbuf *ctlptr;
+ const struct strbuf *dataptr;
+ int band;
+ int flags;
+{
+ return INLINE_SYSCALL (putpmsg, 4, fildes, ctlptr, dataptr, band,
+ flags | MSG_XPG4);
+}
+
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/rctl.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/rctl.c
new file mode 100644
index 0000000000..3b81a0a901
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/rctl.c
@@ -0,0 +1,198 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <inline-syscall.h>
+#include <rctl.h>
+#include <sys/rctl_impl.h>
+
+/* Docs: http://docs.sun.com/app/docs/doc/816-5167/getrctl-2?a=view
+ http://docs.sun.com/app/docs/doc/816-5168/rctlblk-size-3c?a=view */
+
+DECLARE_INLINE_SYSCALL (long, rctlsys, int code, const char *name, void *obuf,
+ void *nbuf, size_t obufsz, int flags);
+
+
+int getrctl (const char *name, rctlblk_t *old_rblk, rctlblk_t *new_rblk,
+ unsigned int flags)
+{
+ return (int)INLINE_SYSCALL (rctlsys, 6, SYS_SUB_rctlsys_get, name, old_rblk,
+ new_rblk, 0, flags);
+}
+
+
+int setrctl (const char *name, rctlblk_t *old_rblk, rctlblk_t *new_rblk,
+ unsigned int flags)
+{
+ return (int)INLINE_SYSCALL (rctlsys, 6, SYS_SUB_rctlsys_set, name, old_rblk,
+ new_rblk, 0, flags);
+}
+
+
+size_t rctllist (char *buf, size_t bufsz)
+{
+ return (size_t)INLINE_SYSCALL (rctlsys, 6, SYS_SUB_rctlsys_list, NULL, buf,
+ NULL, bufsz, 0);
+}
+
+
+int rctlctl (const char *name, rctlblk_t *blk, int flags)
+{
+ return (int)INLINE_SYSCALL (rctlsys, 6, SYS_SUB_rctlsys_ctl, name, blk,
+ NULL, 0, flags);
+}
+
+
+int setprojrctl (const char *name, rctlblk_t *blk, size_t size, int flags)
+{
+ return (int)INLINE_SYSCALL (rctlsys, 6, SYS_SUB_rctlsys_projset, name,
+ NULL, blk, size, flags);
+}
+
+
+hrtime_t rctlblk_get_firing_time (rctlblk_t *rblk)
+{
+ return ((rctl_opaque_t *)rblk)->rcq_firing_time;
+}
+
+
+unsigned int rctlblk_get_global_action (rctlblk_t *rblk)
+{
+ /* Note: rcq_global_flagaction contains both flags and action. */
+ return ((rctl_opaque_t *)rblk)->rcq_global_flagaction &
+ ~RCTL_GLOBAL_ACTION_MASK;
+}
+
+
+unsigned int rctlblk_get_global_flags (rctlblk_t *rblk)
+{
+ /* Note: rcq_global_flagaction contains both flags and action. */
+ return ((rctl_opaque_t *)rblk)->rcq_global_flagaction &
+ RCTL_GLOBAL_ACTION_MASK;
+}
+
+
+unsigned int rctlblk_get_local_action (rctlblk_t *rblk, int *signalp)
+{
+ /* Note: rcq_local_flagaction contains both flags and action. */
+ return ((rctl_opaque_t *)rblk)->rcq_local_flagaction &
+ ~RCTL_LOCAL_ACTION_MASK;
+}
+
+
+unsigned int rctlblk_get_local_flags (rctlblk_t *rblk)
+{
+ /* Note: rcq_local_flagaction contains both flags and action. */
+ return ((rctl_opaque_t *)rblk)->rcq_local_flagaction &
+ RCTL_LOCAL_ACTION_MASK;
+}
+
+
+rctl_priv_t rctlblk_get_privilege (rctlblk_t *rblk)
+{
+ return ((rctl_opaque_t *)rblk)->rcq_privilege;
+}
+
+
+id_t rctlblk_get_recipient_pid (rctlblk_t *rblk)
+{
+ return ((rctl_opaque_t *)rblk)->rcq_local_recipient_pid;
+}
+
+
+rctl_qty_t rctlblk_get_value (rctlblk_t *rblk)
+{
+ return ((rctl_opaque_t *)rblk)->rcq_value;
+}
+
+
+rctl_qty_t rctlblk_get_enforced_value (rctlblk_t *rblk)
+{
+ return ((rctl_opaque_t *)rblk)->rcq_enforced_value;
+}
+
+
+void rctlblk_set_local_action (rctlblk_t *rblk, unsigned int action,
+ int signal)
+{
+ /* Note: rcq_local_flagaction contains both flags and action. */
+ rctl_opaque_t *_rblk = (rctl_opaque_t *)rblk;
+ _rblk->rcq_local_signal = signal;
+ _rblk->rcq_local_flagaction = (_rblk->rcq_local_flagaction &
+ RCTL_LOCAL_ACTION_MASK) | action;
+}
+
+
+void rctlblk_set_local_flags (rctlblk_t *rblk, unsigned int flags)
+{
+ /* Note: rcq_local_flagaction contains both flags and action. */
+ rctl_opaque_t *_rblk = (rctl_opaque_t *)rblk;
+ _rblk->rcq_local_flagaction = (_rblk->rcq_local_flagaction &
+ ~RCTL_LOCAL_ACTION_MASK) | flags;
+}
+
+
+void rctlblk_set_privilege (rctlblk_t *rblk, rctl_priv_t privilege)
+{
+ ((rctl_opaque_t *)rblk)->rcq_privilege = privilege;
+}
+
+
+void rctlblk_set_value (rctlblk_t *rblk, rctl_qty_t value)
+{
+ ((rctl_opaque_t *)rblk)->rcq_value = value;
+}
+
+
+void rctlblk_set_recipient_pid (rctlblk_t *rblk, id_t pid)
+{
+ ((rctl_opaque_t *)rblk)->rcq_local_recipient_pid = pid;
+}
+
+
+size_t rctlblk_size (void)
+{
+ return sizeof (rctl_opaque_t);
+}
+
+
+int rctl_walk (int (*callback)(const char *rctlname, void *walk_data),
+ void *init_data)
+{
+ size_t len = rctllist (NULL, 0);
+ if (len < 0)
+ return -1;
+ char *names = malloc (len);
+ if (!names)
+ return -1;
+ if (rctllist (names, len) != 0)
+ {
+ free (names);
+ return -1;
+ }
+
+ char *namesptr = names;
+ while (*namesptr)
+ {
+ callback (namesptr, init_data);
+ namesptr += strlen (namesptr) + 1;
+ }
+
+ free (names);
+ return 0;
+}
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/rctl.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/rctl.h
new file mode 100644
index 0000000000..c7d17931c4
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/rctl.h
@@ -0,0 +1,48 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _RCTL_H
+#define _RCTL_H
+
+#include <sys/rctl.h>
+#include <sys/types.h>
+#include <features.h>
+
+__BEGIN_DECLS
+
+int rctl_walk(int (*)(const char *, void *), void *);
+
+hrtime_t rctlblk_get_firing_time (rctlblk_t *);
+unsigned int rctlblk_get_global_action (rctlblk_t *);
+unsigned int rctlblk_get_global_flags (rctlblk_t *);
+unsigned int rctlblk_get_local_action (rctlblk_t *, int *);
+unsigned int rctlblk_get_local_flags (rctlblk_t *);
+rctl_priv_t rctlblk_get_privilege (rctlblk_t *);
+id_t rctlblk_get_recipient_pid (rctlblk_t *);
+rctl_qty_t rctlblk_get_value(rctlblk_t *);
+rctl_qty_t rctlblk_get_enforced_value (rctlblk_t *);
+void rctlblk_set_local_action (rctlblk_t *, unsigned int, int);
+void rctlblk_set_local_flags (rctlblk_t *, unsigned int);
+void rctlblk_set_privilege (rctlblk_t *, rctl_priv_t);
+void rctlblk_set_recipient_pid (rctlblk_t *, id_t);
+size_t rctlblk_size (void);
+
+__END_DECLS
+
+#endif /* _RCTL_H */
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/readdir64.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/readdir64.c
new file mode 100644
index 0000000000..5263dcbe2b
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/readdir64.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/readdir64.c>
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/readdir64_r.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/readdir64_r.c
new file mode 100644
index 0000000000..7c171dab3f
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/readdir64_r.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/readdir64_r.c>
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/reboot.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/reboot.c
new file mode 100644
index 0000000000..29f11a5c1c
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/reboot.c
@@ -0,0 +1,55 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+/* Docs: http://docs.sun.com/app/docs/doc/819-2243/reboot-3c?l=en&a=view */
+
+#include <sys/types.h>
+#include <sys/reboot.h>
+#include <sys/uadmin.h>
+#include <bp-checks.h>
+
+int
+reboot (howto, bootargs)
+ int howto;
+ char *bootargs;
+{
+ /* compute cmd */
+ int cmd;
+ if (howto & RB_DUMP)
+ cmd = A_DUMP;
+ else
+ cmd = A_SHUTDOWN;
+
+ /* compute fcn */
+ int fcn;
+ if (howto & RB_ASKNAME)
+ if (howto & RB_SINGLE)
+ fcn = AD_SIBOOT;
+ else
+ fcn = AD_IBOOT;
+ else if (howto & RB_HALT)
+ fcn = AD_HALT;
+ else
+ if (howto & RB_SINGLE)
+ fcn = AD_SBOOT;
+ else
+ fcn = AD_BOOT;
+
+ return uadmin (cmd, fcn, (uintptr_t)CHECK_1 (bootargs));
+}
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/recvmsg.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/recvmsg.c
new file mode 100644
index 0000000000..a122596688
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/recvmsg.c
@@ -0,0 +1,36 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sysdep-cancel.h>
+#include <inline-syscall.h>
+#include <sys/socket.h>
+
+extern ssize_t _so_recvmsg (int s, struct msghdr *msg, int flags);
+
+ssize_t
+__recvmsg (fd, message, flags)
+ int fd;
+ struct msghdr *message;
+ int flags;
+{
+ return _so_recvmsg (fd, message, flags | MSG_XPG4_2);
+}
+
+weak_alias (__recvmsg, recvmsg)
+LIBC_CANCEL_HANDLED (); /* sys_recvmsg handles cancellation */
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/remove.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/remove.c
new file mode 100644
index 0000000000..e1b4c59953
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/remove.c
@@ -0,0 +1,42 @@
+/* ANSI C `remove' function to delete a file or directory. POSIX.1 version.
+ Copyright (C) 1995,96,97,2002,2003,2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <stdio.h>
+#include <unistd.h>
+
+/* OpenSolaris may return EPERM (but never EISDIR); see
+ http://docs.sun.com/app/docs/doc/816-5167/unlink-2?a=view */
+
+int
+remove (file)
+ const char *file;
+{
+ /* First try to unlink since this is more frequently the necessary action. */
+ if (__unlink (file) != 0
+ /* If it is indeed a directory... */
+ && (errno != EPERM
+ /* ...try to remove it. */
+ || __rmdir (file) != 0))
+ /* Cannot remove the object for whatever reason. */
+ return -1;
+
+ return 0;
+}
+libc_hidden_def (remove)
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/res_init.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/res_init.c
new file mode 100644
index 0000000000..ab8253495e
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/res_init.c
@@ -0,0 +1,2 @@
+#include <resolv/res_init.c>
+weak_alias (res_nclose, res_ndestroy)
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/rtld_db.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/rtld_db.h
new file mode 100644
index 0000000000..9385642421
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/rtld_db.h
@@ -0,0 +1,147 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _RTLD_DB_H
+#define _RTLD_DB_H
+
+#include <sys/types.h>
+#include <features.h>
+#include <proc_service.h>
+#include <sys/link.h>
+#include <dlfcn.h>
+
+#define RD_VERSION1 1
+#define RD_VERSION2 2
+#define RD_VERSION3 3
+#define RD_VERSION4 4
+#define RD_VERSION RD_VERSION4
+
+typedef enum
+ {
+ RD_ERR,
+ RD_OK,
+ RD_NOCAPAB,
+ RD_DBERR,
+ RD_NOBASE,
+ RD_NODYNAM,
+ RD_NOMAPS
+ } rd_err_e;
+
+typedef struct rd_agent rd_agent_t;
+
+typedef struct rd_loadobj
+ {
+ psaddr_t rl_nameaddr;
+ unsigned int rl_flags;
+ psaddr_t rl_base;
+ psaddr_t rl_data_base;
+ Lmid_t rl_lmident;
+ psaddr_t rl_refnameaddr;
+ psaddr_t rl_plt_base;
+ unsigned int rl_plt_size;
+ psaddr_t rl_bend;
+ psaddr_t rl_padstart;
+ psaddr_t rl_padend;
+ psaddr_t rl_dynamic;
+ unsigned long rl_tlsmodid;
+ } rd_loadobj_t;
+
+/* r_flags values. */
+#define RD_FLG_MEM_OBJECT 0x0001
+
+typedef int rl_iter_f (const rd_loadobj_t *, void *);
+
+typedef enum
+ {
+ RD_NOTIFY_BPT,
+ RD_NOTIFY_AUTOBPT,
+ RD_NOTIFY_SYSCALL
+ } rd_notify_e;
+
+typedef struct rd_notify
+ {
+ rd_notify_e type;
+ union
+ {
+ psaddr_t bptaddr;
+ long syscallno;
+ } u;
+ } rd_notify_t;
+
+typedef enum
+ {
+ RD_NOSTATE = 0,
+ RD_CONSISTENT,
+ RD_ADD,
+ RD_DELETE
+ } rd_state_e;
+
+typedef struct rd_event_msg
+ {
+ rd_event_e type;
+ union
+ {
+ rd_state_e state;
+ } u;
+ } rd_event_msg_t;
+
+typedef enum
+ {
+ RD_RESOLVE_NONE,
+ RD_RESOLVE_STEP,
+ RD_RESOLVE_TARGET,
+ RD_RESOLVE_TARGET_STEP
+ } rd_skip_e;
+
+typedef struct rd_plt_info
+ {
+ rd_skip_e pi_skip_method;
+ long pi_nstep;
+ psaddr_t pi_target;
+ psaddr_t pi_baddr;
+ unsigned int pi_flags;
+ } rd_plt_info_t;
+
+/* pi_flags values. */
+#define RD_FLG_PI_PLTBOUND 0x01
+
+/* rd_ctl commands. */
+#define RD_CTL_SET_HELPPATH 0x01
+
+__BEGIN_DECLS
+
+extern void rd_delete (rd_agent_t *);
+extern char * rd_errstr (rd_err_e);
+extern rd_err_e rd_event_addr (rd_agent_t *, rd_event_e, rd_notify_t *);
+extern rd_err_e rd_event_enable (rd_agent_t *, int);
+extern rd_err_e rd_event_getmsg (rd_agent_t *, rd_event_msg_t *);
+extern rd_err_e rd_init (int);
+extern rd_err_e rd_ctl (int, void *);
+extern rd_err_e rd_loadobj_iter (rd_agent_t *, rl_iter_f *, void *);
+extern void rd_log (const int);
+extern rd_agent_t * rd_new (struct ps_prochandle *);
+extern rd_err_e rd_objpad_enable(struct rd_agent *, size_t);
+extern rd_err_e rd_plt_resolution (rd_agent_t *, psaddr_t, lwpid_t, psaddr_t,
+ rd_plt_info_t *);
+extern rd_err_e rd_get_dyns (rd_agent_t *, psaddr_t, void **, size_t *);
+extern rd_err_e rd_reset (struct rd_agent *);
+
+__END_DECLS
+
+#endif /* _RTLD_DB_H */
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sa_len.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sa_len.c
new file mode 100644
index 0000000000..3fb4822331
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sa_len.c
@@ -0,0 +1,41 @@
+/* Copyright (C) 1998, 1999, 2002, 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <libc-symbols.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <sys/un.h>
+#include <net/if_dl.h>
+
+int
+__libc_sa_len (sa_family_t af)
+{
+ switch (af)
+ {
+ case AF_INET:
+ return sizeof (struct sockaddr_in);
+ case AF_INET6:
+ return sizeof (struct sockaddr_in6);
+ case AF_LINK:
+ return sizeof (struct sockaddr_dl);
+ case AF_LOCAL:
+ return sizeof (struct sockaddr_un);
+ }
+ return 0;
+}
+INTDEF(__libc_sa_len)
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/schedP.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/schedP.c
new file mode 100644
index 0000000000..8015dc0f56
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/schedP.c
@@ -0,0 +1,183 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <inline-syscall.h>
+#include <schedP.h>
+#include <sys/priocntl.h>
+#include <bits/libc-lock.h>
+
+/* XXX: We don't deal with custom schedulers. */
+
+/* XXX: We only set sched_param.sched_priority. */
+
+/* TODO: Cleanup errno usage. */
+
+/* Note: Because SCHED_FIFO and SCHED_RR map to the same scheduler, we need to
+ do additional work if we encounter either schedulers. */
+
+/* SCHED_SYS has cid == 0 always. */
+static pcinfo_t __sched_policies[] = {
+ {-1, "TS", {0}}, /* SCHED_OTHER */
+ {-1, "RT", {0}}, /* SCHED_FIFO */
+ {-1, "RT", {0}}, /* SCHED_RR */
+ {0, "SYS", {0}}, /* SCHED_SYS */
+ {-1, "IA", {0}}, /* SCHED_IA */
+ {-1, "FSS", {0}}, /* SCHED_FSS */
+ {-1, "FX", {0}}, /* SCHED_FX */
+};
+
+__libc_lock_define_initialized (static, lock);
+
+int __sched_policy_to_class (int policy)
+{
+ if (policy < 0 || policy >= _SCHED_NEXT)
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ __libc_lock_lock (lock);
+
+ /* Try to get cid from clname. */
+ if (__sched_policies[policy].pc_cid == -1)
+ {
+ priocntl (0, 0, PC_GETCID, &__sched_policies[policy]);
+ }
+
+ __libc_lock_unlock (lock);
+
+ return __sched_policies[policy].pc_cid;
+}
+
+int __sched_class_to_policy (int cid)
+{
+ int policy = -1;
+
+ __libc_lock_lock (lock);
+
+ for (int i = 0; i < _SCHED_NEXT; i++)
+ {
+ if (__sched_policies[i].pc_cid == -1)
+ priocntl (0, 0, PC_GETCID, &__sched_policies[i]);
+
+ if (__sched_policies[i].pc_cid == cid)
+ {
+ policy = i;
+ break;
+ }
+ }
+
+ __libc_lock_unlock (lock);
+
+ if (policy == -1)
+ __set_errno (EINVAL);
+
+ return policy;
+}
+
+int __sched_getparam_id (int idtype, id_t id, int *priority)
+{
+ pcprio_t prio;
+ prio.pc_op = PC_GETPRIO;
+ int result = priocntl (idtype, id, PC_DOPRIO, &prio);
+ if (result != 0)
+ return errno;
+
+ *priority = prio.pc_val;
+
+ return 0;
+}
+
+int __sched_setparam_id (int idtype, id_t id, int priority)
+{
+ /* We need pc_cid to be valid in the PC_SETPRIO call. */
+ pcprio_t prio;
+ prio.pc_op = PC_GETPRIO;
+ int result = priocntl (idtype, id, PC_DOPRIO, &prio);
+ if (result != 0)
+ return errno;
+
+ prio.pc_op = PC_SETPRIO;
+ prio.pc_val = priority;
+ result = priocntl (idtype, id, PC_DOPRIO, &prio);
+ if (result != 0)
+ return errno;
+
+ return 0;
+}
+
+int __sched_getscheduler_id (int idtype, id_t id, int *policy, int *priority)
+{
+ pcprio_t prio;
+ prio.pc_op = PC_GETPRIO;
+ int result = priocntl (idtype, id, PC_DOPRIO, &prio);
+ if (result != 0)
+ return errno;
+
+ *policy = __sched_class_to_policy (prio.pc_cid);
+ if (*policy == -1)
+ return errno;
+ if (priority)
+ *priority = prio.pc_val;
+
+ if (*policy == SCHED_FIFO || *policy == SCHED_RR)
+ {
+ pcparms_t parms;
+ parms.pc_cid = PC_CLNULL;
+ if (priocntl (idtype, id, PC_GETPARMS, parms) == -1)
+ return errno;
+ *policy = (((rtparms_t *)parms.pc_clparms)->rt_tqnsecs == RT_TQINF) ?
+ SCHED_FIFO : SCHED_RR;
+ }
+
+ return 0;
+}
+
+int __sched_setscheduler_id (int idtype, id_t id, int policy, int priority)
+{
+ pcprio_t prio;
+ prio.pc_op = PC_SETPRIO;
+ prio.pc_val = priority;
+ prio.pc_cid = __sched_policy_to_class (policy);
+ if (prio.pc_cid == -1)
+ return errno;
+
+ int result = priocntl (idtype, id, PC_DOPRIO, &prio);
+ if (result != 0)
+ return errno;
+
+ if (policy == SCHED_FIFO || policy == SCHED_RR)
+ {
+ // TODO
+ }
+
+ return 0;
+}
+
+int __sched_get_rt_priorities (int *minpri, int *maxpri)
+{
+ /* Force the class info for the RT scheduler to be fetched. */
+ if (__sched_policy_to_class (SCHED_FIFO) == -1)
+ return -1;
+
+ *minpri = 0;
+ *maxpri = ((rtinfo_t *)__sched_policies[SCHED_FIFO].pc_clinfo)->rt_maxpri;
+
+ return 0;
+}
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/schedP.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/schedP.h
new file mode 100644
index 0000000000..15c39a60ed
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/schedP.h
@@ -0,0 +1,63 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _SCHEDP_H
+#define _SCHEDP_H
+
+#include <sys/types.h>
+#include <sys/procset.h>
+#include <sched.h>
+
+typedef struct rtparms
+ {
+ pri_t rt_pri;
+ unsigned int rt_tqsecs;
+ int rt_tqnsecs;
+ } rtparms_t;
+
+#define RT_TQINF -2
+
+typedef struct rtinfo
+ {
+ pri_t rt_maxpri;
+ } rtinfo_t;
+
+typedef struct fxparms
+ {
+ pri_t fx_upri;
+ pri_t fx_uprilim;
+ unsigned int fx_tqsecs;
+ int fx_tqnsecs;
+ } fxparms_t;
+
+#define FX_TQINF -2
+
+extern int __sched_policy_to_class (int policy);
+extern int __sched_class_to_policy (int cid);
+extern int __sched_getparam_id (int idtype, id_t id, int *priority);
+extern int __sched_setparam_id (int idtype, id_t id, int priority);
+extern int __sched_getscheduler_id (int idtype, id_t id, int *policy,
+ int *priority);
+extern int __sched_setscheduler_id (int idtype, id_t id, int policy,
+ int priority);
+extern int __sched_get_rt_priorities (int *minpri, int *maxpri);
+extern long __internal_priocntl_4 (int *errval, idtype_t idtype, id_t id,
+ int cmd, ...);
+
+#endif /* _SCHEDP_H */
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sched_getp.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sched_getp.c
new file mode 100644
index 0000000000..1898c919a4
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sched_getp.c
@@ -0,0 +1,37 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sched.h>
+#include <errno.h>
+#include <sys/procset.h>
+#include <schedP.h>
+
+int
+__sched_getparam (pid_t pid, struct sched_param *param)
+{
+ int errval = __sched_getparam_id (P_PID, pid, &param->sched_priority);
+ if (errval != 0)
+ {
+ __set_errno (errval);
+ return -1;
+ }
+ return 0;
+}
+
+weak_alias (__sched_getparam, sched_getparam)
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sched_gets.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sched_gets.c
new file mode 100644
index 0000000000..08d989ff1b
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sched_gets.c
@@ -0,0 +1,38 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sched.h>
+#include <errno.h>
+#include <sys/procset.h>
+#include <schedP.h>
+
+int
+__sched_getscheduler (pid_t pid)
+{
+ int policy;
+ int errval = __sched_getscheduler_id (P_PID, pid, &policy, NULL);
+ if (errval != 0)
+ {
+ __set_errno (errval);
+ return -1;
+ }
+ return policy;
+}
+
+weak_alias (__sched_getscheduler, sched_getscheduler)
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sched_primax.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sched_primax.c
new file mode 100644
index 0000000000..a5ee7f6680
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sched_primax.c
@@ -0,0 +1,42 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sched.h>
+#include <schedP.h>
+#include <errno.h>
+#include <sys/priocntl.h>
+
+int
+__sched_get_priority_max (int algorithm)
+{
+ pcpri_t pri;
+ pri.pc_cid = __sched_policy_to_class (algorithm);
+ if (pri.pc_cid == -1)
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ int result = priocntl (0, 0, PC_GETPRIRANGE, &pri);
+ if (result != 0)
+ return -1;
+ return pri.pc_clpmax;
+}
+
+weak_alias (__sched_get_priority_max, sched_get_priority_max)
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sched_primin.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sched_primin.c
new file mode 100644
index 0000000000..852b3b720f
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sched_primin.c
@@ -0,0 +1,42 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sched.h>
+#include <schedP.h>
+#include <errno.h>
+#include <sys/priocntl.h>
+
+int
+__sched_get_priority_min (int algorithm)
+{
+ pcpri_t pri;
+ pri.pc_cid = __sched_policy_to_class (algorithm);
+ if (pri.pc_cid == -1)
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ int result = priocntl (0, 0, PC_GETPRIRANGE, &pri);
+ if (result != 0)
+ return -1;
+ return pri.pc_clpmin;
+}
+
+weak_alias (__sched_get_priority_min, sched_get_priority_min)
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sched_rr_gi.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sched_rr_gi.c
new file mode 100644
index 0000000000..91f3f5b2a1
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sched_rr_gi.c
@@ -0,0 +1,68 @@
+/* Copyright (C) 1996, 1997, 2009 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <schedP.h>
+#include <sched.h>
+#include <sys/priocntl.h>
+#include <sys/types.h>
+
+
+/* Get the SCHED_RR interval for the named process. */
+int
+__sched_rr_get_interval (pid_t pid, struct timespec *t)
+{
+ if (pid == 0)
+ pid = P_MYID;
+
+ pcparms_t parms = {0};
+ parms.pc_cid = PC_CLNULL;
+ if (priocntl (P_PID, pid, PC_GETPARMS, &parms) == -1)
+ return -1;
+ int policy = __sched_class_to_policy (parms.pc_cid);
+ if (policy == -1)
+ return -1;
+
+ t->tv_sec = 0;
+ t->tv_nsec = 0;
+ rtparms_t *rtparms = (rtparms_t *)parms.pc_clparms;
+ fxparms_t *fxparms = (fxparms_t *)parms.pc_clparms;
+ switch (policy)
+ {
+ case SCHED_FIFO:
+ case SCHED_RR:
+ if (rtparms->rt_tqnsecs != RT_TQINF)
+ {
+ t->tv_sec = rtparms->rt_tqsecs;
+ t->tv_nsec = rtparms->rt_tqnsecs;
+ }
+ break;
+
+ case SCHED_FX:
+ if (fxparms->fx_tqnsecs != FX_TQINF)
+ {
+ t->tv_sec = fxparms->fx_tqsecs;
+ t->tv_nsec = fxparms->fx_tqnsecs;
+ break;
+ }
+ }
+
+ return 0;
+}
+
+weak_alias (__sched_rr_get_interval, sched_rr_get_interval)
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sched_setp.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sched_setp.c
new file mode 100644
index 0000000000..3b20566344
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sched_setp.c
@@ -0,0 +1,37 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sched.h>
+#include <errno.h>
+#include <sys/procset.h>
+#include <schedP.h>
+
+int
+__sched_setparam (pid_t pid, const struct sched_param *param)
+{
+ int errval = __sched_setparam_id (P_PID, pid, param->sched_priority);
+ if (errval != 0)
+ {
+ __set_errno (errval);
+ return -1;
+ }
+ return 0;
+}
+
+weak_alias (__sched_setparam, sched_setparam)
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sched_sets.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sched_sets.c
new file mode 100644
index 0000000000..69e8bd31e8
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sched_sets.c
@@ -0,0 +1,39 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <schedP.h>
+#include <errno.h>
+#include <sys/procset.h>
+#include <sched.h>
+
+int
+__sched_setscheduler (pid_t pid, int policy, const struct sched_param *param)
+{
+ int errval = __sched_setscheduler_id (P_PID, pid, policy,
+ param->sched_priority);
+ if (errval != 0)
+ {
+ __set_errno (errval);
+ return -1;
+ }
+ return 0;
+}
+
+libc_hidden_def (__sched_setscheduler)
+weak_alias (__sched_setscheduler, sched_setscheduler)
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/select.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/select.c
new file mode 100644
index 0000000000..b5a59d682c
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/select.c
@@ -0,0 +1,46 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sysdep-cancel.h>
+#include <sys/select.h>
+#include <sys/time.h>
+#include <alloca.h>
+#include <stddef.h>
+
+int
+__select (nfds, readfds, writefds, exceptfds, timeout)
+ int nfds;
+ fd_set *readfds;
+ fd_set *writefds;
+ fd_set *exceptfds;
+ struct timeval *timeout;
+{
+ struct timespec *ts = NULL;
+ if (timeout != NULL)
+ {
+ ts = alloca (sizeof(struct timespec));
+ TIMEVAL_TO_TIMESPEC (timeout, ts);
+ }
+
+ return __pselect (nfds, readfds, writefds, exceptfds, ts, NULL);
+}
+
+libc_hidden_def (__select)
+weak_alias (__select, select)
+LIBC_CANCEL_HANDLED (); /* handled by pselect */
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/send.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/send.c
new file mode 100644
index 0000000000..add56e3fa0
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/send.c
@@ -0,0 +1,49 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sysdep-cancel.h>
+#include <inline-syscall.h>
+#include <sys/socket.h>
+#include <socketP.h>
+
+extern ssize_t _so_send(int s, const void *buf, size_t len, int flags);
+
+SIGPIPE_DISABLE_DEFINE;
+
+ssize_t
+__send (fd, buf, n, flags)
+ int fd;
+ __const __ptr_t buf;
+ size_t n;
+ int flags;
+{
+ if (flags & MSG_NOSIGNAL)
+ SIGPIPE_DISABLE;
+
+ ssize_t res = _so_send (fd, buf, n, (flags & ~MSG_NOSIGNAL) | MSG_XPG4_2);
+
+ if (flags & MSG_NOSIGNAL)
+ SIGPIPE_ENABLE;
+
+ return res;
+}
+
+libc_hidden_def (__send)
+weak_alias (__send, send)
+LIBC_CANCEL_HANDLED (); /* sys_send handles cancellation */
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sendfile.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sendfile.c
new file mode 100644
index 0000000000..0c96d94967
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sendfile.c
@@ -0,0 +1,37 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <inline-syscall.h>
+#include <sys/sendfile.h>
+#include <errno.h>
+
+ssize_t
+sendfile (int out_fd, int in_fd, off_t *offset, size_t count)
+{
+ sendfilevec_t sfv;
+ sfv.sfv_fd = in_fd;
+ sfv.sfv_flag = 0;
+ sfv.sfv_off = *offset;
+ sfv.sfv_len = count;
+ size_t xferred = 0;
+
+ ssize_t res = sendfilev (out_fd, &sfv, 1, &xferred);
+ *offset += xferred;
+ return res;
+}
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sendfile64.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sendfile64.c
new file mode 100644
index 0000000000..277fc3bc6e
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sendfile64.c
@@ -0,0 +1,37 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <inline-syscall.h>
+#include <sys/sendfile.h>
+#include <errno.h>
+
+ssize_t
+sendfile64 (int out_fd, int in_fd, off64_t *offset, size_t count)
+{
+ sendfilevec64_t sfv;
+ sfv.sfv_fd = in_fd;
+ sfv.sfv_flag = 0;
+ sfv.sfv_off = *offset;
+ sfv.sfv_len = count;
+ size_t xferred = 0;
+
+ ssize_t res = sendfilev64 (out_fd, &sfv, 1, &xferred);
+ *offset += xferred;
+ return res;
+}
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sendfilev.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sendfilev.c
new file mode 100644
index 0000000000..f42f01e8e4
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sendfilev.c
@@ -0,0 +1,35 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <inline-syscall.h>
+#include <sys/sendfile.h>
+#include <errno.h>
+
+DECLARE_INLINE_SYSCALL (ssize_t, sendfilev, int fildes,
+ const sendfilevec_t *sfv, int count, size_t *xferred);
+
+ssize_t
+sendfilev (int out_fd, const sendfilevec_t *sfv, int count, size_t *xferred)
+{
+ ssize_t res = INLINE_SYSCALL (sendfilev, 4, out_fd, sfv, 1, xferred);
+ if (res == (ssize_t)-1 && errno == EINTR)
+ return *xferred;
+ else
+ return res;
+}
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sendfilev64.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sendfilev64.c
new file mode 100644
index 0000000000..a240809725
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sendfilev64.c
@@ -0,0 +1,35 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <inline-syscall.h>
+#include <sys/sendfile.h>
+#include <errno.h>
+
+DECLARE_INLINE_SYSCALL (ssize_t, sendfilev64, int fildes,
+ const sendfilevec64_t *sfv, int count, size_t *xferred);
+
+ssize_t
+sendfilev64 (int out_fd, const sendfilevec64_t *sfv, int count, size_t *xferred)
+{
+ ssize_t res = INLINE_SYSCALL (sendfilev64, 4, out_fd, sfv, 1, xferred);
+ if (res == (ssize_t)-1 && errno == EINTR)
+ return *xferred;
+ else
+ return res;
+}
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sendmsg.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sendmsg.c
new file mode 100644
index 0000000000..6906318898
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sendmsg.c
@@ -0,0 +1,45 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sysdep-cancel.h>
+#include <inline-syscall.h>
+#include <sys/socket.h>
+#include <socketP.h>
+
+extern ssize_t _so_sendmsg (int s, const struct msghdr *msg, int flags);
+
+ssize_t
+__sendmsg (fd, message, flags)
+ int fd;
+ const struct msghdr *message;
+ int flags;
+{
+ if (flags & MSG_NOSIGNAL)
+ SIGPIPE_DISABLE;
+
+ ssize_t res = _so_sendmsg (fd, message, (flags & ~MSG_NOSIGNAL) | MSG_XPG4_2);
+
+ if (flags & MSG_NOSIGNAL)
+ SIGPIPE_ENABLE;
+
+ return res;
+}
+
+weak_alias (__sendmsg, sendmsg)
+LIBC_CANCEL_HANDLED (); /* sys_sendmsg handles cancellation */
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sendto.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sendto.c
new file mode 100644
index 0000000000..fca973876a
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sendto.c
@@ -0,0 +1,50 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sysdep-cancel.h>
+#include <inline-syscall.h>
+#include <sys/socket.h>
+#include <socketP.h>
+
+extern ssize_t _so_sendto (int s, const void *buf, size_t len, int flags,
+ __CONST_SOCKADDR_ARG to, socklen_t tolen);
+
+ssize_t
+__sendto (fd, buf, n, flags, addr, addr_len)
+ int fd;
+ __const __ptr_t buf;
+ size_t n;
+ int flags;
+ __CONST_SOCKADDR_ARG addr;
+ socklen_t addr_len;
+{
+ if (flags & MSG_NOSIGNAL)
+ SIGPIPE_DISABLE;
+
+ ssize_t res = _so_sendto (fd, buf, n, (flags & ~MSG_NOSIGNAL) | MSG_XPG4_2,
+ addr, addr_len);
+
+ if (flags & MSG_NOSIGNAL)
+ SIGPIPE_ENABLE;
+
+ return res;
+}
+
+weak_alias (__sendto, sendto)
+LIBC_CANCEL_HANDLED (); /* sys_sendto handles cancellation */
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/setdomain.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/setdomain.c
new file mode 100644
index 0000000000..309ed3509b
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/setdomain.c
@@ -0,0 +1,31 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <unistd.h>
+#include <sys/systeminfo.h>
+
+int
+setdomainname (name, len)
+ const char *name;
+ size_t len;
+{
+ /* Systeminfo returns the domain length on success but we want to return
+ zero on success. */
+ return sysinfo (SI_SET_SRPC_DOMAIN, (char *)name, len) == -1 ? -1 : 0;
+}
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sethostid.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sethostid.c
new file mode 100644
index 0000000000..573a327707
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sethostid.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/sethostid.c>
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sethostname.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sethostname.c
new file mode 100644
index 0000000000..952e217500
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sethostname.c
@@ -0,0 +1,31 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <unistd.h>
+#include <sys/systeminfo.h>
+
+int
+sethostname (name, len)
+ const char *name;
+ size_t len;
+{
+ /* Systeminfo returns the hostname length on success but we want to return
+ zero on success. */
+ return sysinfo (SI_SET_HOSTNAME, (char*)name, len) == -1 ? -1 : 0;
+}
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/setipv4sourcefilter.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/setipv4sourcefilter.c
new file mode 100644
index 0000000000..65a7a80258
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/setipv4sourcefilter.c
@@ -0,0 +1,62 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <netinet/in.h>
+#include <alloca.h>
+#include <stdlib.h>
+#include <sys/ioctl.h>
+#include <string.h>
+
+
+int
+setipv4sourcefilter (int s, struct in_addr interface, struct in_addr group,
+ uint32_t fmode, uint32_t numsrc,
+ const struct in_addr *slist)
+{
+ /* The kernel assumes at least one in_addr. */
+ int imsf_len = IP_MSFILTER_SIZE (numsrc ?: 1);
+ int use_alloca = __libc_use_alloca (imsf_len);
+ struct ip_msfilter *imsf;
+ if (use_alloca)
+ imsf = alloca (imsf_len);
+ else
+ {
+ imsf = malloc (imsf_len);
+ if (!imsf)
+ return -1;
+ }
+
+ imsf->imsf_multiaddr = group;
+ imsf->imsf_interface = interface;
+ imsf->imsf_fmode = fmode;
+ imsf->imsf_numsrc = numsrc;
+ memcpy (imsf->imsf_slist, slist, numsrc * sizeof (struct in_addr));
+
+ int res = ioctl (s, SIOCSIPMSFILTER, imsf);
+ if (res == -1)
+ {
+ if (!use_alloca)
+ free (imsf);
+ return -1;
+ }
+
+ if (!use_alloca)
+ free (imsf);
+ return 0;
+}
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/setpriority.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/setpriority.c
new file mode 100644
index 0000000000..4753b8a45b
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/setpriority.c
@@ -0,0 +1,48 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sys/time.h>
+#include <sys/resource.h>
+#include <sys/procset.h>
+#include <sys/priocntl.h>
+#include <errno.h>
+#include <priorityP.h>
+
+int
+setpriority (enum __priority_which which, id_t who, int prio)
+{
+ idtype_t type = __prio_to_p (which);
+ if (type == -1)
+ return -1;
+
+ if(who == 0)
+ who = P_MYID;
+
+ if(prio > NZERO)
+ prio = NZERO;
+ else if(prio < NZERO)
+ prio = -NZERO;
+
+ pcnice_t nice;
+ nice.pc_val = prio;
+ nice.pc_op = PC_SETNICE;
+ return priocntl (type, who, PC_DONICE, &nice);
+}
+
+libc_hidden_def (setpriority)
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/setsockopt.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/setsockopt.c
new file mode 100644
index 0000000000..1fb504060b
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/setsockopt.c
@@ -0,0 +1,37 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <inline-syscall.h>
+#include <sys/socket.h>
+
+extern int _so_setsockopt (int sock, int level, int option_name,
+ const void *option_value, socklen_t option_len, int version);
+
+int
+__setsockopt (fd, level, optname, optval, optlen)
+ int fd;
+ int level;
+ int optname;
+ const __ptr_t optval;
+ socklen_t optlen;
+{
+ return _so_setsockopt (fd, level, optname, optval, optlen, SOV_XPG4_2);
+}
+
+weak_alias (__setsockopt, setsockopt)
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/setsourcefilter.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/setsourcefilter.c
new file mode 100644
index 0000000000..e5ade46df1
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/setsourcefilter.c
@@ -0,0 +1,69 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <netinet/in.h>
+#include <alloca.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <sys/ioctl.h>
+#include <string.h>
+
+
+int
+setsourcefilter (int s, uint32_t interface, const struct sockaddr *group,
+ socklen_t grouplen, uint32_t fmode, uint32_t numsrc,
+ const struct sockaddr_storage *slist)
+{
+ if (grouplen < SA_LEN (group))
+ {
+ __set_errno (ENOPROTOOPT);
+ return -1;
+ }
+
+ /* The kernel assumes at least one sockaddr_storage. */
+ int gf_len = GROUP_FILTER_SIZE (numsrc ?: 1);
+ int use_alloca = __libc_use_alloca (gf_len);
+ struct group_filter *gf;
+ if (use_alloca)
+ gf = alloca (gf_len);
+ else
+ {
+ gf = malloc (gf_len);
+ if (!gf)
+ return -1;
+ }
+
+ gf->gf_interface = interface;
+ memcpy (&gf->gf_group, group, SA_LEN (group));
+ gf->gf_fmode = fmode;
+ gf->gf_numsrc = numsrc;
+ memcpy (gf->gf_slist, slist, numsrc * sizeof (struct sockaddr_storage));
+
+ int res = ioctl (s, SIOCSMSFILTER, gf);
+ if (res == -1)
+ {
+ if (!use_alloca)
+ free (gf);
+ return -1;
+ }
+
+ if (!use_alloca)
+ free (gf);
+ return 0;
+}
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/settaskid.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/settaskid.c
new file mode 100644
index 0000000000..fd68a8167c
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/settaskid.c
@@ -0,0 +1,36 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <inline-syscall.h>
+#include <sys/types.h>
+
+DECLARE_INLINE_SYSCALL (int, settaskid, projid_t project, unsigned int flags);
+
+taskid_t
+settaskid (projid_t project, unsigned int flags)
+{
+ int res;
+
+ /* settaskid cannot return EINTR. */
+ do
+ res = INLINE_SYSCALL (settaskid, 2, project, flags);
+ while (res == -1 && errno == EINTR);
+
+ return res;
+}
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/shutdown.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/shutdown.c
new file mode 100644
index 0000000000..72cb5f59ba
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/shutdown.c
@@ -0,0 +1,31 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <inline-syscall.h>
+#include <sys/socket.h>
+
+extern int _so_shutdown (int sock, int how, int version);
+
+int
+shutdown (fd, how)
+ int fd;
+ int how;
+{
+ return _so_shutdown (fd, how, SOV_XPG4_2);
+}
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sig2str.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sig2str.c
new file mode 100644
index 0000000000..c4e64ec38e
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sig2str.c
@@ -0,0 +1,88 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <signal.h>
+#include <ctype.h>
+
+/* Based on ideas from sig2str.c in gnulib. */
+
+#define NUMNAME(name) { SIG##name, #name }
+#define RTNAME(num) { __SIGRTMIN + num, "RTMIN" #num }
+
+static struct _siglist { int num; char name[8]; } siglist[] =
+ {
+ NUMNAME (HUP), NUMNAME (INT), NUMNAME (QUIT), NUMNAME (ILL),
+ NUMNAME (TRAP), NUMNAME (IOT), NUMNAME (EMT), NUMNAME (FPE),
+ NUMNAME (KILL), NUMNAME (BUS), NUMNAME (SEGV), NUMNAME (SYS),
+ NUMNAME (PIPE), NUMNAME (ALRM), NUMNAME (TERM), NUMNAME (USR1),
+ NUMNAME (USR2), NUMNAME (CHLD), NUMNAME (PWR), NUMNAME (WINCH),
+ NUMNAME (URG), NUMNAME (POLL), NUMNAME (IO), NUMNAME (STOP),
+ NUMNAME (TSTP), NUMNAME (CONT), NUMNAME (TTIN), NUMNAME (TTOU),
+ NUMNAME (VTALRM), NUMNAME (PROF), NUMNAME (XCPU), NUMNAME (XFSZ),
+ NUMNAME (WAITING), NUMNAME (LWP), NUMNAME (FREEZE), NUMNAME (THAW),
+ NUMNAME (CANCEL), NUMNAME (LOST), NUMNAME (XRES), NUMNAME (JVM1),
+ NUMNAME (JVM2), { __SIGRTMIN, "RTMIN" }, RTNAME (+1), RTNAME (+2),
+ RTNAME (+3), RTNAME (-3), RTNAME (-2), RTNAME (-1),
+ { __SIGRTMAX, "RTMAX"}
+ };
+
+#define SIGLIST_SIZE (sizeof (siglist) / sizeof (siglist[0]))
+
+int sig2str (int signum, char *signame)
+{
+ for (int i = 0; i < SIGLIST_SIZE; i++)
+ {
+ if (siglist[i].num == signum)
+ {
+ strcpy (signame, siglist[i].name);
+ return 0;
+ }
+ }
+
+ return -1;
+}
+
+
+int str2sig (char const *signame, int *signum)
+{
+ if (isdigit (signame[0]))
+ {
+ long num = strtol (signame, NULL, 10);
+ if (num < 1 || num >= _NSIG)
+ {
+ return -1;
+ }
+ else
+ {
+ *signum = num;
+ return 0;
+ }
+ }
+
+ for (int i = 0; i < SIGLIST_SIZE; i++)
+ {
+ if (strcmp (siglist[i].name, signame) == 0)
+ {
+ *signum = siglist[i].num;
+ return 0;
+ }
+ }
+
+ return -1;
+}
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sigaction.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sigaction.c
new file mode 100644
index 0000000000..06fbeb93ea
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sigaction.c
@@ -0,0 +1,155 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <inline-syscall.h>
+#include <errno.h>
+#include <stddef.h>
+#include <signal.h>
+#include <string.h>
+#include <ucontext.h>
+#include <tls.h>
+#include <assert.h>
+#include <bits/libc-lock.h>
+#include <stdio.h>
+#include <socketP.h>
+
+static void (*sighandlers[_NSIG])(int, struct siginfo *, void *) = {0};
+static sigset_t sigmasks[_NSIG];
+__libc_lock_define_initialized (, signal_lock);
+
+/* Solaris expects the ucontext_t to be switched back at the end
+ of signal processing; one cannot simply return from the
+ sighandler. As well, Solaris always calls the 3-param version
+ of the handler (i.e. sa_sigaction). */
+
+/* Defined in sighandler.c. */
+extern void __sighandler(int, siginfo_t *, void *);
+
+DECLARE_INLINE_SYSCALL (int, sigaction, int signum,
+ const struct sigaction *act, struct sigaction *oldact);
+
+DECLARE_INLINE_SYSCALL (int64_t, lwp_sigmask, int how, unsigned int bits0,
+ unsigned int bits1);
+
+int
+__libc_sigaction (sig, act, oact)
+ int sig;
+ const struct sigaction *act;
+ struct sigaction *oact;
+{
+ int result = -1;
+
+ if (sig < 0 || sig >= NSIG)
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ if (!act && !oact)
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ /* Block all signals and lock. */
+ rval_t oldmask;
+ oldmask.rval64 = INLINE_SYSCALL (lwp_sigmask, 3, SIG_SETMASK,
+ (unsigned int)-1, (unsigned int)-1);
+ __libc_lock_lock (signal_lock);
+
+ void (*old_sigaction)(int, siginfo_t *, void *) = sighandlers[sig];
+ sigset_t old_sigmask = sigmasks[sig];
+ if (act)
+ {
+ struct sigaction _act = *act;
+ if (act->sa_handler != SIG_DFL && act->sa_handler != SIG_IGN)
+ {
+ _act.sa_sigaction = __sighandler;
+ (void)sigfillset (&_act.sa_mask);
+ }
+ result = INLINE_SYSCALL (sigaction, 3, sig, &_act, oact);
+ if (result == 0)
+ {
+ sighandlers[sig] = act->sa_sigaction;
+ sigmasks[sig] = act->sa_mask;
+ }
+ }
+
+ if (oact)
+ {
+ /* If we called sigaction above don't call it again. */
+ if (!act)
+ result = INLINE_SYSCALL(sigaction, 3, sig, NULL, oact);
+ if (result == 0)
+ {
+ if (oact->sa_handler != SIG_DFL && oact->sa_handler != SIG_IGN)
+ {
+ oact->sa_sigaction = old_sigaction;
+ oact->sa_mask = old_sigmask;
+ }
+ }
+ }
+
+ /* Unlock and restore signals. */
+ __libc_lock_unlock (signal_lock);
+ (void)INLINE_SYSCALL (lwp_sigmask, 3, SIG_SETMASK,
+ (unsigned int)oldmask.rval1, (unsigned int)oldmask.rval2);
+
+ return result;
+}
+
+libc_hidden_def (__libc_sigaction)
+#ifndef LIBC_SIGACTION
+weak_alias (__libc_sigaction, __sigaction)
+libc_hidden_weak (__sigaction)
+weak_alias (__libc_sigaction, sigaction)
+#endif
+
+
+asm (".globl __sighandler_end");
+void __sighandler (int sig, siginfo_t *sip, void *uvp)
+{
+ assert (sig >= 0 && sig < NSIG);
+ ucontext_t *uctx = (ucontext_t*)uvp;
+
+ if (sig == SIGPIPE && SIGPIPE_IS_DISABLED)
+ {
+ setcontext (uctx);
+ assert (0); /* never reached */
+ }
+
+ /* All signals are blocked (we passed a filled sa_mask above). */
+
+ __libc_lock_lock (signal_lock);
+
+ void (*handler)(int, siginfo_t *, void *) = sighandlers[sig];
+ sigset_t mask = sigmasks[sig];
+
+ __libc_lock_unlock (signal_lock);
+
+ /* Set signals to wait sigaction wants. */
+ (void)INLINE_SYSCALL (lwp_sigmask, 3, SIG_SETMASK,
+ (unsigned int)mask.__sigbits[0], (unsigned int)mask.__sigbits[1]);
+
+ (*handler)(sig, sip, uvp);
+
+ setcontext (uctx);
+ assert (0); /* never reached */
+}
+asm ("__sighandler_end:");
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/siglist.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/siglist.h
new file mode 100644
index 0000000000..cc2b49ed2f
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/siglist.h
@@ -0,0 +1,25 @@
+/* Copyright (C) 1996,1997,1998,1999,2002,2003 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+/* This file is included multiple times. */
+
+#include_next <siglist.h> /* Get the canonical list. */
+
+#define OLD_SIGLIST_SIZE 32 /* For GLIBC_2.0 binary compatibility. */
+
+#define OLD2_SIGLIST_SIZE 64 /* For GLIBC_2.1 binary compatibility. */
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/signal.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/signal.c
new file mode 100644
index 0000000000..be7e216aa6
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/signal.c
@@ -0,0 +1,43 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sysdeps/posix/signal.c>
+
+/* XXX: These are racey. */
+
+#include <inline-syscall.h>
+
+DECLARE_INLINE_SYSCALL (int64_t, lwp_sigmask, int how, unsigned int bits0,
+ unsigned int bits1);
+
+static int64_t __thread __sigmask;
+
+void _sigoff (void)
+{
+ __sigmask = INLINE_SYSCALL (lwp_sigmask, 3, SIG_SETMASK,
+ (unsigned int)-1, (unsigned int)-1);
+}
+
+void _sigon (void)
+{
+ rval_t mask;
+ mask.rval64 = __sigmask;
+ INLINE_SYSCALL (lwp_sigmask, 3, SIG_SETMASK, (unsigned int)mask.rval1,
+ (unsigned int)mask.rval2);
+}
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sigprocmask.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sigprocmask.c
new file mode 100644
index 0000000000..d98b92a057
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sigprocmask.c
@@ -0,0 +1,69 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <inline-syscall.h>
+#include <signal.h>
+#include <memory.h>
+
+DECLARE_INLINE_SYSCALL (int64_t, lwp_sigmask, int how, unsigned int bits0,
+ unsigned int bits1);
+
+int
+__sigprocmask (how, set, oset)
+ int how;
+ const sigset_t *set;
+ sigset_t *oset;
+{
+ /* we don't want people blocking SIGCANCEL */
+ sigset_t tmpset;
+ if (set != NULL && __builtin_expect (__sigismember(set, SIGCANCEL), 0))
+ {
+ memcpy (&tmpset, set, sizeof(sigset_t));
+ __sigdelset (&tmpset, SIGCANCEL);
+ set = &tmpset;
+ }
+
+ /* we need to convert from sigset_t to two bit fields */
+ unsigned int bits0, bits1;
+ if (set)
+ {
+ bits0 = set->__sigbits[0];
+ bits1 = set->__sigbits[1];
+ }
+ else
+ {
+ bits0 = bits1 = how = 0;
+ }
+
+ /* we call lwp_sigmask to set the per-thread sigmask */
+ rval_t result;
+ result.rval64 = INLINE_SYSCALL (lwp_sigmask, 3, how, bits0, bits1);
+
+ /* now we need to convert from two bit fields to sigset_t */
+ if (oset)
+ {
+ oset->__sigbits[0] = result.rval1;
+ oset->__sigbits[1] = result.rval2;
+ oset->__sigbits[2] = oset->__sigbits[3] = 0;
+ }
+
+ return 0;
+}
+
+weak_alias (__sigprocmask, sigprocmask)
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sigqueue.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sigqueue.c
new file mode 100644
index 0000000000..84a475ffec
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sigqueue.c
@@ -0,0 +1,33 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <inline-syscall.h>
+#include <signal.h>
+#include <sys/types.h>
+
+DECLARE_INLINE_SYSCALL (int, sigqueue, pid_t pid, int sig,
+ const union sigval value, int si_code, int block);
+
+int
+__sigqueue (pid_t pid, int sig, const union sigval val)
+{
+ return INLINE_SYSCALL (sigqueue, 5, pid, sig, val, SI_QUEUE, 0);
+}
+
+weak_alias (__sigqueue, sigqueue)
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sigreturn.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sigreturn.c
new file mode 100644
index 0000000000..79304a4f36
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sigreturn.c
@@ -0,0 +1 @@
+#include <signal/sigreturn.c>
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sigsend.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sigsend.c
new file mode 100644
index 0000000000..98a9712c4f
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sigsend.c
@@ -0,0 +1,30 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <signal.h>
+#include <sys/procset.h>
+
+extern int sigsendset (procset_t *, int sig);
+
+int sigsend (idtype_t idtype, id_t id, int sig)
+{
+ procset_t set;
+ setprocset (&set, POP_AND, idtype, id, P_ALL, P_MYID);
+ return sigsendset (&set, sig);
+}
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sigset-cvt-mask.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sigset-cvt-mask.h
new file mode 100644
index 0000000000..2f9c233600
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sigset-cvt-mask.h
@@ -0,0 +1,45 @@
+/* Convert between lowlevel sigmask and libc representation of sigset_t.
+ Linux version.
+ Copyright (C) 1998, 2002, 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Joe Keane <jgk@jgk.org>.
+ OpenSolaris bits contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+static inline int __attribute__ ((unused))
+sigset_set_old_mask (sigset_t *set, int mask)
+{
+ unsigned int *ptr;
+ int cnt;
+
+ ptr = &set->__sigbits[0];
+
+ *ptr++ = (unsigned int) mask;
+
+ cnt = _SIGSET_NWORDS - 2;
+ do
+ *ptr++ = 0;
+ while (--cnt >= 0);
+
+ return 0;
+}
+
+static inline int __attribute__ ((unused))
+sigset_get_old_mask (const sigset_t *set)
+{
+ return set->__sigbits[0];
+}
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sigstack.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sigstack.c
new file mode 100644
index 0000000000..5aa73c8dcb
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sigstack.c
@@ -0,0 +1,3 @@
+/* We can reuse the Linux implementation with some tricks. */
+#define __NR_sigaltstack 1
+#include <sysdeps/unix/sysv/linux/sigstack.c>
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sigsuspend.S b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sigsuspend.S
new file mode 100644
index 0000000000..0d23dd74a8
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sigsuspend.S
@@ -0,0 +1,7 @@
+#include <sysdep-cancel.h>
+PSEUDO (__sigsuspend, sigsuspend, 1)
+ ret
+PSEUDO_END(__sigsuspend)
+libc_hidden_def (__sigsuspend)
+weak_alias (__sigsuspend, sigsuspend)
+libc_hidden_weak (sigsuspend)
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sigtimedwait.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sigtimedwait.c
new file mode 100644
index 0000000000..d5cf1ffcc2
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sigtimedwait.c
@@ -0,0 +1,68 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sysdep-cancel.h>
+#include <inline-syscall.h>
+#include <signal.h>
+#include <string.h>
+#include <errno.h>
+
+DECLARE_INLINE_SYSCALL (int, sigtimedwait, const sigset_t *set,
+ siginfo_t *infop, const struct timespec *timeout);
+
+int
+__sigtimedwait_not_cancel (const sigset_t *set, siginfo_t *info,
+ const struct timespec *timeout)
+{
+ if (set == NULL)
+ {
+ __set_errno(EINVAL);
+ return -1;
+ }
+
+ /* we don't want people waiting on SIGCANCEL */
+ sigset_t tmpset;
+ if (set != NULL && __builtin_expect (__sigismember(set, SIGCANCEL), 0))
+ {
+ memcpy (&tmpset, set, sizeof(sigset_t));
+ __sigdelset (&tmpset, SIGCANCEL);
+ set = &tmpset;
+ }
+
+ return INLINE_SYSCALL (sigtimedwait, 3, set, info, timeout);
+}
+
+int
+__sigtimedwait (const sigset_t *set, siginfo_t *info,
+ const struct timespec *timeout)
+{
+ if (SINGLE_THREAD_P)
+ return __sigtimedwait_not_cancel (set, info, timeout);
+
+ int oldtype = LIBC_CANCEL_ASYNC ();
+
+ int res = __sigtimedwait_not_cancel (set, info, timeout);
+
+ LIBC_CANCEL_RESET (oldtype);
+
+ return res;
+}
+
+libc_hidden_def (__sigtimedwait)
+weak_alias (__sigtimedwait, sigtimedwait)
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sigwait.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sigwait.c
new file mode 100644
index 0000000000..687fb84082
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sigwait.c
@@ -0,0 +1,52 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sysdep-cancel.h>
+#include <signal.h>
+#include <errno.h>
+
+int
+__sigwait (const sigset_t *set, int *sig)
+{
+ /* sigwait returns the errno directly and doesn't touch the
+ global errno value so we need to be careful */
+ int save_errno = errno;
+
+ if (set == NULL || sig == NULL)
+ return EINVAL;
+
+ /* sigtimedwait is cancelable so don't implement cancellation here;
+ we also don't check for SIGCANCEL since we do that in sigtimedwait */
+ int result = sigtimedwait (set, NULL, NULL);
+ if (result == -1)
+ {
+ result = errno;
+ __set_errno (save_errno);
+ }
+ else
+ {
+ *sig = result;
+ }
+
+ return 0;
+}
+
+libc_hidden_def (__sigwait)
+weak_alias (__sigwait, sigwait)
+LIBC_CANCEL_HANDLED (); /* handled by sigtimedwait */
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sigwaitinfo.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sigwaitinfo.c
new file mode 100644
index 0000000000..c64f824908
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sigwaitinfo.c
@@ -0,0 +1,34 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sysdep-cancel.h>
+#include <errno.h>
+#include <signal.h>
+
+int
+__sigwaitinfo (const sigset_t *set, siginfo_t *info)
+{
+ /* sigtimedwait is cancelable so don't implement cancellation here;
+ we also don't do any checks since we do that in sigtimedwait */
+ return __sigtimedwait (set, info, NULL);
+}
+
+libc_hidden_def (__sigwaitinfo)
+weak_alias (__sigwaitinfo, sigwaitinfo)
+LIBC_CANCEL_HANDLED (); /* handled by sigtimedwait */
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sleep.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sleep.c
new file mode 100644
index 0000000000..6138bd0aba
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sleep.c
@@ -0,0 +1,35 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <time.h>
+
+unsigned int
+__sleep (unsigned int seconds)
+{
+ struct timespec ts;
+
+ ts.tv_sec = seconds;
+ ts.tv_nsec = 0;
+ if (__nanosleep(&ts, &ts) == 0)
+ return 0;
+ else
+ return (unsigned int)ts.tv_sec + (ts.tv_nsec >= 500000000L);
+}
+
+weak_alias (__sleep, sleep)
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/socket.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/socket.c
new file mode 100644
index 0000000000..0374ba38a4
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/socket.c
@@ -0,0 +1,35 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <inline-syscall.h>
+#include <sys/socket.h>
+
+extern int _so_socket (int domain, int type, int protocol, char *devpath,
+ int version);
+
+int
+__socket (domain, type, protocol)
+ int domain;
+ int type;
+ int protocol;
+{
+ return _so_socket (domain, type, protocol, NULL, SOV_XPG4_2);
+}
+
+weak_alias (__socket, socket)
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/socketP.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/socketP.h
new file mode 100644
index 0000000000..d7adfa5770
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/socketP.h
@@ -0,0 +1,33 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _SOCKET_PRIV_H
+#define _SOCKET_PRIV_H
+
+#include <atomic.h>
+
+/* Helper code to handle MSG_NOSIGNAL. */
+
+extern __thread unsigned int __sigpipe_disabled;
+#define SIGPIPE_DISABLE_DEFINE __thread unsigned int __sigpipe_disabled = 0;
+#define SIGPIPE_DISABLE atomic_increment (&__sigpipe_disabled)
+#define SIGPIPE_ENABLE atomic_decrement (&__sigpipe_disabled)
+#define SIGPIPE_IS_DISABLED (__sigpipe_disabled != 0)
+
+#endif /* _SOCKET_PRIV_H */
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/socketpair.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/socketpair.c
new file mode 100644
index 0000000000..f92a1dfc21
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/socketpair.c
@@ -0,0 +1,73 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <inline-syscall.h>
+#include <sys/socket.h>
+#include <unistd.h>
+#include <errno.h>
+#include <not-cancel.h>
+
+extern int _so_socketpair (int fds[2]);
+
+int
+socketpair (domain, type, protocol, fds)
+ int domain;
+ int type;
+ int protocol;
+ int fds[2];
+{
+ int sock0 = -1;
+ int sock1 = -1;
+ int res = -1;
+
+ if (fds == NULL)
+ {
+ __set_errno(EINVAL);
+ return -1;
+ }
+
+ /* create the pair of sockets */
+ sock0 = __socket (domain, type, protocol);
+ if (sock0 != -1)
+ {
+ sock1 = __socket (domain, type, protocol);
+ if(sock1 != -1)
+ {
+ fds[0] = sock0;
+ fds[1] = sock1;
+ res = _so_socketpair (fds);
+ if (res != -1)
+ {
+ /* check if new sockets were created */
+ if (fds[0] == sock0)
+ sock0 = -1;
+ if (fds[1] == sock1)
+ sock1 = -1;
+ }
+ }
+ }
+
+ /* close any sockets that were created by failed calls or duplicated */
+ if (sock0 != -1)
+ close_not_cancel_no_status (sock0);
+ if (sock1 != -1)
+ close_not_cancel_no_status (sock1);
+
+ return res;
+}
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/speed.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/speed.c
new file mode 100644
index 0000000000..4ff3001471
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/speed.c
@@ -0,0 +1,89 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <stddef.h>
+#include <errno.h>
+#include <termios.h>
+
+/* Solaris stores the standard input and output baud rates in bits
+ 16-19 and 0-3, respectively. If an extension speed is used then we
+ set CIBAUDEXT and CBAUDEXT for input and output, respectively, and
+ shift the speed left/right by 4 bits, for set/get, respectively. */
+
+speed_t
+cfgetospeed (termios_p)
+ const struct termios *termios_p;
+{
+ speed_t speed = (termios_p->c_cflag & CBAUD);
+ if (termios_p->c_cflag & CBAUDEXT)
+ speed <<= 4;
+ return speed;
+}
+
+speed_t
+cfgetispeed (termios_p)
+ const struct termios *termios_p;
+{
+ speed_t speed = (termios_p->c_cflag & CBAUD) >> 16;
+ if (termios_p->c_cflag & CBAUDEXT)
+ speed <<= 4;
+ return speed;
+}
+
+int
+cfsetospeed (termios_p, speed)
+ struct termios *termios_p;
+ speed_t speed;
+{
+ if (speed > __MAX_BAUD)
+ {
+ __set_errno(EINVAL);
+ return -1;
+ }
+
+ termios_p->c_cflag &= ~(CBAUDEXT | CBAUD);
+ if (speed > CBAUD)
+ termios_p->c_cflag |= CBAUDEXT | (speed >> 4);
+ else
+ termios_p->c_cflag |= speed;
+
+ return 0;
+}
+libc_hidden_def (cfsetospeed)
+
+int
+cfsetispeed (termios_p, speed)
+ struct termios *termios_p;
+ speed_t speed;
+{
+ if (speed > __MAX_BAUD)
+ {
+ __set_errno(EINVAL);
+ return -1;
+ }
+
+ termios_p->c_cflag &= ~(CIBAUDEXT | CIBAUD);
+ if (speed > CBAUD)
+ termios_p->c_cflag |= CIBAUDEXT | ((speed >> 4) << 16);
+ else
+ termios_p->c_cflag |= (speed << 16);
+
+ return 0;
+}
+libc_hidden_def (cfsetispeed)
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/stack_getbounds.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/stack_getbounds.c
new file mode 100644
index 0000000000..b138e8979a
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/stack_getbounds.c
@@ -0,0 +1,34 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <ucontext.h>
+#include <string.h>
+
+int stack_getbounds (stack_t *sp)
+{
+ /* We can get the stack base and size from getcontext. */
+ ucontext_t ctx;
+ int ret = getcontext (&ctx);
+ if (ret != 0)
+ return ret;
+
+ memcpy (sp, &ctx.uc_stack, sizeof (stack_t));
+ return 0;
+
+}
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/statfs.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/statfs.c
new file mode 100644
index 0000000000..7a9ae92250
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/statfs.c
@@ -0,0 +1,8 @@
+#define STATFS_FUNC __statfs
+#define STATFS_STRUCT struct statfs
+#define STATVFS_FUNC __statvfs
+#define STATVFS_STRUCT struct statvfs
+#define STATFS_ARG const char *
+#include "sysdeps/unix/sysv/solaris2/kopensolaris-gnu/statfs_common.c"
+libc_hidden_def (__statfs)
+weak_alias (__statfs, statfs)
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/statfs64.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/statfs64.c
new file mode 100644
index 0000000000..9a066b3477
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/statfs64.c
@@ -0,0 +1,7 @@
+#define STATFS_FUNC __statfs64
+#define STATFS_STRUCT struct statfs64
+#define STATVFS_FUNC __statvfs64
+#define STATVFS_STRUCT struct statvfs64
+#define STATFS_ARG const char *
+#include "sysdeps/unix/sysv/solaris2/kopensolaris-gnu/statfs_common.c"
+weak_alias (__statfs64, statfs64)
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/statfs_common.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/statfs_common.c
new file mode 100644
index 0000000000..ab1f5a2278
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/statfs_common.c
@@ -0,0 +1,52 @@
+/* statfs -- Return information about the filesystem on which FILE resides.
+ Copyright (C) 1996, 1997, 2002, 2009 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <sys/statfs.h>
+#include <sys/statvfs.h>
+#include <sys/fstyp.h>
+#include <stddef.h>
+
+/* Return information about the filesystem on which FILE resides. */
+int
+STATFS_FUNC (STATFS_ARG file, STATFS_STRUCT *buf)
+{
+ STATVFS_STRUCT vbuf;
+ int res = STATVFS_FUNC (file, &vbuf);
+ if (res != 0)
+ return -1;
+
+ int fsid = sysfs (GETFSIND, vbuf.f_basetype);
+ if (fsid == -1)
+ return -1;
+
+ buf->f_type = 0;
+ buf->f_bsize = vbuf.f_bsize;
+ buf->f_blocks = vbuf.f_blocks;
+ buf->f_bfree = vbuf.f_bfree;
+ buf->f_bavail = vbuf.f_bavail;
+ buf->f_files = vbuf.f_files;
+ buf->f_ffree = vbuf.f_ffree;
+ buf->f_fsid = fsid;
+ buf->f_namelen = vbuf.f_namemax;
+ buf->f_frsize = vbuf.f_frsize;
+ memset (&buf->f_spare, 0, sizeof (buf->f_spare));
+
+ return 0;
+}
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/swapoff.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/swapoff.c
new file mode 100644
index 0000000000..fd03701bdf
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/swapoff.c
@@ -0,0 +1,32 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sys/swap.h>
+#include <sys/uadmin.h>
+#include <errno.h>
+
+int
+swapoff (const char *path)
+{
+ swapres_t sr;
+ sr.sr_name = (char*)path;
+ sr.sr_start = 0;
+ sr.sr_length = 0;
+ return uadmin (A_SWAPCTL, SC_REMOVE, (uintptr_t)&sr);
+}
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/swapon.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/swapon.c
new file mode 100644
index 0000000000..3ddbf017c7
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/swapon.c
@@ -0,0 +1,33 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sys/swap.h>
+#include <sys/uadmin.h>
+#include <errno.h>
+
+int
+swapon (path)
+ const char *path;
+{
+ swapres_t sr;
+ sr.sr_name = (char*)path;
+ sr.sr_start = 0;
+ sr.sr_length = 0;
+ return uadmin (A_SWAPCTL, SC_ADD, (uintptr_t)&sr);
+}
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/acct.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/acct.h
new file mode 100644
index 0000000000..32fef42905
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/acct.h
@@ -0,0 +1,62 @@
+/* Declarations of privilege functions and types.
+ Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _SYS_ACCT_H
+#define _SYS_ACCT_H
+
+#include <features.h>
+#include <sys/types.h>
+#include <sys/types32.h>
+
+#define AFORK 0001
+#define ASU 0002
+#ifdef SUN_SRC_COMPAT
+# define ACOMPAT 0004
+# define ACORE 0010
+# define AXSIG 0020
+#endif
+#define AEXPND 0040
+#define ACCTF 0300
+
+typedef unsigned short comp_t;
+
+struct acct
+ {
+ char ac_flag;
+ char ac_stat;
+ uid32_t ac_uid;
+ gid32_t ac_gid;
+ dev32_t ac_tty;
+ time32_t ac_btime;
+ comp_t ac_utime;
+ comp_t ac_stime;
+ comp_t ac_etime;
+ comp_t ac_mem;
+ comp_t ac_io;
+ comp_t ac_rw;
+ char ac_comm[8];
+};
+
+__BEGIN_DECLS
+
+extern int acct (const char *);
+
+__END_DECLS
+
+#endif /* _SYS_ACCT_H */
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/acctctl.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/acctctl.h
new file mode 100644
index 0000000000..f3664c156d
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/acctctl.h
@@ -0,0 +1,155 @@
+/* Declarations of acctlctl function and types.
+ Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _SYS_ACCTCTL_H
+#define _SYS_ACCTCTL_H
+
+#include <sys/types.h>
+#include <features.h>
+
+#define AC_PROC (0x1 << 28)
+#define AC_TASK (0x2 << 28)
+#define AC_FLOW (0x4 << 28)
+#define AC_MODE(x) ((x) & 0xf0000000)
+
+#define AC_FILE_SET 0x01
+#define AC_FILE_GET 0x02
+#define AC_RES_SET 0x04
+#define AC_RES_GET 0x08
+#define AC_STATE_SET 0x10
+#define AC_STATE_GET 0x20
+#define AC_OPTION(x) ((x) & 0x0fffffff)
+
+enum
+ {
+ AC_NONE = 0,
+#define AC_NONE AC_NONE
+ AC_PROC_PID = 1,
+#define AC_PROC_PID AC_PROC_PID
+ AC_PROC_UID = 2,
+#define AC_PROC_UID AC_PROC_UID
+ AC_PROC_GID = 3,
+#define AC_PROC_GID AC_PROC_GID
+ AC_PROC_PROJID = 4,
+#define AC_PROC_PROJID AC_PROC_PROJID
+ AC_PROC_TASKID = 5,
+#define AC_PROC_TASKID AC_PROC_TASKID
+ AC_PROC_CPU = 6,
+#define AC_PROC_CPU AC_PROC_CPU
+ AC_PROC_TIME = 7,
+#define AC_PROC_TIME AC_PROC_TIME
+ AC_PROC_COMMAND = 8,
+#define AC_PROC_COMMAND AC_PROC_COMMAND
+ AC_PROC_TTY = 9,
+#define AC_PROC_TTY AC_PROC_TTY
+ AC_PROC_HOSTNAME = 10,
+#define AC_PROC_HOSTNAME AC_PROC_HOSTNAME
+ AC_PROC_MICROSTATE = 11,
+#define AC_PROC_MICROSTATE AC_PROC_MICROSTATE
+ AC_PROC_FLAG = 12,
+#define AC_PROC_FLAG AC_PROC_FLAG
+ AC_PROC_ANCPID = 13,
+#define AC_PROC_ANCPID AC_PROC_ANCPID
+ AC_PROC_WAIT_STATUS = 14,
+#define AC_PROC_WAIT_STATUS AC_PROC_WAIT_STATUS
+ AC_PROC_ZONENAME = 15,
+#define AC_PROC_ZONENAME AC_PROC_ZONENAME
+ AC_PROC_MEM = 16,
+#define AC_PROC_MEM AC_PROC_MEM
+ AC_PROC_MAX_RES = 17
+#define AC_PROC_MAX_RES AC_PROC_MAX_RES
+ };
+
+enum
+ {
+ AC_TASK_TASKID = 1,
+#define AC_TASK_TASKID AC_TASK_TASKID
+ AC_TASK_PROJID = 2,
+#define AC_TASK_PROJID AC_TASK_PROJID
+ AC_TASK_CPU = 3,
+#define AC_TASK_CPU AC_TASK_CPU
+ AC_TASK_TIME = 4,
+#define AC_TASK_TIME AC_TASK_TIME
+ AC_TASK_HOSTNAME = 5,
+#define AC_TASK_HOSTNAME AC_TASK_HOSTNAME
+ AC_TASK_MICROSTATE = 6,
+#define AC_TASK_MICROSTATE AC_TASK_MICROSTATE
+ AC_TASK_ANCTASKID = 7,
+#define AC_TASK_ANCTASKID AC_TASK_ANCTASKID
+ AC_TASK_ZONENAME = 8
+#define AC_TASK_ZONENAME AC_TASK_ZONENAME
+#define A_TASK_MAX_RES AC_TASK_ZONENAME
+ };
+
+enum
+ {
+ AC_FLOW_SADDR = 1,
+#define AC_FLOW_SADDR AC_FLOW_SADDR
+ AC_FLOW_DADDR = 2,
+#define AC_FLOW_DADDR AC_FLOW_DADDR
+ AC_FLOW_SPORT = 3,
+#define AC_FLOW_SPORT AC_FLOW_DPORT
+ AC_FLOW_DPORT = 4,
+#define AC_FLOW_DPORT AC_FLOW_DPORT
+ AC_FLOW_PROTOCOL = 5,
+#define AC_FLOW_PROTOCOL AC_FLOW_PROTOCOL
+ AC_FLOW_DSFIELD = 6,
+#define AC_FLOW_DSFIELD AC_FLOW_DSFIELD
+ AC_FLOW_CTIME = 7,
+#define AC_FLOW_CTIME AC_FLOW_CTIME
+ AC_FLOW_LSEEN = 8,
+#define AC_FLOW_LSEEN AC_FLOW_LSEEN
+ AC_FLOW_NBYTES = 9,
+#define AC_FLOW_NBYTES AC_FLOW_NBYTES
+ AC_FLOW_NPKTS = 10,
+#define AC_FLOW_NPKTS AC_FLOW_NPKTS
+ AC_FLOW_PROJID = 11,
+#define AC_FLOW_PROJID AC_FLOW_PROJID
+ AC_FLOW_UID = 12,
+#define AC_FLOW_UID AC_FLOW_UID
+ AC_FLOW_ANAME = 13
+#define AC_FLOW_ANAME AC_FLOW_ANAME
+#define AC_FLOW_MAX_RES AC_FLOW_ANAME
+ };
+
+#define AC_MAX_RES_TMP MAX (AC_PROC_MAX_RES, AC_TASK_MAX_RES)
+#define AC_MAX_RES MAX (AC_MAX_RES_TMP, AC_FLOW_MAX_RES)
+#define AC_MASK_SZ BT_BITOUL (AC_MAX_RES + 1)
+
+enum
+ {
+ AC_OFF = 0,
+#define AC_OFF AC_OFF
+ AC_ON = 1
+#define AC_ON AC_ON
+ };
+
+typedef struct ac_res
+ {
+ int ar_id;
+ int ar_state;
+ } ac_res_t;
+
+__BEGIN_DECLS
+
+extern int acctctl (int, void *, size_t);
+
+__END_DECLS
+
+#endif /* _SYS_ACCTCTL_H */
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/acl.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/acl.h
new file mode 100644
index 0000000000..5087dece60
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/acl.h
@@ -0,0 +1,207 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _SYS_ACL_H
+#define _SYS_ACL_H
+
+#include <features.h>
+#include <sys/types.h>
+
+#define ACL_IS_TRIVIAL 0x10000
+#define ACL_IS_DIR 0x20000
+
+typedef enum acl_type
+ {
+ ACLENT_T = 0,
+ ACE_T = 1
+ } acl_type_t;
+
+struct acl_info
+ {
+ acl_type_t acl_type;
+ int acl_cnt;
+ int acl_entry_size;
+ int acl_flags;
+ void *acl_aclp;
+ };
+
+/* cmd values. */
+#define GETACL 1
+#define SETACL 2
+#define GETACLCNT 3
+#define ACE_GETACL 4
+#define ACE_SETACL 5
+#define ACE_GETACLCNT 6
+
+/* Used by UFS. */
+typedef struct acl
+{
+ int a_type;
+ unsigned int a_id;
+ o_mode_t a_perm;
+} aclent_t;
+
+/* Used by ZFS and NFSv4. */
+typedef struct ace {
+ unsigned int a_who;
+ uint32_t a_access_mask;
+ uint16_t a_flags;
+ uint16_t a_type;
+} ace_t;
+
+typedef struct acl_info acl_t;
+
+#define MIN_ACL_ENTRIES 4
+#define MAX_ACL_ENTRIES 1024
+
+/* aclent_t a_type values. */
+#define USER_OBJ 0x01
+#define USER 0x02
+#define GROUP_OBJ 0x04
+#define GROUP 0x08
+#define CLASS_OBJ 0x10
+#define OTHER_OBJ 0x20
+#define ACL_DEFAULT 0x1000
+#define DEF_USER_OBJ (ACL_DEFAULT | USER_OBJ)
+#define DEF_USER (ACL_DEFAULT | USER)
+#define DEF_GROUP_OBJ (ACL_DEFAULT | GROUP_OBJ)
+#define DEF_GROUP (ACL_DEFAULT | GROUP)
+#define DEF_CLASS_OBJ (ACL_DEFAULT | CLASS_OBJ)
+#define DEF_OTHER_OBJ (ACL_DEFAULT | OTHER_OBJ)
+
+/* ace_t a_access_mask values. */
+#define ACE_READ_DATA 0x00000001
+#define ACE_LIST_DIRECTORY 0x00000001
+#define ACE_WRITE_DATA 0x00000002
+#define ACE_ADD_FILE 0x00000002
+#define ACE_APPEND_DATA 0x00000004
+#define ACE_ADD_SUBDIRECTORY 0x00000004
+#define ACE_READ_NAMED_ATTRS 0x00000008
+#define ACE_WRITE_NAMED_ATTRS 0x00000010
+#define ACE_EXECUTE 0x00000020
+#define ACE_DELETE_CHILD 0x00000040
+#define ACE_READ_ATTRIBUTES 0x00000080
+#define ACE_WRITE_ATTRIBUTES 0x00000100
+#define ACE_DELETE 0x00010000
+#define ACE_READ_ACL 0x00020000
+#define ACE_WRITE_ACL 0x00040000
+#define ACE_WRITE_OWNER 0x00080000
+#define ACE_SYNCHRONIZE 0x00100000
+#define ACE_ALL_PERMS (ACE_READ_DATA | ACE_LIST_DIRECTORY | \
+ ACE_WRITE_DATA | ACE_ADD_FILE | ACE_APPEND_DATA | \
+ ACE_ADD_SUBDIRECTORY | ACE_READ_NAMED_ATTRS | ACE_WRITE_NAMED_ATTRS | \
+ ACE_EXECUTE | ACE_DELETE_CHILD | ACE_READ_ATTRIBUTES | \
+ ACE_WRITE_ATTRIBUTES | ACE_DELETE | ACE_READ_ACL | ACE_WRITE_ACL | \
+ ACE_WRITE_OWNER | ACE_SYNCHRONIZE)
+#define ACE_READ_PERMS (ACE_READ_DATA | ACE_READ_ACL | ACE_READ_ATTRIBUTES | \
+ ACE_READ_NAMED_ATTRS)
+#define ACE_WRITE_PERMS (ACE_WRITE_DATA | ACE_APPEND_DATA | \
+ ACE_WRITE_ATTRIBUTES | ACE_WRITE_NAMED_ATTRS)
+#define ACE_MODIFY_PERMS (ACE_READ_DATA | ACE_LIST_DIRECTORY | \
+ ACE_WRITE_DATA | ACE_ADD_FILE | ACE_APPEND_DATA | \
+ ACE_ADD_SUBDIRECTORY | ACE_READ_NAMED_ATTRS | ACE_WRITE_NAMED_ATTRS | \
+ ACE_EXECUTE | ACE_DELETE_CHILD | ACE_READ_ATTRIBUTES | \
+ ACE_WRITE_ATTRIBUTES | ACE_DELETE | ACE_READ_ACL | ACE_SYNCHRONIZE)
+
+/* ace_t a_flags values. */
+#define ACE_FILE_INHERIT_ACE 0x0001
+#define ACE_DIRECTORY_INHERIT_ACE 0x0002
+#define ACE_NO_PROPAGATE_INHERIT_ACE 0x0004
+#define ACE_INHERIT_ONLY_ACE 0x0008
+#define ACE_SUCCESSFUL_ACCESS_ACE_FLAG 0x0010
+#define ACE_FAILED_ACCESS_ACE_FLAG 0x0020
+#define ACE_IDENTIFIER_GROUP 0x0040
+#define ACE_INHERITED_ACE 0x0080
+#define ACE_OWNER 0x1000
+#define ACE_GROUP 0x2000
+#define ACE_EVERYONE 0x4000
+#define ACE_NFSV4_SUP_FLAGS (ACE_FILE_INHERIT_ACE | \
+ ACE_DIRECTORY_INHERIT_ACE | ACE_NO_PROPAGATE_INHERIT_ACE | \
+ ACE_INHERIT_ONLY_ACE | ACE_IDENTIFIER_GROUP)
+#define ACE_TYPE_FLAGS (ACE_OWNER | ACE_GROUP | ACE_EVERYONE | \
+ ACE_IDENTIFIER_GROUP)
+#define ACE_INHERIT_FLAGS (ACE_FILE_INHERIT_ACE | \
+ ACE_DIRECTORY_INHERIT_ACE | ACE_NO_PROPAGATE_INHERIT_ACE | \
+ ACE_INHERIT_ONLY_ACE)
+
+/* ace_t a_type values. */
+#define ACE_ACCESS_ALLOWED_ACE_TYPE 0
+#define ACE_ACCESS_DENIED_ACE_TYPE 1
+#define ACE_SYSTEM_AUDIT_ACE_TYPE 2
+#define ACE_SYSTEM_ALARM_ACE_TYPE 3
+
+#define ACL_AUTO_INHERIT 0x0001
+#define ACL_PROTECTED 0x0002
+#define ACL_DEFAULTED 0x0004
+#define ACL_FLAGS_ALL (ACL_AUTO_INHERIT | ACL_PROTECTED | \
+ ACL_DEFAULTED)
+
+#define UFSD_FREE '0'
+#define UFSD_ACL '1'
+#define UFSD_DFACL '2'
+#define ACE_ACL '3'
+
+#define ACL_NO_TRIVIAL 0x2
+
+#define ACL_APPEND_ID 0x01
+#define ACL_COMPACT_FMT 0x02
+#define ACL_NORESOLVE 0x04
+#define ACL_SID_FMT 0x08
+
+#define GRP_ERROR 1
+#define USER_ERROR 2
+#define OTHER_ERROR 3
+#define CLASS_ERROR 4
+#define DUPLICATE_ERROR 5
+#define MISS_ERROR 6
+#define MEM_ERROR 7
+#define ENTRY_ERROR 8
+
+#define EACL_GRP_ERROR GRP_ERROR
+#define EACL_USER_ERROR USER_ERROR
+#define EACL_OTHER_ERROR OTHER_ERROR
+#define EACL_CLASS_ERROR CLASS_ERROR
+#define EACL_DUPLICATE_ERROR DUPLICATE_ERROR
+#define EACL_MISS_ERROR MISS_ERROR
+#define EACL_MEM_ERROR MEM_ERROR
+#define EACL_ENTRY_ERROR ENTRY_ERROR
+#define EACL_INHERIT_ERROR 9
+#define EACL_FLAGS_ERROR 10
+#define EACL_PERM_MASK_ERROR 11
+#define EACL_COUNT_ERROR 12
+#define EACL_INVALID_SLOT 13
+#define EACL_NO_ACL_ENTRY 14
+#define EACL_DIFF_TYPE 15
+#define EACL_INVALID_USER_GROUP 16
+#define EACL_INVALID_STR 17
+#define EACL_FIELD_NOT_BLANK 18
+#define EACL_INVALID_ACCESS_TYPE 19
+#define EACL_UNKNOWN_DATA 20
+#define EACL_MISSING_FIELDS 21
+#define EACL_INHERIT_NOTDIR 22
+
+__BEGIN_DECLS
+
+extern int acl(char *__pathp, int __cmd, int __nentries, void *__aclbufp);
+
+extern int facl(int __fildes, int __cmd, int __nentries, void *__aclbufp);
+
+__END_DECLS
+
+#endif /* _SYS_ACL_H */
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/atomic.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/atomic.h
new file mode 100644
index 0000000000..86ca630192
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/atomic.h
@@ -0,0 +1,74 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _SYS_ATOMIC_H
+#define _SYS_ATOMIC_H
+
+#include <features.h>
+#include <sys/types.h>
+#include <stdint.h>
+
+__BEGIN_DECLS
+
+extern void membar_enter (void);
+extern void membar_exit (void);
+extern void membar_producer (void);
+extern void membar_consumer (void);
+
+extern void atomic_add_8 (volatile uint8_t *, int8_t);
+extern void atomic_add_char (volatile unsigned char *, signed char);
+extern void atomic_add_16 (volatile uint16_t *, int16_t);
+extern void atomic_add_short (volatile unsigned short *, short);
+extern void atomic_add_32 (volatile uint32_t *, int32_t);
+extern void atomic_add_int (volatile unsigned int *, int);
+extern void atomic_add_long (volatile unsigned long *, long);
+extern void atomic_add_64 (volatile uint64_t *, int64_t);
+extern void atomic_add_ptr (volatile void *, ssize_t);
+
+extern uint8_t atomic_add_8_nv (volatile uint8_t *, int8_t);
+extern unsigned char atomic_add_char_nv (volatile unsigned char *, signed char);
+extern uint16_t atomic_add_16_nv (volatile uint16_t *, int16_t);
+extern unsigned short atomic_add_short_nv (volatile unsigned short *, short);
+extern uint32_t atomic_add_32_nv (volatile uint32_t *, int32_t);
+extern unsigned int atomic_add_int_nv (volatile unsigned int *, int);
+extern unsigned long atomic_add_long_nv (volatile unsigned long *, long);
+extern uint64_t atomic_add_64_nv (volatile uint64_t *, int64_t);
+extern void * atomic_add_ptr_nv (volatile void *, ssize_t);
+
+extern void atomic_dec_8 (volatile uint8_t *target);
+extern void atomic_dec_uchar (volatile unsigned char *target);
+extern void atomic_dec_16 (volatile uint16_t *target);
+extern void atomic_dec_ushort (volatile unsigned short *target);
+extern void atomic_dec_32 (volatile uint32_t *target);
+extern void atomic_dec_uint (volatile unsigned int *target);
+extern void atomic_dec_ulong (volatile unsigned long *target);
+extern void atomic_dec_64 (volatile uint64_t *target);
+
+extern uint8_t atomic_dec_8_nv (volatile uint8_t *target);
+extern unsigned char atomic_dec_uchar_nv (volatile unsigned char *target);
+extern uint16_t atomic_dec_16_nv (volatile uint16_t *target);
+extern unsigned short atomic_dec_ushort_nv (volatile unsigned short *target);
+extern uint32_t atomic_dec_32_nv (volatile uint32_t *target);
+extern unsigned int atomic_dec_uint_nv (volatile unsigned int *target);
+extern unsigned long atomic_dec_ulong_nv (volatile unsigned long *target);
+extern uint64_t atomic_dec_64_nv (volatile uint64_t *target);
+
+__END_DECLS
+
+#endif /* _SYS_ATOMIC_H */
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/auxv.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/auxv.h
new file mode 100644
index 0000000000..6d3b7fa3c0
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/auxv.h
@@ -0,0 +1,53 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _SYS_AUXV_H
+#define _SYS_AUXV_H
+
+#ifndef __ASSEMBLER__
+typedef struct
+ {
+ int a_type;
+ union
+ {
+ long a_val;
+ void *a_ptr;
+ void (*a_fcn)(void);
+ } a_un;
+ } auxv_t;
+#endif
+
+#define AT_SUN_IFLUSH 2010
+#define AT_SUN_CPU 2011
+
+#define AT_SUN_EXECNAME 2014
+#define AT_SUN_MMU 2015
+#define AT_SUN_LDDATA 2016
+#define AT_SUN_AUXFLAGS 2017
+#define AT_SUN_EMULATOR 2018
+#define AT_SUN_BRANDNAME 2019
+#define AT_SUN_BRAND_AUX1 2020
+#define AT_SUN_BRAND_AUX2 2021
+#define AT_SUN_BRAND_AUX3 2022
+
+/* Passed in AT_SUN_AUXFLAGS. */
+#define AF_SUN_SETUGID 0x01
+#define AF_SUN_HWCAPVERIFY 0x02
+#define AF_SUN_NOPLM 0x04
+
+#endif /* _SYS_AUXV_H */
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/byteorder.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/byteorder.h
new file mode 100644
index 0000000000..9db7b75806
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/byteorder.h
@@ -0,0 +1,47 @@
+/* Declarations of zone functions and types.
+ Copyright (C) 2009 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _SYS_BYTEORDER_H
+#define _SYS_BYTEORDER_H
+
+#include <byteswap.h>
+#include <features.h>
+#include <sys/types.h>
+
+#define BSWAP_8(x) __bswap_8(x)
+#define BSWAP_16(x) __bswap_16(x)
+#define BSWAP_32(x) __bswap_32(x)
+#define BSWAP_64(x) __bswap_64(x)
+
+extern uint64_t htonll (uint64_t __hostlonglong)
+ __THROW __attribute__ ((__const__));
+extern uint64_t ntohll (uint64_t __netlonglong)
+ __THROW __attribute__ ((__const__));
+
+#ifdef __OPTIMIZE__
+# if __BYTE_ORDER == __BIG_ENDIAN
+# define ntohll(x) (x)
+# else
+# if __BYTE_ORDER == __LITTLE_ENDIAN
+# define ntohll(x) __bswap_64 (x)
+# endif
+# endif
+#endif
+
+#endif /* _SYS_BYTEORDER_H */
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/corectl.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/corectl.h
new file mode 100644
index 0000000000..0b00da4070
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/corectl.h
@@ -0,0 +1,76 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _SYS_CORECTL_H
+#define _SYS_CORECTL_H
+
+#include <sys/types.h>
+#include <features.h>
+
+typedef unsigned long long core_content_t;
+
+/* Options. */
+#define CC_GLOBAL_PATH 0x01
+#define CC_PROCESS_PATH 0x02
+#define CC_GLOBAL_SETID 0x04
+#define CC_PROCESS_SETID 0x08
+#define CC_GLOBAL_LOG 0x10
+
+/* core_content_t values. */
+#define CC_CONTENT_STACK 0x0001ULL
+#define CC_CONTENT_HEAP 0x0002ULL
+#define CC_CONTENT_SHFILE 0x0004ULL
+#define CC_CONTENT_SHANON 0x0008ULL
+#define CC_CONTENT_TEXT 0x0010ULL
+#define CC_CONTENT_DATA 0x0020ULL
+#define CC_CONTENT_RODATA 0x0040ULL
+#define CC_CONTENT_ANON 0x0080ULL
+#define CC_CONTENT_SHM 0x0100ULL
+#define CC_CONTENT_ISM 0x0200ULL
+#define CC_CONTENT_DISM 0x0400ULL
+#define CC_CONTENT_CTF 0x0800ULL
+#define CC_CONTENT_SYMTAB 0x1000ULL
+#define CC_CONTENT_ALL 0x1FFFULL
+#define CC_CONTENT_NONE 0x0000ULL
+#define CC_CONTENT_DEFAULT \
+ (CC_CONTENT_STACK | CC_CONTENT_HEAP | CC_CONTENT_ISM | \
+ CC_CONTENT_DISM | CC_CONTENT_SHM | CC_CONTENT_SHANON | \
+ CC_CONTENT_TEXT | CC_CONTENT_DATA | CC_CONTENT_RODATA | \
+ CC_CONTENT_ANON | CC_CONTENT_CTF)
+#define CC_CONTENT_INVALID (-1ULL)
+
+__BEGIN_DECLS
+
+extern int core_set_options (int);
+extern int core_get_options (void);
+extern int core_set_global_path (const char *, size_t);
+extern int core_get_global_path (char *, size_t);
+extern int core_set_default_path (const char *, size_t);
+extern int core_get_default_path (char *, size_t);
+extern int core_set_process_path (const char *, size_t, pid_t);
+extern int core_get_process_path (char *, size_t, pid_t);
+extern int core_set_global_content (const core_content_t *);
+extern int core_get_global_content (core_content_t *);
+extern int core_set_default_content (const core_content_t *);
+extern int core_get_default_content (core_content_t *);
+extern int core_set_process_content (const core_content_t *, pid_t);
+extern int core_get_process_content (core_content_t *, pid_t);
+
+__END_DECLS
+
+#endif /* _SYS_CORECTL_H */
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/dirent.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/dirent.h
new file mode 100644
index 0000000000..d66bbdf7b6
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/dirent.h
@@ -0,0 +1 @@
+#include <dirent.h>
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/door.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/door.h
new file mode 100644
index 0000000000..7673293bc7
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/door.h
@@ -0,0 +1,143 @@
+/* Declarations of privilege functions and types.
+ Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _SYS_DOOR_H
+#define _SYS_DOOR_H
+
+#include <sys/types.h>
+#include <sys/isa_defs.h>
+
+#define DOOR_CREATE 0
+#define DOOR_REVOKE 1
+#define DOOR_INFO 2
+#define DOOR_CALL 3
+#define DOOR_BIND 6
+#define DOOR_UNBIND 7
+#define DOOR_UNREFSYS 8
+#define DOOR_UCRED 9
+#define DOOR_RETURN 10
+#define DOOR_GETPARAM 11
+#define DOOR_SETPARAM 12
+
+#define DOOR_INVAL -1
+#define DOOR_UNREF_DATA ((void *)1)
+
+#define DOOR_QUERY -2
+
+#define DOOR_UNREF 0x01
+#define DOOR_PRIVATE 0x02
+#define DOOR_UNREF_MULTI 0x10
+#define DOOR_REFUSE_DESC 0x40
+#define DOOR_NO_CANCEL 0x80
+
+#define DOOR_LOCAL 0x04
+#define DOOR_REVOKED 0x08
+#define DOOR_IS_UNREF 0x20
+
+#define DOOR_CREATE_MASK (DOOR_UNREF | DOOR_PRIVATE | \
+ DOOR_UNREF_MULTI | DOOR_REFUSE_DESC | DOOR_NO_CANCEL)
+#define DOOR_KI_CREATE_MASK (DOOR_UNREF | DOOR_UNREF_MULTI)
+
+#define DOOR_ATTR_MASK (DOOR_CREATE_MASK | DOOR_LOCAL | DOOR_REVOKED | \
+ DOOR_IS_UNREF)
+
+#define DOOR_DESCRIPTOR 0x10000
+#define DOOR_RELEASE 0x40000
+#define DOOR_DELAY 0x80000
+#define DOOR_UNREF_ACTIVE 0x100000
+
+#define DOOR_PARAM_DESC_MAX 1
+#define DOOR_PARAM_DATA_MAX 2
+#define DOOR_PARAM_DATA_MIN 3
+
+typedef unsigned long long door_ptr_t;
+typedef unsigned int door_attr_t;
+typedef unsigned long long door_id_t;
+
+#if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4
+# pragma pack(4)
+#endif
+
+typedef struct door_info
+ {
+ pid_t di_target;
+ door_ptr_t di_proc;
+ door_ptr_t di_data;
+ door_attr_t di_attributes;
+ door_id_t di_uniquifier;
+ int di_resv[4];
+ } door_info_t;
+
+typedef struct door_desc
+ {
+ door_attr_t d_attributes;
+ union
+ {
+ struct
+ {
+ int d_descriptor;
+ door_id_t d_id;
+ } d_desc;
+ int d_resv[5];
+ } d_data;
+} door_desc_t;
+
+#if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4
+# pragma pack()
+#endif
+
+typedef struct door_cred
+ {
+ uid_t dc_euid;
+ gid_t dc_egid;
+ uid_t dc_ruid;
+ gid_t dc_rgid;
+ pid_t dc_pid;
+ int dc_resv[4];
+ } door_cred_t;
+
+typedef struct door_arg
+ {
+ char *data_ptr;
+ size_t data_size;
+ door_desc_t *desc_ptr;
+ unsigned int desc_num;
+ char *rbuf;
+ size_t rsize;
+ } door_arg_t;
+
+struct door_results
+ {
+ void *cookie;
+ char *data_ptr;
+ size_t data_size;
+ door_desc_t *desc_ptr;
+ size_t desc_num;
+ void (*pc)(void);
+ int nservers;
+ door_info_t *door_info;
+ };
+
+typedef struct door_return_desc
+ {
+ door_desc_t *desc_ptr;
+ unsigned int desc_num;
+ } door_return_desc_t;
+
+#endif /* _SYS_DOOR_H */
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/elf.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/elf.h
new file mode 100644
index 0000000000..d6b6fc9b63
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/elf.h
@@ -0,0 +1,77 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _SYS_ELF_H
+#define _SYS_ELF_H
+
+#include <elf.h>
+
+#define PF_SUNW_FAILURE 0x00100000
+
+#define PN_XNUM 0xFFFF
+
+#define SHT_SUNW_symsort 0x6FFFFFF1
+#define SHT_SUNW_tlssort 0x6FFFFFF2
+#define SHT_SUNW_LDYNSYM 0x6FFFFFF3
+#define SHT_SUNW_dof 0x6FFFFFF4
+#define SHT_SUNW_cap 0x6FFFFFF5
+
+/* TODO: these collide with GNU definitions. */
+#if 0
+#define SHT_SUNW_SIGNATURE 0x6FFFFFF6
+#define SHT_SUNW_ANNOTATE 0x6FFFFFF7
+#define SHT_SUNW_DEBUGSTR 0x6FFFFFF8
+#define SHT_SUNW_DEBUG 0x6FFFFFF9
+#endif
+
+#define SHT_SUNW_verdef SHT_GNU_verdef
+#define SHT_SUNW_verneed SHT_GNU_verneed
+#define SHT_SUNW_versym SHT_GNU_versym
+
+typedef struct
+ {
+ Elf32_Word c_tag;
+ union
+ {
+ Elf32_Word c_val;
+ Elf32_Addr c_ptr;
+ } c_un;
+ } Elf32_Cap;
+
+typedef struct
+ {
+ Elf64_Xword c_tag;
+ union
+ {
+ Elf64_Xword c_val;
+ Elf64_Addr c_ptr;
+ } c_un;
+ } Elf64_Cap;
+
+#define EM_AMD64 EM_X86_64
+
+#define STV_EXPORTED 4
+#define STV_SINGLETON 5
+#define STV_ELIMINATE 6
+
+#define SHN_LOSUNW 0xff3f
+#define SHN_SUNW_IGNORE 0xff3f
+#define SHN_HISUNW 0xff3f
+
+#endif /* _SYS_ELF_H */
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/exacct.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/exacct.h
new file mode 100644
index 0000000000..0c1481fd7a
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/exacct.h
@@ -0,0 +1,134 @@
+/* Declarations of privilege functions and types.
+ Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _SYS_EXACCT_H
+#define _SYS_EXACCT_H
+
+#include <sys/types.h>
+#include <sys/procset.h>
+#include <sys/task.h>
+#include <sys/proc.h>
+#include <features.h>
+
+#define EXACCT_VERSION 1
+
+#define EUP_ALLOC 0x00
+#define EUP_NOALLOC 0x01
+#define EUP_ALLOC_MASK 0x02
+
+#define EW_PARTIAL 0x01
+#define EW_INTERVAL 0x02
+#define EW_FINAL 0x04
+
+enum
+ {
+ EP_RAW = 0,
+#define EP_RAW EP_RAW
+ EP_EXACCT_OBJECT = 1
+#define EP_EXACCT_OBJECT EP_EXACCT_OBJECT
+ };
+
+enum
+ {
+ EXR_OK = 0,
+#define EXR_OK EXR_OK
+ EXR_SYSCALL_FAIL = 1,
+#define EXR_SYSCALL_FAIL EXR_SYSCALL_FAIL
+ EXR_CORRUPT_FILE = 2,
+#define EXR_CORRUPT_FILE EXR_CORRUPT_FILE
+ EXR_EOF = 3,
+#define EXR_EOF EXR_EOF
+ EXR_NO_CREATOR = 4,
+#define EXR_NO_CREATOR EXR_NO_CREATOR
+ EXR_INVALID_BUF = 5,
+#define EXR_INVALID_BUF EXR_INVALID_BUF
+ EXR_NOTSUPP = 6,
+#define EXR_NOTSUPP EXR_NOTSUPP
+ EXR_UNKN_VERSION = 7,
+#define EXR_UNKN_VERSION EXR_UNKN_VERSION
+ EXR_INVALID_OBJ = 8
+#define EXR_INVALID_OBJ EXR_INVALID_OBJ
+ };
+
+typedef enum
+ {
+ EO_ERROR = -1,
+ EO_NONE = 0,
+ EO_GROUP = 1,
+ EO_ITEM = 2
+ } ea_object_type_t;
+
+#define EXACCT_MAX_BUFSIZE (64 * 1024) /* 64 kb */
+
+typedef uint64_t ea_size_t;
+typedef uint32_t ea_catalog_t;
+
+typedef struct ea_item
+ {
+ union
+ {
+ uint8_t ei_u_uint8;
+ uint16_t ei_u_uint16;
+ uint32_t ei_u_uint32;
+ uint64_t ei_u_uint64;
+ double ei_u_double;
+ char *ei_u_string;
+ void *ei_u_object;
+ void *ei_u_raw;
+ } ei_u;
+ ea_size_t ei_size;
+ } ea_item_t;
+#define ei_uint8 ei_u.ei_u_uint8
+#define ei_uint16 ei_u.ei_u_uint16
+#define ei_uint32 ei_u.ei_u_uint32
+#define ei_uint64 ei_u.ei_u_uint64
+#define ei_double ei_u.ei_u_double
+#define ei_string ei_u.ei_u_string
+#define ei_object ei_u.ei_u_object
+#define ei_raw ei_u.ei_u_raw
+
+typedef struct ea_group
+ {
+ uint32_t eg_nobjs;
+ struct ea_object *eg_objs;
+ } ea_group_t;
+
+typedef struct ea_object
+ {
+ ea_object_type_t eo_type;
+ union
+ {
+ ea_group_t eo_u_group;
+ ea_item_t eo_u_item;
+ } eo_u;
+ struct ea_object *eo_next;
+ ea_catalog_t eo_catalog;
+ } ea_object_t;
+#define eo_group eo_u.eo_u_group
+#define eo_item eo_u.eo_u_item
+
+__BEGIN_DECLS
+
+size_t getacct (idtype_t, id_t, void *, size_t);
+int putacct (idtype_t, id_t, void *, size_t, int);
+int wracct (idtype_t, id_t, int);
+
+__END_DECLS
+
+#endif /* _SYS_EXACCT_H */
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/fault.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/fault.h
new file mode 100644
index 0000000000..8a1f9e00ff
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/fault.h
@@ -0,0 +1,42 @@
+/* Declarations of fltset_t.
+ Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _SYS_FAULT_H
+#define _SYS_FAULT_H
+
+typedef struct
+{
+ unsigned int word[4];
+} fltset_t;
+
+#define FLTILL 1
+#define FLTPRIV 2
+#define FLTBPT 3
+#define FLTTRACE 4
+#define FLTACCESS 5
+#define FLTBOUNDS 6
+#define FLTIOVF 7
+#define FLTIZDIV 8
+#define FLTFPE 9
+#define FLTSTACK 10
+#define FLTPAGE 11
+#define FLTWATCH 12
+#define FLTCPCOVF 13
+
+#endif /* _SYS_FAULT_H */
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/feature_tests.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/feature_tests.h
new file mode 100644
index 0000000000..afaba66a7c
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/feature_tests.h
@@ -0,0 +1,79 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _SYS_FEATURE_TESTS
+#define _SYS_FEATURE_TESTS
+
+/* Let glibc do the rest of most of the work. */
+#include <features.h>
+#include <sys/isa_defs.h>
+
+#if defined(_POSIX_SOURCE) && !defined(_POSIX_C_SOURCE)
+# define _POSIX_C_SOURCE 1
+#endif
+
+#if defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE - 0 < 500) && \
+ (_XOPEN_VERSION - 0 < 4) && !defined(_XOPEN_SOURCE_EXTENDED)
+# define _XPG3
+# elif (defined(_XOPEN_SOURCE) && _XOPEN_VERSION - 0 == 4)
+# define _XPG4
+# define _XPG3
+#elif (defined(_XOPEN_SOURCE) && _XOPEN_SOURCE_EXTENDED - 0 == 1)
+# define _XPG4_2
+# define _XPG4
+# define _XPG3
+#elif (_XOPEN_SOURCE - 0 == 500)
+# define _XPG5
+# define _XPG4_2
+# define _XPG4
+# define _XPG3
+#elif (_XOPEN_SOURCE - 0 == 600)
+# define _XPG6
+# define _XPG5
+# define _XPG4_2
+# define _XPG4
+# define _XPG3
+#endif
+
+/* By default the large-file interfaces are available. */
+#if !defined(_XOPEN_SOURCE) && !defined(__USE_LARGEFILE64)
+# define __USE_LARGEFILE64 1
+#endif
+
+/* Sun doesn't leave _FILE_OFFSET_BITS undefined. */
+#ifdef _LP64
+# ifndef _FILE_OFFSET_BITS
+# define _FILE_OFFSET_BITS 64
+# endif
+#else
+# ifndef _FILE_OFFSET_BITS
+# define _FILE_OFFSET_BITS 32
+# endif
+#endif
+
+/* UNIX98 stuff is always available. */
+#ifndef __USE_UNIX98
+# define __USE_UNIX98 1
+#endif
+
+/* __EXTENSIONS__ corresponds to __USE_MISC. */
+#if defined(__USE_MISC) && !defined(__EXTENSIONS__)
+# define __EXTENSIONS__
+#endif
+
+#endif /* _SYS_FEATURE_TESTS */
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/fork.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/fork.h
new file mode 100644
index 0000000000..26703e08ad
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/fork.h
@@ -0,0 +1,36 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _SYS_FORK_H
+#define _SYS_FORK_H
+
+#include <features.h>
+
+#define FORK_NOSIGCHLD 0x01
+#define FORK_WAITPID 0x02
+
+__BEGIN_DECLS
+
+extern pid_t forkx (int);
+extern pid_t forkallx (int);
+extern pid_t vforkx (int);
+
+__END_DECLS
+
+#endif /* _SYS_FORK_H */
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/fsid.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/fsid.h
new file mode 100644
index 0000000000..76229ce040
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/fsid.h
@@ -0,0 +1,29 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _SYS_FSID_H
+#define _SYS_FSID_H
+
+#define S51K "S51K"
+#define PROC "PROC"
+#define DUFST "DUFST"
+#define NFS "NFS"
+#define S52K "S52K"
+
+#endif /* _SYS_FSID_H */
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/fstyp.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/fstyp.h
new file mode 100644
index 0000000000..b03165a988
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/fstyp.h
@@ -0,0 +1,36 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _SYS_FSTYP_H
+#define _SYS_FSTYP_H
+
+#include <features.h>
+#include <sys/statvfs.h>
+
+#define GETFSIND 1
+#define GETFSTYP 2
+#define GETNFSTYP 3
+
+__BEGIN_DECLS
+
+int sysfs (int, ...);
+
+__END_DECLS
+
+#endif /* _SYS_FSTYP_H */
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/instance.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/instance.h
new file mode 100644
index 0000000000..df7781850d
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/instance.h
@@ -0,0 +1,34 @@
+/* Declarations of zone functions and types.
+ Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _SYS_INSTANCE_H
+#define _SYS_INSTANCE_H
+
+#include <features.h>
+
+#define INSTANCE_FILE "/etc/path_to_inst"
+#define INSTANCE_FILE_SUFFIX ".old"
+
+__BEGIN_DECLS
+
+extern int inst_sync (char *pathname, int flags);
+
+__END_DECLS
+
+#endif
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/int_types.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/int_types.h
new file mode 100644
index 0000000000..9a6118bd85
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/int_types.h
@@ -0,0 +1 @@
+#include <stdint.h>
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/inttypes.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/inttypes.h
new file mode 100644
index 0000000000..8049f02f15
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/inttypes.h
@@ -0,0 +1 @@
+#include <inttypes.h>
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/ioccom.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/ioccom.h
new file mode 100644
index 0000000000..6ec92cf732
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/ioccom.h
@@ -0,0 +1 @@
+#include <sys/ioctl.h>
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/klog.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/klog.h
new file mode 100644
index 0000000000..35f5fe40e0
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/klog.h
@@ -0,0 +1,34 @@
+/* Copyright (C) 1996, 1999 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _SYS_KLOG_H
+
+#define _SYS_KLOG_H 1
+#include <features.h>
+
+__BEGIN_DECLS
+
+/* Control the kernel's logging facility. This corresponds exactly to
+ the kernel's syslog system call, but that name is easily confused
+ with the user-level syslog facility, which is something completely
+ different. */
+extern int klogctl (int __type, char *__bufp, int __len) __THROW;
+
+__END_DECLS
+
+#endif /* _SYS_KLOG_H */
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/link.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/link.h
new file mode 100644
index 0000000000..dd55fc0e1e
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/link.h
@@ -0,0 +1,45 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _SYS_LINK_H
+#define _SYS_LINK_H
+
+#include <link.h>
+
+/* XXX: These are different from OpenSolaris. */
+#define LM_ID_BRAND -3
+#define LM_ID_NONE -2
+#define LM_ID_NEWLM -1
+
+typedef enum
+ {
+ RD_NONE = 0,
+ RD_PREINIT,
+ RD_POSTINIT,
+ RD_DLACTIVITY
+ } rd_event_e;
+
+typedef enum
+ {
+ RD_FL_NONE = 0,
+ RD_FL_ODBG = 1,
+ RD_FL_DBG = 2
+ } rd_flags_e;
+
+#endif /* _SYS_LINK_H */
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/loadavg.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/loadavg.h
new file mode 100644
index 0000000000..8b5b0ae8f3
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/loadavg.h
@@ -0,0 +1,31 @@
+/* Declarations of loadavg types.
+ Copyright (C) 2009 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _SYS_LOADAVG
+#define _SYS_LOADAVG
+
+#include <stdlib.h>
+
+#define LOADAVG_1MIN 0
+#define LOADAVG_5MIN 1
+#define LOADAVG_15MIN 2
+
+#define LOADAVG_NSTATS 3
+
+#endif /* _SYS_LOADAVG */
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/machelf.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/machelf.h
new file mode 100644
index 0000000000..fe0d47492d
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/machelf.h
@@ -0,0 +1,88 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _SYS_MACHELF_H
+#define _SYS_MACHELF_H
+
+#include <sys/isa_defs.h>
+#include <sys/elf.h>
+#include <link.h>
+
+#if defined (_ELF64) && !defined (_ELF32_COMPAT)
+
+typedef Elf64_Xword Xword;
+typedef Elf64_Lword Lword;
+typedef Elf64_Sxword Sxword;
+typedef Elf64_Word Word;
+typedef Elf64_Sword Sword;
+typedef Elf64_Half Half;
+typedef Elf64_Addr Addr;
+typedef Elf64_Off Off;
+typedef uchar_t Byte;
+
+typedef Elf64_Ehdr Ehdr;
+typedef Elf64_Shdr Shdr;
+typedef Elf64_Sym Sym;
+typedef Elf64_Syminfo Syminfo;
+typedef Elf64_Rela Rela;
+typedef Elf64_Rel Rel;
+typedef Elf64_Nhdr Nhdr;
+typedef Elf64_Phdr Phdr;
+typedef Elf64_Dyn Dyn;
+typedef Elf64_Boot Boot;
+typedef Elf64_Verdef Verdef;
+typedef Elf64_Verdaux Verdaux;
+typedef Elf64_Verneed Verneed;
+typedef Elf64_Vernaux Vernaux;
+typedef Elf64_Versym Versym;
+typedef Elf64_Move Move;
+typedef Elf64_Cap Cap;
+
+#else
+
+typedef Elf32_Word Xword;
+typedef Elf32_Lword Lword;
+typedef Elf32_Sword Sxword;
+typedef Elf32_Word Word;
+typedef Elf32_Sword Sword;
+typedef Elf32_Half Half;
+typedef Elf32_Addr Addr;
+typedef Elf32_Off Off;
+
+typedef Elf32_Ehdr Ehdr;
+typedef Elf32_Shdr Shdr;
+typedef Elf32_Sym Sym;
+typedef Elf32_Syminfo Syminfo;
+typedef Elf32_Rela Rela;
+typedef Elf32_Rel Rel;
+typedef Elf32_Nhdr Nhdr;
+typedef Elf32_Phdr Phdr;
+typedef Elf32_Dyn Dyn;
+typedef Elf32_Boot Boot;
+typedef Elf32_Verdef Verdef;
+typedef Elf32_Verdaux Verdaux;
+typedef Elf32_Verneed Verneed;
+typedef Elf32_Vernaux Vernaux;
+typedef Elf32_Versym Versym;
+typedef Elf32_Move Move;
+typedef Elf32_Cap Cap;
+
+#endif /* _ELF64 */
+
+#endif /* _SYS_MACHELF_H */
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/machtypes.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/machtypes.h
new file mode 100644
index 0000000000..99b84d608b
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/machtypes.h
@@ -0,0 +1,25 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _SYS_MACHTYPES_H
+#define _SYS_MACHTYPES_H
+
+#include <bits/machtypes.h>
+
+#endif /* _SYS_MACHTYPES_H */
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/mkdev.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/mkdev.h
new file mode 100644
index 0000000000..903017ba86
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/mkdev.h
@@ -0,0 +1,47 @@
+/* Copyright (C) 2009 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _SYS_MKDEV_H
+#define _SYS_MKDEV_H
+
+#include <sys/sysmacros.h>
+
+#define ONBITSMAJOR O_BITSMAJOR
+#define ONBITSMINOR O_BITSMINOR
+#define OMAXMAJ O_MAXMAJ
+#define OMAXMIN O_MAXMIN
+
+#define NBITSMAJOR32 L_BITSMAJOR32
+#define NBITSMINOR32 L_BITSMINOR32
+#define MAXMAJ32 L_MAXMAJ32
+#define MAXMIN32 L_MAXMIN32
+
+#ifdef _LP64
+# define NBITSMAJOR64 L_BITSMAJOR
+# define NBITSMINOR64 L_BITSMINOR
+# define MAXMAJ64 L_MAXMAJ
+# define MAXMIN64 L_MAXMIN
+#endif
+
+#define NBITSMAJOR L_BITSMAJOR
+#define NBITSMINOR L_BITSMINOR
+#define MAXMAJ L_MAXMAJ
+#define MAXMIN L_MAXMIN
+
+#endif /* _SYS_MKDEV_H */
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/mntio.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/mntio.h
new file mode 100644
index 0000000000..f8a6c97a47
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/mntio.h
@@ -0,0 +1,52 @@
+/* Copyright (C) 2009 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2009.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _SYS_MNTIO_H
+#define _SYS_MNTIO_H
+
+#include <sys/stat.h>
+#include <sys/types.h>
+
+#define MNTIOC ('m' << 8)
+#define MNTIOC_NMNTS (MNTIOC|1)
+#define MNTIOC_GETDEVLIST (MNTIOC|2)
+#define MNTIOC_SETTAG (MNTIOC|3)
+#define MNTIOC_CLRTAG (MNTIOC|4)
+#define MNTIOC_SHOWHIDDEN (MNTIOC|6)
+#define MNTIOC_GETMNTENT (MNTIOC|7)
+
+struct mnttagdesc
+ {
+ unsigned int mtd_major;
+ unsigned int mtd_minor;
+ char *mtd_mntpt;
+ char *mtd_tag;
+ };
+
+struct mntlookup
+ {
+ size_t mtl_mntpt_off;
+ char *mtl_mntpt;
+ major_t mtl_major;
+ minor_t mtl_minor;
+ __ino64_t mtl_ino;
+ char mtl_fstype[_ST_FSTYPSZ];
+ };
+
+#endif /* _SYS_MNTIO_H */
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/mnttab.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/mnttab.h
new file mode 100644
index 0000000000..be5ae5930d
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/mnttab.h
@@ -0,0 +1,82 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _MNTENT_H
+#ifndef _SYS_MNTTAB_H
+#define _SYS_MNTTAB_H
+
+#include <features.h>
+#include <paths.h>
+
+#define MNTTAB _PATH_MOUNTED
+#define MNT_LINE_MAX 1024
+
+#define MNT_TOOLONG 1
+#define MNT_TOOMANY 2
+#define MNT_TOOFEW 3
+
+#define mntnull(mp) ((mp)->mnt_special = (mp)->mnt_mountp = \
+ (mp)->mnt_fstype = (mp)->mnt_mntopts = (mp)->mnt_time = NULL)
+#define putmntent(fd, mp) (-1)
+
+struct mnttab
+ {
+ char *mnt_special;
+ char *mnt_mountp;
+ char *mnt_fstype;
+ char *mnt_mntopts;
+ char *mnt_time;
+ };
+
+struct extmnttab
+ {
+ char *mnt_special;
+ char *mnt_mountp;
+ char *mnt_fstype;
+ char *mnt_mntopts;
+ char *mnt_time;
+ unsigned int mnt_major;
+ unsigned int mnt_minor;
+ };
+
+__BEGIN_DECLS
+
+extern void resetmnttab (FILE *);
+# ifdef __REDIRECT_NTH
+extern int __getmntent_sun (FILE *, struct mnttab *);
+extern int __REDIRECT_NTH (getmntent, (FILE *, struct mnttab *),
+ __getmntent_sun);
+# else
+# define getmntent __getmntent_sun
+# endif
+extern int getextmntent (FILE *, struct extmnttab *, size_t);
+extern int getmntany (FILE *, struct mnttab *, struct mnttab *);
+# ifdef __REDIRECT_NTH
+extern char * __hasmntopt_sun (struct mnttab *, char *);
+extern char * __REDIRECT_NTH (hasmntopt, (struct mnttab *, char *),
+ __hasmntopt_sun);
+# else
+# define hasmntopt __hasmntopt_sun
+# endif
+extern char *mntopt (char **);
+
+__END_DECLS
+
+#endif /* _SYS_MNTTAB_H */
+#endif
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/mount.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/mount.h
new file mode 100644
index 0000000000..36e239fc83
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/mount.h
@@ -0,0 +1,69 @@
+/* Header file for mounting/unmount OpenSolaris filesystems.
+ Copyright (C) 1996,1997,1998,1999,2000,2004,2008
+ Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+/* This is taken from /usr/include/linux/fs.h. */
+
+#ifndef _SYS_MOUNT_H
+#define _SYS_MOUNT_H 1
+
+#include <features.h>
+#include <sys/ioctl.h>
+
+
+/* These are the fs-independent mount-flags: up to 16 flags are
+ supported */
+#define MS_RDONLY 0x0001 /* Mount read-only. */
+#define MS_FSS 0x0002 /* Old mount. */
+#define MS_DATA 0x0004 /* 6-argument mount. */
+#define MS_SYSSPACE 0x0008 /* In kernel space. */
+#define MS_NOSUID 0x0010 /* Ignore suid and sgid bits. */
+#define MS_REMOUNT 0x0020 /* Alter flags of a mounted FS. */
+#define MS_NOTRUNC 0x0040 /* Return ENAMETOOLONG for long filenames. */
+#define MS_OVERLAY 0x0080 /* Allow overlay mounts. */
+#define MS_OPTIONSTR 0x0100 /* Data is a an in/out option string. */
+#define MS_GLOBAL 0x0200 /* Clustering: Mount into global name space. */
+#define MS_FORCE 0x0400 /* Forced unmount. */
+#define MS_NOMNTTAB 0x0800 /* Don't show mount in mnttab. */
+#define MS_NOSPLICE 0x1000
+#define MS_NOCHECK 0x2000
+
+#define MS_MASK (MS_RDONLY | MS_FSS | MS_DATA | MS_NOSUID | \
+ MS_REMOUNT | MS_NOTRUNC | MS_OVERLAY | MS_OPTIONSTR | \
+ MS_GLOBAL | MS_NOMNTTAB)
+#define MS_UMOUNT_MASK (MS_FORCE)
+
+#define MAX_MNTOPT_STR 1024
+
+__BEGIN_DECLS
+
+/* Mount a filesystem. */
+extern int mount (__const char *__spec, __const char *__dir,
+ int __mflag_, __const char *__fstype, __const void *__dataptr,
+ int __datalen, char *__optptr, int __optlen) __THROW;
+
+/* Unmount a filesystem. */
+extern int umount (__const char *__file) __THROW;
+
+/* Unmount a filesystem. Force unmounting if FLAG is set to MS_FORCE. */
+extern int umount2 (__const char *__file, int __flag) __THROW;
+
+__END_DECLS
+
+#endif /* _SYS_MOUNT_H */
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/old_procfs.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/old_procfs.h
new file mode 100644
index 0000000000..33e7354f09
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/old_procfs.h
@@ -0,0 +1,339 @@
+/* Declarations of old procfs structures.
+ Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _SYS_OLD_PROCFS_H
+#define _SYS_OLD_PROCFS_H 1
+
+#if _STRUCTURED_PROC == 0
+
+#include <sys/types.h>
+#include <sys/procset.h>
+#include <sys/ucontext.h>
+#include <sys/signal.h>
+#include <sys/fault.h>
+#include <sys/procfs_isa.h>
+
+#define PIOC ('q'<<8)
+#define PIOCSTATUS (PIOC|1)
+#define PIOCSTOP (PIOC|2)
+#define PIOCWSTOP (PIOC|3)
+#define PIOCRUN (PIOC|4)
+#define PIOCGTRACE (PIOC|5)
+#define PIOCSTRACE (PIOC|6)
+#define PIOCSSIG (PIOC|7)
+#define PIOCKILL (PIOC|8)
+#define PIOCUNKILL (PIOC|9)
+#define PIOCGHOLD (PIOC|10)
+#define PIOCSHOLD (PIOC|11)
+#define PIOCMAXSIG (PIOC|12)
+#define PIOCACTION (PIOC|13)
+#define PIOCGFAULT (PIOC|14)
+#define PIOCSFAULT (PIOC|15)
+#define PIOCCFAULT (PIOC|16)
+#define PIOCGENTRY (PIOC|17)
+#define PIOCSENTRY (PIOC|18)
+#define PIOCGEXIT (PIOC|19)
+#define PIOCSEXIT (PIOC|20)
+#define PIOCSFORK (PIOC|21)
+#define PIOCRFORK (PIOC|22)
+#define PIOCSRLC (PIOC|23)
+#define PIOCRRLC (PIOC|24)
+#define PIOCGREG (PIOC|25)
+#define PIOCSREG (PIOC|26)
+#define PIOCGFPREG (PIOC|27)
+#define PIOCSFPREG (PIOC|28)
+#define PIOCNICE (PIOC|29)
+#define PIOCPSINFO (PIOC|30)
+#define PIOCNMAP (PIOC|31)
+#define PIOCMAP (PIOC|32)
+#define PIOCOPENM (PIOC|33)
+#define PIOCCRED (PIOC|34)
+#define PIOCGROUPS (PIOC|35)
+#define PIOCGETPR (PIOC|36)
+#define PIOCGETU (PIOC|37)
+#define PIOCSET (PIOC|38)
+#define PIOCRESET (PIOC|39)
+#define PIOCUSAGE (PIOC|43)
+#define PIOCOPENPD (PIOC|44)
+#define PIOCLWPIDS (PIOC|45)
+#define PIOCOPENLWP (PIOC|46)
+#define PIOCLSTATUS (PIOC|47)
+#define PIOCLUSAGE (PIOC|48)
+#define PIOCNAUXV (PIOC|49)
+#define PIOCAUXV (PIOC|50)
+#define PIOCGXREGSIZE (PIOC|51)
+#define PIOCGXREG (PIOC|52)
+#define PIOCSXREG (PIOC|53)
+
+#define PIOCNLDT (PIOC|103)
+#define PIOCLDT (PIOC|104)
+
+#define PRCLSZ 8
+#define PRSYSARGS 8
+
+#endif /* _STRUCTURED_PROC == 0 */
+
+typedef struct prstatus
+ {
+ int pr_flags;
+ short pr_why;
+ short pr_what;
+ siginfo_t pr_info;
+ short pr_cursig;
+ unsigned short pr_nlwp;
+ sigset_t pr_sigpend;
+ sigset_t pr_sighold;
+ struct sigaltstack pr_altstack;
+ struct sigaction pr_action;
+ pid_t pr_pid;
+ pid_t pr_ppid;
+ pid_t pr_pgrp;
+ pid_t pr_sid;
+ struct timespec pr_utime;
+ struct timespec pr_stime;
+ struct timespec pr_cutime;
+ struct timespec pr_cstime;
+ char pr_clname[PRCLSZ];
+ short pr_syscall;
+ short pr_nsysarg;
+ long pr_sysarg[PRSYSARGS];
+ id_t pr_who;
+ sigset_t pr_lwppend;
+ struct ucontext *pr_oldcontext;
+ caddr_t pr_brkbase;
+ size_t pr_brksize;
+ caddr_t pr_stkbase;
+ size_t pr_stksize;
+ short pr_processor;
+ short pr_bind;
+ long pr_instr;
+ prgregset_t pr_reg;
+ } prstatus_t;
+
+#if _STRUCTURED_PROC == 0
+
+#define PR_STOPPED 0x0001
+#define PR_ISTOP 0x0002
+#define PR_DSTOP 0x0004
+#define PR_ASLEEP 0x0008
+#define PR_FORK 0x0010
+#define PR_RLC 0x0020
+#define PR_PTRACE 0x0040
+#define PR_PCINVAL 0x0080
+#define PR_ISSYS 0x0100
+#define PR_STEP 0x0200
+#define PR_KLC 0x0400
+#define PR_ASYNC 0x0800
+#define PR_PCOMPAT 0x1000
+#define PR_MSACCT 0x2000
+#define PR_BPTADJ 0x4000
+#define PR_ASLWP 0x8000
+
+#define PR_REQUESTED 1
+#define PR_SIGNALLED 2
+#define PR_SYSENTRY 3
+#define PR_SYSEXIT 4
+#define PR_JOBCONTROL 5
+#define PR_FAULTED 6
+#define PR_SUSPENDED 7
+#define PR_CHECKPOINT 8
+
+#define PRFNSZ 16
+#define PRARGSZ 80
+
+#endif /* _STRUCTURED_PROC == 0 */
+
+typedef struct prpsinfo
+ {
+ char pr_state;
+ char pr_sname;
+ char pr_zomb;
+ char pr_nice;
+ unsigned int pr_flag;
+ uid_t pr_uid;
+ gid_t pr_gid;
+ pid_t pr_pid;
+ pid_t pr_ppid;
+ pid_t pr_pgrp;
+ pid_t pr_sid;
+ caddr_t pr_addr;
+ size_t pr_size;
+ size_t pr_rssize;
+ caddr_t pr_wchan;
+ struct timespec pr_start;
+ struct timespec pr_time;
+ int pr_pri;
+ char pr_oldpri;
+ char pr_cpu;
+ o_dev_t pr_ottydev;
+ dev_t pr_lttydev;
+ char pr_clname[PRCLSZ];
+ char pr_fname[PRFNSZ];
+ char pr_psargs[PRARGSZ];
+ short pr_syscall;
+ short pr_fill;
+ struct timespec pr_ctime;
+ size_t pr_bysize;
+ size_t pr_byrssize;
+ int pr_argc;
+ char **pr_argv;
+ char **pr_envp;
+ int pr_wstat;
+ unsigned short pr_pctcpu;
+ unsigned short pr_pctmem;
+ uid_t pr_euid;
+ gid_t pr_egid;
+ id_t pr_aslwpid;
+ char pr_dmodel;
+ char pr_pad[3];
+ int pr_filler[6];
+ } prpsinfo_t;
+
+#if _STRUCTURED_PROC == 0
+
+typedef struct prrun
+ {
+ int pr_flags;
+ sigset_t pr_trace;
+ sigset_t pr_sighold;
+ fltset_t pr_fault;
+ caddr_t pr_vaddr;
+ int pr_filler[8];
+ } prrun_t;
+
+#define PRCSIG 0x001
+#define PRCFAULT 0x002
+#define PRSTRACE 0x004
+#define PRSHOLD 0x008
+#define PRSFAULT 0x010
+#define PRSVADDR 0x020
+#define PRSTEP 0x040
+#define PRSABORT 0x080
+#define PRSTOP 0x100
+
+typedef struct prmap
+ {
+ caddr_t pr_vaddr;
+ size_t pr_size;
+ off_t pr_off;
+ unsigned int pr_mflags;
+ unsigned int pr_pagesize;
+ long pr_filler[3];
+ } prmap_t;
+
+#define MA_READ 0x04
+#define MA_WRITE 0x02
+#define MA_EXEC 0x01
+#define MA_SHARED 0x08
+#define MA_BREAK 0x10
+#define MA_STACK 0x20
+
+typedef struct prcred
+ {
+ uid_t pr_euid;
+ uid_t pr_ruid;
+ uid_t pr_suid;
+ gid_t pr_egid;
+ gid_t pr_rgid;
+ gid_t pr_sgid;
+ unsigned int pr_ngroups;
+ } prcred_t;
+
+typedef struct prusage
+ {
+ id_t pr_lwpid;
+ int pr_count;
+ struct timespec pr_tstamp;
+ struct timespec pr_create;
+ struct timespec pr_term;
+ struct timespec pr_rtime;
+ struct timespec pr_utime;
+ struct timespec pr_stime;
+ struct timespec pr_ttime;
+ struct timespec pr_tftime;
+ struct timespec pr_dftime;
+ struct timespec pr_kftime;
+ struct timespec pr_ltime;
+ struct timespec pr_slptime;
+ struct timespec pr_wtime;
+ struct timespec pr_stoptime;
+ struct timespec filltime[6];
+ unsigned long pr_minf;
+ unsigned long pr_majf;
+ unsigned long pr_nswap;
+ unsigned long pr_inblk;
+ unsigned long pr_oublk;
+ unsigned long pr_msnd;
+ unsigned long pr_mrcv;
+ unsigned long pr_sigs;
+ unsigned long pr_vctx;
+ unsigned long pr_ictx;
+ unsigned long pr_sysc;
+ unsigned long pr_ioch;
+ unsigned long filler[10];
+ } prusage_t;
+
+typedef struct prpageheader
+ {
+ struct timespec pr_tstamp;
+ unsigned long pr_nmap;
+ unsigned long pr_npage;
+ } prpageheader_t;
+
+typedef struct prasmap
+ {
+ caddr_t pr_vaddr;
+ size_t pr_npage;
+ off_t pr_off;
+ unsigned int pr_mflags;
+ unsigned int pr_pagesize;
+ long pr_filler[3];
+ } prasmap_t;
+
+#define PG_REFERENCED 0x02
+#define PG_MODIFIED 0x01
+#define PG_HWMAPPED 0x04
+
+/* based on sig*set */
+
+#define prfillset(set) \
+ { int __cnt = sizeof (*set) / sizeof (uint32_t); \
+ while (--__cnt >= 0) ((uint32_t *)(set))[__cnt] = 0xFFFFFFFF; }
+
+#define premptyset(set) \
+ { int __cnt = sizeof (*set) / sizeof (uint32_t); \
+ while (--__cnt >= 0) ((uint32_t *)(set))[__cnt] = 0; }
+
+#define __prmask(flag) \
+ (((uint32_t) 1) << (((flag) - 1) % (8 * (int)sizeof (uint32_t))))
+
+# define __prword(flag) (((flag) - 1) / (8 * (int)sizeof (uint32_t)))
+
+#define praddset(set, flag) \
+ (((uint32_t *)(set))[__prword (flag)] |= __prmask (flag))
+
+#define prdelset(set, flag) \
+ (((uint32_t *)(set))[__prword (flag)] &= ~__prmask (flag))
+
+#define prismember(set, flag) \
+ ((((uint32_t *)(set))[__prword (flag)] & __prmask (flag)) ? 1 : 0)
+
+#endif /* _STRUCTURED_PROC == 0 */
+
+#endif /* _SYS_OLD_PROCFS_H */
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/param.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/param.h
new file mode 100644
index 0000000000..a17a0405d9
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/param.h
@@ -0,0 +1,139 @@
+/* Copyright (C) 1995, 1996, 1997, 1998, 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _SYS_PARAM_H
+#define _SYS_PARAM_H 1
+
+#include <limits.h>
+#include <bits/local_lim.h>
+#include <features.h>
+#include <sys/isa_defs.h>
+
+#ifndef MIN
+# define MIN(a,b) (((a)<(b))?(a):(b))
+#endif
+#ifndef MAX
+# define MAX(a,b) (((a)>(b))?(a):(b))
+#endif
+
+/* BSD names for some <limits.h> values. */
+
+#define NBBY CHAR_BIT
+#ifndef NGROUPS
+# define NGROUPS NGROUPS_MAX
+#endif
+#define MAXSYMLINKS 20
+#define CANBSIZ MAX_CANON
+#define NCARGS ARG_MAX
+#define MAXPATHLEN PATH_MAX
+#define NOFILE OPEN_MAX
+
+
+#include <sys/types.h>
+
+/* Bit map related macros. */
+#define setbit(a,i) ((a)[(i)/NBBY] |= 1<<((i)%NBBY))
+#define clrbit(a,i) ((a)[(i)/NBBY] &= ~(1<<((i)%NBBY)))
+#define isset(a,i) ((a)[(i)/NBBY] & (1<<((i)%NBBY)))
+#define isclr(a,i) (((a)[(i)/NBBY] & (1<<((i)%NBBY))) == 0)
+
+/* Macros for counting and rounding. */
+#ifndef howmany
+# define howmany(x, y) (((x)+((y)-1))/(y))
+#endif
+#define roundup(x, y) ((((x)+((y)-1))/(y))*(y))
+#define powerof2(x) ((((x)-1)&(x))==0)
+
+#define NODEV (dev_t)(-1l)
+
+/* Unit of `st_blocks'. */
+#define DEV_BSIZE 512
+
+/* Maximum hostname length. */
+#define MAXHOSTNAMELEN 256
+
+#define PAGESIZE sysconf(_SC_PAGESIZE)
+#define MAXPID (pid_t)sysconf(_SC_MAXPID)
+#define MAXEPHUID (uid_t)sysconf(_SC_EPHID_MAX)
+#define MAXNAMELEN 256
+#define TYPICALMAXPATHLEN 64
+#define MAXLINKNAMELEN 32
+
+#define UID_NOBODY 60001
+#define GID_NOBODY UID_NOBODY
+#define GID_SYS 3
+#define UID_DLADM 15
+#define MAXUID 2147483647
+#define MAXPROJID MAXUID
+
+#define NS_PACKETSZ 512
+#define NS_MAXDNAME 1025
+#define NS_MAXMSG 65535
+#define NS_MAXCDNAME 255
+#define NS_MAXLABEL 63
+#define NS_HFIXEDSZ 12
+#define NS_QFIXEDSZ 4
+#define NS_RRFIXEDSZ 10
+#define NS_INT32SZ 4
+#define NS_INT16SZ 2
+#define NS_INT8SZ 1
+#define NS_INADDRSZ 4
+#define NS_IN6ADDRSZ 16
+#define NS_CMPRSFLGS 0xc0
+#define NS_DEFAULTPORT 53
+
+#define NGROUPS_UMIN 0
+#define NGROUPS_UMAX 32
+#define NGROUPS_MAX_DEFAULT 16
+
+#define MAXBSIZE 8192
+#define DEV_BSIZE 512
+#define DEV_BSHIFT 9
+#define MAXFRAG 8
+#ifdef _LP64
+# define MAXOFF_T 0x7fffffffffffffffl
+# define MAXOFFSET_T 0x7fffffffffffffffl
+#else
+# define MAXOFF_T 0x7fffffffl
+# define MAXOFFSET_T 0x7fffffffffffffffLL
+#endif
+
+#ifdef _LITTLE_ENDIAN
+# define lobyte(X) (((unsigned char *)&(X))[0])
+# define hibyte(X) (((unsigned char *)&(X))[1])
+# define loword(X) (((ushort_t *)&(X))[0])
+# define hiword(X) (((ushort_t *)&(X))[1])
+#endif
+#ifdef _BIG_ENDIAN
+# define lobyte(X) (((unsigned char *)&(X))[1])
+# define hibyte(X) (((unsigned char *)&(X))[0])
+# define loword(X) (((ushort_t *)&(X))[1])
+# define hiword(X) (((ushort_t *)&(X))[0])
+#endif
+
+#ifndef __USE_XOPEN
+# define NZERO 20
+#endif
+
+__BEGIN_DECLS
+
+extern long int sysconf (int __name) __THROW;
+
+__END_DECLS
+
+#endif /* sys/param.h */
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/port.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/port.h
new file mode 100644
index 0000000000..a96ff627a6
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/port.h
@@ -0,0 +1,77 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _SYS_PORT_H
+#define _SYS_PORT_H
+
+#include <sys/types.h>
+
+#define PORT_SOURCE_AIO 1
+#define PORT_SOURCE_TIMER 2
+#define PORT_SOURCE_USER 3
+#define PORT_SOURCE_FD 4
+#define PORT_SOURCE_ALERT 5
+#define PORT_SOURCE_MQ 6
+#define PORT_SOURCE_FILE 7
+
+typedef struct port_event
+ {
+ int portev_events;
+ unsigned short portev_source;
+ unsigned short portev_pad;
+ uintptr_t portev_object;
+ void *portev_user;
+ } port_event_t;
+
+typedef struct port_notify
+ {
+ int portnfy_port;
+ void *portnfy_user;
+ } port_notify_t;
+
+typedef struct file_obj
+ {
+ struct timespec fo_atime;
+ struct timespec fo_mtime;
+ struct timespec fo_ctime;
+ uintptr_t fo_pad[3];
+ char *fo_name;
+ } file_obj_t;
+
+#define PORT_ALERT_SET 0x01
+#define PORT_ALERT_UPDATE 0x02
+#define PORT_ALERT_INVALID (PORT_ALERT_SET | PORT_ALERT_UPDATE)
+
+#define FILE_ACCESS 0x00000001
+#define FILE_MODIFIED 0x00000002
+#define FILE_ATTRIB 0x00000004
+#define FILE_NOFOLLOW 0x10000000
+
+#define FILE_DELETE 0x00000010
+#define FILE_RENAME_TO 0x00000020
+#define FILE_RENAME_FROM 0x00000040
+
+#define UNMOUNTED 0x20000000
+
+#define MOUNTEDOVER 0x40000000
+
+#define FILE_EXCEPTION (UNMOUNTED | FILE_DELETE | FILE_RENAME_TO | \
+ FILE_RENAME_FROM | MOUNTEDOVER)
+
+#endif /* _SYS_PORT_H */
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/port_impl.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/port_impl.h
new file mode 100644
index 0000000000..2968aeccbd
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/port_impl.h
@@ -0,0 +1,40 @@
+/* Copyright (C) 2009 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _SYS_PORT_IMPL_H
+#define _SYS_PORT_IMPL_H
+
+#include <sys/port.h>
+
+#define PORT_CREATE 0
+#define PORT_ASSOCIATE 1
+#define PORT_DISSOCIATE 2
+#define PORT_SEND 3
+#define PORT_SENDN 4
+#define PORT_GET 5
+#define PORT_GETN 6
+#define PORT_ALERT 7
+#define PORT_DISPATCH 8
+
+#define PORT_SYS_NOPORT 0x0100
+#define PORT_SYS_NOSHARE 0x0200
+#define PORT_CODE_MASK 0xFF
+#define PORT_SHARE_EVENT 0x01
+#define PORT_MAX_LIST 8192
+
+#endif /* _SYS_PORT_IMPL_H */
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/priocntl.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/priocntl.h
new file mode 100644
index 0000000000..741b036638
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/priocntl.h
@@ -0,0 +1,119 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _PRIOCNTLP_H
+#define _PRIOCNTLP_H
+
+#include <features.h>
+#include <sys/types.h>
+#include <sys/procset.h>
+
+#define PC_VERSION 1
+
+#define PC_GETCID 0
+#define PC_GETCLINFO 1
+#define PC_SETPARMS 2
+#define PC_GETPARMS 3
+#define PC_ADMIN 4
+#define PC_GETPRIRANGE 5
+#define PC_DONICE 6
+#define PC_SETXPARMS 7
+#define PC_GETXPARMS 8
+#define PC_SETDFLCL 9
+#define PC_GETDFLCL 10
+#define PC_DOPRIO 11
+
+#define PC_CLNULL -1
+
+typedef struct pcinfo
+ {
+ id_t pc_cid;
+#define PC_CLNMSZ 16
+ char pc_clname[PC_CLNMSZ];
+#define PC_CLINFOSZ (32 / sizeof (int))
+ int pc_clinfo[PC_CLINFOSZ];
+ } pcinfo_t;
+
+typedef struct pcparms
+ {
+ id_t pc_cid;
+#define PC_CLPARMSZ (32 / sizeof (int))
+ int pc_clparms[PC_CLPARMSZ];
+ } pcparms_t;
+
+typedef struct pcnice
+ {
+ int pc_val;
+ int pc_op;
+ } pcnice_t;
+
+/* pc_op values. */
+#define PC_GETNICE 0
+#define PC_SETNICE 1
+
+typedef struct pcprio
+ {
+ int pc_op;
+ id_t pc_cid;
+ int pc_val;
+ } pcprio_t;
+
+/* pc_op values. */
+#define PC_GETPRIO 0
+#define PC_SETPRIO 1
+
+typedef struct pc_vaparm
+ {
+ int pc_key;
+ unsigned long long pc_parm;
+ } pc_vaparm_t;
+
+/* pc_key values. */
+#define PC_KY_NULL 0
+#define PC_KY_CLNAME 1
+
+typedef struct pc_vaparms
+ {
+ unsigned int pc_vaparmscnt;
+#define PC_VAPARMCNT 8
+ pc_vaparm_t pc_parms[PC_VAPARMCNT];
+ } pc_vaparms_t;
+
+typedef struct pcpri
+ {
+ id_t pc_cid;
+ pri_t pc_clpmax;
+ pri_t pc_clpmin;
+ } pcpri_t;
+
+typedef struct pcadmin
+ {
+ id_t pc_cid;
+ __caddr_t pc_cladmin;
+ } pcadmin_t;
+
+__BEGIN_DECLS
+
+long priocntl (idtype_t idtype, id_t id, int cmd, ...);
+
+long priocntlset (procset_t *ps, int cmd, ...);
+
+__END_DECLS
+
+#endif /* _PRIOCNTLP_H */
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/priv.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/priv.h
new file mode 100644
index 0000000000..1da00b647f
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/priv.h
@@ -0,0 +1,115 @@
+/* Declarations of privilege functions and types.
+ Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _SYS_PRIV_H
+#define _SYS_PRIV_H
+
+#include <sys/types.h>
+#include <sys/priv_names.h>
+
+/* privsys codes */
+#define PRIVSYS_SETPPRIV 0
+#define PRIVSYS_GETPPRIV 1
+#define PRIVSYS_GETIMPLINFO 2
+#define PRIVSYS_SETPFLAGS 3
+#define PRIVSYS_GETPFLAGS 4
+#define PRIVSYS_ISSETUGID 5
+#define PRIVSYS_KLPD_REG 6
+#define PRIVSYS_KLPD_UNREG 7
+
+typedef enum priv_op
+{
+ PRIV_ON,
+ PRIV_OFF,
+ PRIV_SET
+} priv_op_t;
+
+typedef uint32_t priv_chunk_t;
+typedef struct priv_set priv_set_t;
+typedef const char *priv_ptype_t;
+typedef const char *priv_t;
+
+typedef struct priv_impl_info
+{
+ uint32_t priv_headersize;
+ uint32_t priv_flags;
+ uint32_t priv_nsets;
+ uint32_t priv_setsize;
+ uint32_t priv_max;
+ uint32_t priv_infosize;
+ uint32_t priv_globalinfosize;
+} priv_impl_info_t;
+
+#define PRIV_DEBUG 0x0001
+#define PRIV_AWARE 0x0002
+#define PRIV_AWARE_INHERIT 0x0004
+#define __PROC_PROTECT 0x0008
+#define NET_MAC_AWARE 0x0010
+#define NET_MAC_AWARE_INHERIT 0x0020
+#define PRIV_XPOLICY 0x0080
+#define PRIV_USER (PRIV_DEBUG | NET_MAC_AWARE | \
+ NET_MAC_AWARE_INHERIT | PRIV_XPOLICY)
+
+#define PRIV_IMPL_INFO_SIZE(p) \
+ ((p)->priv_headersize + (p)->priv_globalinfosize)
+
+typedef struct priv_info
+{
+ uint32_t priv_info_type;
+ uint32_t priv_info_size;
+} priv_info_t;
+
+typedef struct priv_info_uint
+{
+ priv_info_t info;
+ uint_t val;
+} priv_info_uint_t;
+
+typedef struct priv_info_set
+{
+ priv_info_t info;
+ priv_chunk_t set[1];
+} priv_info_set_t;
+
+typedef struct priv_info_names
+{
+ priv_info_t info;
+ int cnt;
+ char names[1];
+} priv_info_names_t;
+
+#define PRIV_PRPRIV_INFO_OFFSET(p) \
+ (sizeof (prpriv_t) + sizeof (priv_chunk_t)) * \
+ ((p)->pr_nsets * (p)->pr_setsize - 1)
+
+#define PRIV_PRPRIV_SIZE(p) \
+ (PRIV_PRPRIV_INFO_OFFSET(p) + (p)->pr_infosize)
+
+#define PRIV_ALL (-1)
+#define PRIV_MULTIPLE (-2)
+#define PRIV_NONE (-3)
+#define PRIV_ALLZONE (-4)
+#define PRIV_GLOBAL (-5)
+
+#define PRIV_INFO_SETNAMES 1
+#define PRIV_INFO_PRIVNAMES 2
+#define PRIV_INFO_BASICPRIVS 3
+#define PRIV_INFO_FLAGS 4
+
+#endif /* _SYS_PRIV_H */
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/priv_names.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/priv_names.h
new file mode 100644
index 0000000000..70c4f07db8
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/priv_names.h
@@ -0,0 +1,101 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _SYS_PRIV_NAMES_H
+#define _SYS_PRIV_NAMES_H
+
+#define PRIV_CONTRACT_EVENT ((const char *)"contract_event")
+#define PRIV_CONTRACT_IDENTITY ((const char *)"contract_identity")
+#define PRIV_CONTRACT_OBSERVER ((const char *)"contract_observer")
+#define PRIV_CPC_CPU ((const char *)"cpc_cpu")
+#define PRIV_DTRACE_KERNEL ((const char *)"dtrace_kernel")
+#define PRIV_DTRACE_PROC ((const char *)"dtrace_proc")
+#define PRIV_DTRACE_USER ((const char *)"dtrace_user")
+#define PRIV_FILE_CHOWN ((const char *)"file_chown")
+#define PRIV_FILE_CHOWN_SELF ((const char *)"file_chown_self")
+#define PRIV_FILE_DAC_EXECUTE ((const char *)"file_dac_execute")
+#define PRIV_FILE_DAC_READ ((const char *)"file_dac_read")
+#define PRIV_FILE_DAC_SEARCH ((const char *)"file_dac_search")
+#define PRIV_FILE_DAC_WRITE ((const char *)"file_dac_write")
+#define PRIV_FILE_DOWNGRADE_SL ((const char *)"file_downgrade_sl")
+#define PRIV_FILE_LINK_ANY ((const char *)"file_link_any")
+#define PRIV_FILE_OWNER ((const char *)"file_owner")
+#define PRIV_FILE_SETID ((const char *)"file_setid")
+#define PRIV_FILE_UPGRADE_SL ((const char *)"file_upgrade_sl")
+#define PRIV_FILE_FLAG_SET ((const char *)"file_flag_set")
+#define PRIV_GRAPHICS_ACCESS ((const char *)"graphics_access")
+#define PRIV_GRAPHICS_MAP ((const char *)"graphics_map")
+#define PRIV_IPC_DAC_READ ((const char *)"ipc_dac_read")
+#define PRIV_IPC_DAC_WRITE ((const char *)"ipc_dac_write")
+#define PRIV_IPC_OWNER ((const char *)"ipc_owner")
+#define PRIV_NET_BINDMLP ((const char *)"net_bindmlp")
+#define PRIV_NET_ICMPACCESS ((const char *)"net_icmpaccess")
+#define PRIV_NET_MAC_AWARE ((const char *)"net_mac_aware")
+#define PRIV_NET_PRIVADDR ((const char *)"net_privaddr")
+#define PRIV_NET_RAWACCESS ((const char *)"net_rawaccess")
+#define PRIV_PROC_AUDIT ((const char *)"proc_audit")
+#define PRIV_PROC_CHROOT ((const char *)"proc_chroot")
+#define PRIV_PROC_CLOCK_HIGHRES ((const char *)"proc_clock_highres")
+#define PRIV_PROC_EXEC ((const char *)"proc_exec")
+#define PRIV_PROC_FORK ((const char *)"proc_fork")
+#define PRIV_PROC_INFO ((const char *)"proc_info")
+#define PRIV_PROC_LOCK_MEMORY ((const char *)"proc_lock_memory")
+#define PRIV_PROC_OWNER ((const char *)"proc_owner")
+#define PRIV_PROC_PRIOCNTL ((const char *)"proc_priocntl")
+#define PRIV_PROC_SESSION ((const char *)"proc_session")
+#define PRIV_PROC_SETID ((const char *)"proc_setid")
+#define PRIV_PROC_TASKID ((const char *)"proc_taskid")
+#define PRIV_PROC_ZONE ((const char *)"proc_zone")
+#define PRIV_SYS_ACCT ((const char *)"sys_acct")
+#define PRIV_SYS_ADMIN ((const char *)"sys_admin")
+#define PRIV_SYS_AUDIT ((const char *)"sys_audit")
+#define PRIV_SYS_CONFIG ((const char *)"sys_config")
+#define PRIV_SYS_DEVICES ((const char *)"sys_devices")
+#define PRIV_SYS_IPC_CONFIG ((const char *)"sys_ipc_config")
+#define PRIV_SYS_LINKDIR ((const char *)"sys_linkdir")
+#define PRIV_SYS_MOUNT ((const char *)"sys_mount")
+#define PRIV_SYS_IP_CONFIG ((const char *)"sys_ip_config")
+#define PRIV_SYS_NET_CONFIG ((const char *)"sys_net_config")
+#define PRIV_SYS_NFS ((const char *)"sys_nfs")
+#define PRIV_SYS_RES_CONFIG ((const char *)"sys_res_config")
+#define PRIV_SYS_RESOURCE ((const char *)"sys_resource")
+#define PRIV_SYS_SMB ((const char *)"sys_smb")
+#define PRIV_SYS_SUSER_COMPAT ((const char *)"sys_suser_compat")
+#define PRIV_SYS_TIME ((const char *)"sys_time")
+#define PRIV_SYS_TRANS_LABEL ((const char *)"sys_trans_label")
+#define PRIV_VIRT_MANAGE ((const char *)"virt_manage")
+#define PRIV_WIN_COLORMAP ((const char *)"win_colormap")
+#define PRIV_WIN_CONFIG ((const char *)"win_config")
+#define PRIV_WIN_DAC_READ ((const char *)"win_dac_read")
+#define PRIV_WIN_DAC_WRITE ((const char *)"win_dac_write")
+#define PRIV_WIN_DEVICES ((const char *)"win_devices")
+#define PRIV_WIN_DGA ((const char *)"win_dga")
+#define PRIV_WIN_DOWNGRADE_SL ((const char *)"win_downgrade_sl")
+#define PRIV_WIN_FONTPATH ((const char *)"win_fontpath")
+#define PRIV_WIN_MAC_READ ((const char *)"win_mac_read")
+#define PRIV_WIN_MAC_WRITE ((const char *)"win_mac_write")
+#define PRIV_WIN_SELECTION ((const char *)"win_selection")
+#define PRIV_WIN_UPGRADE_SL ((const char *)"win_upgrade_sl")
+#define PRIV_XVM_CONTROL ((const char *)"xvm_control")
+#define PRIV_EFFECTIVE ((const char *)"Effective")
+#define PRIV_INHERITABLE ((const char *)"Inheritable")
+#define PRIV_PERMITTED ((const char *)"Permitted")
+#define PRIV_LIMIT ((const char *)"Limit")
+
+#endif /* _SYS_PRIV_NAMES_H */
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/processor.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/processor.h
new file mode 100644
index 0000000000..b8f941e776
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/processor.h
@@ -0,0 +1,83 @@
+/* Declarations of processor-related types/macros.
+ Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _SYS_PROCESSOR_H
+#define _SYS_PROCESSOR_H
+
+#include <features.h>
+#include <sys/procset.h>
+
+typedef int processorid_t;
+
+typedef struct
+{
+ int pi_state;
+#define PI_TYPELEN 16
+ char pi_processor_type[PI_TYPELEN];
+#define PI_FPUTYPE 32
+ char pi_fputypes[PI_FPUTYPE];
+ int pi_clock;
+} processor_info_t;
+
+/* p_online flag values */
+enum
+{
+ P_OFFLINE = 1,
+#define P_OFFLINE P_OFFLINE
+ P_ONLINE = 2,
+#define P_ONLINE P_ONLINE
+ P_STATUS = 3,
+#define P_STATUS P_STATUS
+ P_FAULTED = 4,
+#define P_FAULTED P_FAULTED
+#define P_BAD P_FAULTED
+ P_POWEROFF = 5,
+#define P_POWEROFF P_POWEROFF
+ P_NOINTR = 6,
+#define P_NOINTR P_NOINTR
+ P_SPARE = 7,
+#define P_SPARE P_SPARE
+ P_FORCED = 0x10000000
+#define P_FORCED P_FORCED
+};
+
+#define PS_OFFLINE "off-line"
+#define PS_ONLINE "on-line"
+#define PS_FAULTED "faulted"
+#define PS_POWEROFF "powered-off"
+#define PS_NOINTR "no-intr"
+#define PS_SPARE "spare"
+
+#define PBIND_NONE -1
+#define PBIND_QUERY -2
+#define PBIND_HARD -3
+#define PBIND_SOFT -4
+#define PBIND_QUERY_TYPE -5
+
+__BEGIN_DECLS
+
+extern int processor_info (processorid_t processorid, processor_info_t *infop);
+extern int processor_bind (idtype_t idtype, id_t id, processorid_t processorid,
+ processorid_t *obind);
+extern int p_online (processorid_t processorid, int flag);
+extern processorid_t getcpuid (void);
+
+__END_DECLS
+
+#endif /* _SYS_PROCESSOR_H */
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/procfs.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/procfs.h
new file mode 100644
index 0000000000..7344015938
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/procfs.h
@@ -0,0 +1,487 @@
+/* Declarations of procfs structures.
+ Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _SYS_PROCFS_H
+#define _SYS_PROCFS_H 1
+
+#ifndef _STRUCTURED_PROC
+# define _STRUCTURED_PROC 0
+#endif
+
+#if _STRUCTURED_PROC == 0
+
+# include <sys/old_procfs.h>
+
+#else
+
+#include <sys/types.h>
+#include <sys/signal.h>
+#include <sys/fault.h>
+#include <sys/syscall.h>
+#include <sys/processor.h>
+#include <sys/pset.h>
+#include <sys/priv.h>
+#include <bits/regset.h>
+#include <time.h>
+#include <bits/wordsize.h>
+#include <sys/procfs_isa.h>
+
+/* control codes for ctl and lwpctl */
+#define PCNULL 0
+#define PCSTOP 1
+#define PCDSTOP 2
+#define PCWSTOP 3
+#define PCTWSTOP 4
+#define PCRUN 5
+#define PCCSIG 6
+#define PCCFAULT 7
+#define PCSSIG 8
+#define PCKILL 9
+#define PCUNKILL 10
+#define PCSHOLD 11
+#define PCSTRACE 12
+#define PCSFAULT 13
+#define PCSENTRY 14
+#define PCSEXIT 15
+#define PCSET 16
+#define PCUNSET 17
+#define PCSREG 18
+#define PCSFPREG 19
+#define PCSXREG 20
+#define PCNICE 21
+#define PCSVADDR 22
+#define PCWATCH 23
+#define PCAGENT 24
+#define PCREAD 25
+#define PCWRITE 26
+#define PCSCRED 27
+#define PCSASRS 28
+#define PCSPRIV 29
+#define PCSZONE 30
+#define PCSCREDX 31
+
+/* PCRUN codes */
+#define PRCSIG 0x01
+#define PRCFAULT 0x02
+#define PRSTEP 0x04
+#define PRSABORT 0x08
+#define PRSTOP 0x10
+
+/* /proc/<pid>/lwp/<lwpid>/lwpstatus */
+typedef struct lwpstatus
+{
+ int pr_flags;
+ id_t pr_lwpid;
+ short pr_why;
+ short pr_what;
+ short pr_cursig;
+ short pr_pad1;
+ siginfo_t pr_info;
+ sigset_t pr_lwppend;
+ sigset_t pr_lwphold;
+ struct sigaction pr_action;
+ stack_t pr_altstack;
+ uintptr_t pr_oldcontext;
+ short pr_syscall;
+ short pr_nsysarg;
+ int pr_errno;
+#define PRSYSARGS 8
+ long pr_sysarg[PRSYSARGS];
+ long pr_rval1;
+ long pr_rval2;
+#define PRCLSZ 8
+ char pr_clname[PRCLSZ];
+ struct timespec pr_tstamp;
+ struct timespec pr_utime;
+ struct timespec pr_stime;
+ int pr_filler[11 - 2 * sizeof (struct timespec) / sizeof (int)];
+ int pr_errpriv;
+ uintptr_t pr_ustack;
+ unsigned long pr_instr;
+ prgregset_t pr_reg;
+ prfpregset_t pr_fpreg;
+} lwpstatus_t;
+
+/* /proc/<pid>/status */
+typedef struct pstatus
+{
+ int pr_flags;
+ int pr_nlwp;
+ pid_t pr_pid;
+ pid_t pr_ppid;
+ pid_t pr_pgid;
+ pid_t pr_sid;
+ id_t pr_aslwpid;
+ id_t pr_agentid;
+ sigset_t pr_sigpend;
+ uintptr_t pr_brkbase;
+ size_t pr_brksize;
+ uintptr_t pr_stkbase;
+ size_t pr_stksize;
+ struct timespec pr_utime;
+ struct timespec pr_stime;
+ struct timespec pr_cutime;
+ struct timespec pr_cstime;
+ sigset_t pr_sigtrace;
+ fltset_t pr_flttrace;
+ sysset_t pr_sysentry;
+ sysset_t pr_sysexit;
+ char pr_dmodel;
+ char pr_pad[3];
+ taskid_t pr_taskid;
+ projid_t pr_projid;
+ int pr_nzomb;
+ zoneid_t pr_zoneid;
+ int pr_filler[15];
+ lwpstatus_t pr_lwp;
+} pstatus_t;
+
+/* pr_flags */
+#define PR_STOPPED 0x00000001
+#define PR_ISTOP 0x00000002
+#define PR_DSTOP 0x00000004
+#define PR_STEP 0x00000008
+#define PR_ASLEEP 0x00000010
+#define PR_PCINVAL 0x00000020
+#define PR_ASLWP 0x00000040
+#define PR_AGENT 0x00000080
+#define PR_DETACH 0x00000100
+#define PR_DAEMON 0x00000200
+#define PR_IDLE 0x00000400
+#define PR_ISSYS 0x00001000
+#define PR_VFORKP 0x00002000
+#define PR_ORPHAN 0x00004000
+#define PR_NOSIGCHLD 0x00008000
+#define PR_WAITPID 0x00010000
+#define PR_FORK 0x00100000
+#define PR_RLC 0x00200000
+#define PR_KLC 0x00400000
+#define PR_ASYNC 0x00800000
+#define PR_MSACCT 0x01000000
+#define PR_BPTADJ 0x02000000
+#define PR_PTRACE 0x04000000
+#define PR_MSFORK 0x08000000
+
+/* pr_why */
+enum
+{
+ PR_REQUESTED = 1,
+#define PR_REQUESTED PR_REQUESTED
+ PR_SIGNALLED = 2,
+#define PR_SIGNALLED PR_SIGNALLED
+ PR_SYSENTRY = 3,
+#define PR_SYSENTRY PR_SYSENTRY
+ PR_SYSEXIT = 4,
+#define PR_SYSEXIT PR_SYSEXIT
+ PR_JOBCONTROL = 5,
+#define PR_JOBCONTROL PR_JOBCONTROL
+ PR_FAULTED = 6,
+#define PR_FAULTED PR_FAULTED
+ PR_SUSPENDED = 7,
+#define PR_SUSPENDED PR_SUSPENDED
+ PR_CHECKPOINT = 8
+#define PR_CHECKPOINT PR_CHECKPOINT
+};
+
+/* /proc/<pid>/lwp/<lwpid>/lwpsinfo */
+typedef struct lwpsinfo
+{
+ int pr_flag;
+ id_t pr_lwpid;
+ uintptr_t pr_addr;
+ uintptr_t pr_wchan;
+ char pr_stype;
+ char pr_state;
+ char pr_sname;
+ char pr_nice;
+ short pr_syscall;
+ char pr_oldpri;
+ char pr_cpu;
+ int pr_pri;
+ unsigned short pr_pctcpu;
+ unsigned short pr_pad;
+ struct timespec pr_start;
+ struct timespec pr_time;
+#define PRFNSZ 16
+ char pr_clname[PRCLSZ];
+ char pr_name[PRFNSZ];
+ processorid_t pr_onpro;
+ processorid_t pr_bindpro;
+ psetid_t pr_bindpset;
+ int pr_lgrp;
+ int pr_filler[4];
+} lwpsinfo_t;
+
+/* pr_ttydev: non-existent device */
+#define PRNODEV (dev_t)(-1)
+
+/* /proc/<pid>/psinfo */
+typedef struct psinfo
+{
+ int pr_flag;
+ int pr_nlwp;
+ pid_t pr_pid;
+ pid_t pr_ppid;
+ pid_t pr_pgid;
+ pid_t pr_sid;
+ uid_t pr_uid;
+ uid_t pr_euid;
+ gid_t pr_gid;
+ gid_t pr_egid;
+ uintptr_t pr_addr;
+ size_t pr_size;
+ size_t pr_rssize;
+ size_t pr_pad1;
+ dev_t pr_ttydev;
+ unsigned short pr_pctcpu;
+ unsigned short pr_pctmem;
+ struct timespec pr_start;
+ struct timespec pr_time;
+ struct timespec pr_ctime;
+ char pr_fname[PRFNSZ];
+#define PRARGSZ 80
+ char pr_psargs[PRARGSZ];
+ int pr_wstat;
+ int pr_argc;
+ uintptr_t pr_argv;
+ uintptr_t pr_envp;
+ char pr_dmodel;
+ char pr_pad2[3];
+ taskid_t pr_taskid;
+ projid_t pr_projid;
+ int pr_nzomb;
+ poolid_t pr_poolid;
+ zoneid_t pr_zoneid;
+ id_t pr_contract;
+ int pr_filler[1];
+ lwpsinfo_t pr_lwp;
+} psinfo_t;
+
+/* /proc/<pid>/map, /proc/<pid>/rmap */
+typedef struct prmap
+{
+ uintptr_t pr_vaddr;
+ size_t pr_size;
+#define PRMAPSZ 64
+ char pr_mapname[PRMAPSZ];
+ offset_t pr_offset;
+ int pr_mflags;
+ int pr_pagesize;
+ int pr_shmid;
+ int pr_filler[1];
+} prmap_t;
+
+/* pr_mflags values */
+#define MA_EXEC 0x0001
+#define MA_WRITE 0x0002
+#define MA_READ 0x0004
+#define MA_SHARED 0x0008
+#define MA_BREAK 0x0010
+#define MA_STACK 0x0020
+#define MA_ANON 0x0040
+#define MA_ISM 0x0080
+#define MA_NORESERVE 0x0100
+#define MA_SHM 0x0200
+#define MA_RESERVED1 0x0400
+
+/* /proc/<pid>/xmap */
+typedef struct prxmap
+{
+ uintptr_t pr_vaddr;
+ size_t pr_size;
+ char pr_mapname[PRMAPSZ];
+ offset_t pr_offset;
+ int pr_mflags;
+ int pr_pagesize;
+ int pr_shmid;
+ dev_t pr_dev;
+ uint64_t pr_ino;
+ size_t pr_rss;
+ size_t pr_anon;
+ size_t pr_locked;
+ size_t pr_pad;
+ uint64_t pr_hatpagesize;
+#if __WORDSIZE == 32
+ unsigned long pr_filler[6];
+#else
+ unsigned long pr_filler[7];
+#endif
+} prxmap_t;
+
+/* pr_mflags */
+#define MA_EXEC 0x0001
+#define MA_WRITE 0x0002
+#define MA_READ 0x0004
+#define MA_SHARED 0x0008
+#define MA_ANON 0x0040
+#define MA_ISM 0x0080
+#define MA_NORESERVE 0x0100
+#define MA_SHM 0x0200
+#define MA_RESERVED1 0x0400
+
+/* /proc/<pid>/cred */
+typedef struct prcred
+{
+ uid_t pr_euid;
+ uid_t pr_ruid;
+ uid_t pr_suid;
+ gid_t pr_egid;
+ gid_t pr_rgid;
+ gid_t pr_sgid;
+ int pr_ngroups;
+ gid_t pr_groups[1];
+} prcred_t;
+
+/* /proc/<pid>/priv */
+typedef struct prpriv
+{
+ uint32_t pr_nsets;
+ uint32_t pr_setsize;
+ uint32_t pr_infosize;
+ priv_chunk_t pr_sets[1];
+} prpriv_t;
+
+/* /proc/<pid>/watch */
+typedef struct prwatch
+{
+ uintptr_t pr_vaddr;
+ size_t pr_size;
+ int pr_wflags;
+ int pr_pad;
+} prwatch_t;
+
+/* pr_wflags */
+#define WA_EXEC 0x01
+#define WA_WRITE 0x02
+#define WA_READ 0x04
+#define WA_TRAPAFTER 0x08
+
+typedef struct priovec {
+ void *pio_base;
+ size_t pio_len;
+ off_t pio_offset;
+} priovec_t;
+
+/* /proc/<pid>/usage, /proc/<pid>/lwp/<lwpid>/lwpusage */
+typedef struct prusage
+{
+ id_t pr_lwpid;
+ int pr_count;
+ struct timespec pr_tstamp;
+ struct timespec pr_create;
+ struct timespec pr_term;
+ struct timespec pr_rtime;
+ struct timespec pr_utime;
+ struct timespec pr_stime;
+ struct timespec pr_ttime;
+ struct timespec pr_tftime;
+ struct timespec pr_dftime;
+ struct timespec pr_kftime;
+ struct timespec pr_ltime;
+ struct timespec pr_slptime;
+ struct timespec pr_wtime;
+ struct timespec pr_stoptime;
+ struct timespec filltime[6];
+ unsigned long pr_minf;
+ unsigned long pr_majf;
+ unsigned long pr_nswap;
+ unsigned long pr_inblk;
+ unsigned long pr_oublk;
+ unsigned long pr_msnd;
+ unsigned long pr_mrcv;
+ unsigned long pr_sigs;
+ unsigned long pr_vctx;
+ unsigned long pr_ictx;
+ unsigned long pr_sysc;
+ unsigned long pr_ioch;
+ unsigned long filler[10];
+} prusage_t;
+
+/* /proc/<pid>/pagedata file header */
+typedef struct prpageheader
+{
+ struct timespec pr_tstamp;
+ long pr_nmap;
+ long pr_npage;
+} prpageheader_t;
+
+/* /proc/<pid>/pagedata mapping header */
+typedef struct prasmap
+{
+ uintptr_t pr_vaddr;
+ size_t pr_npage;
+ char pr_mapname[PRMAPSZ];
+ offset_t pr_offset;
+ int pr_mflags;
+ int pr_pagesize;
+ int pr_shmid;
+ int pr_filler[1];
+} prasmap_t;
+
+/* pr_npage-long byte array (plus 8-byte alignment) of the following flags */
+#define PG_REFERENCED 0x02
+#define PG_MODIFIED 0x01
+#define PG_HWMAPPED 0x04
+
+/* /proc/<pid>/lstatus, /proc/<pid>/lpsinfo, /proc/<pid>/lusage header */
+typedef struct prheader
+{
+ long pr_nent;
+ long pr_entsize;
+} prheader_t;
+
+/* based on sig*set */
+
+#define prfillset(set) \
+ { int __cnt = sizeof (*set) / sizeof (uint32_t); \
+ while (--__cnt >= 0) ((uint32_t *)(set))[__cnt] = 0xFFFFFFFF; }
+
+#define premptyset(set) \
+ { int __cnt = sizeof (*set) / sizeof (uint32_t); \
+ while (--__cnt >= 0) ((uint32_t *)(set))[__cnt] = 0; }
+
+#define __prmask(flag) \
+ (((uint32_t) 1) << (((flag) - 1) % (8 * (int)sizeof (uint32_t))))
+
+# define __prword(flag) (((flag) - 1) / (8 * (int)sizeof (uint32_t)))
+
+#define praddset(set, flag) \
+ (((uint32_t *)(set))[__prword (flag)] |= __prmask (flag))
+
+#define prdelset(set, flag) \
+ (((uint32_t *)(set))[__prword (flag)] &= ~__prmask (flag))
+
+#define prismember(set, flag) \
+ ((((uint32_t *)(set))[__prword (flag)] & __prmask (flag)) ? 1 : 0)
+
+/* Data models. */
+#define PR_MODEL_UNKNOWN 0
+#define PR_MODEL_ILP32 1
+#define PR_MODEL_LP64 2
+#if defined(_LP64)
+# define PR_MODEL_NATIVE PR_MODEL_LP64
+#elif defined(_ILP32)
+# define PR_MODEL_NATIVE PR_MODEL_ILP32
+#else
+# error Unknown data model
+#endif
+
+#endif /* _STRUCTURED_PROC == 0 */
+
+#endif /* _SYS_PROCFS_H */
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/procset.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/procset.h
new file mode 100644
index 0000000000..9104e9ccf8
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/procset.h
@@ -0,0 +1,79 @@
+/* Declarations of procset structures.
+ Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _SYS_PROCSET_H
+#define _SYS_PROCSET_H
+
+#include <sys/types.h>
+#include <features.h>
+
+#if defined __USE_MISC || defined __USE_XOPEN
+typedef enum
+{
+ P_PID,
+ P_PPID,
+ P_PGID,
+ P_SID,
+ P_CID,
+ P_UID,
+ P_GID,
+ P_ALL,
+ P_LWPID,
+ P_TASKID,
+ P_PROJID,
+ P_POOLID,
+ P_ZONEID,
+ P_CTID,
+ P_CPUID,
+ P_PSETID
+} idtype_t;
+#endif
+
+#define P_INITPID 1
+#define P_INITUID 0
+#define P_INITPGID 0
+
+#ifdef __USE_MISC
+typedef enum idop
+{
+ POP_DIFF,
+ POP_AND,
+ POP_OR,
+ POP_XOR
+} idop_t;
+
+typedef struct procset
+{
+ idop_t p_op;
+ idtype_t p_lidtype;
+ id_t p_lid;
+ idtype_t p_ridtype;
+ id_t p_rid;
+} procset_t;
+
+#endif /* __USE_MISC */
+
+#define setprocset(psp, op, lidtype, lid, ridtype, rid) \
+ (psp)->p_op = (op); \
+ (psp)->p_lidtype = (lidtype); \
+ (psp)->p_lid = (lid); \
+ (psp)->p_ridtype = (ridtype); \
+ (psp)->p_rid = (rid);
+
+#endif /* _SYS_PROCSET_H */
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/pset.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/pset.h
new file mode 100644
index 0000000000..b5d326f767
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/pset.h
@@ -0,0 +1,67 @@
+/* Declarations of processor sets.
+ Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _SYS_PSET_H
+#define _SYS_PSET_H
+
+#include <sys/processor.h>
+#include <features.h>
+
+typedef int psetid_t;
+
+/* Syscall sub-call numbers. */
+#define PSET_CREATE 0
+#define PSET_DESTROY 1
+#define PSET_ASSIGN 2
+#define PSET_INFO 3
+#define PSET_BIND 4
+#define PSET_GETLOADAVG 5
+#define PSET_LIST 6
+#define PSET_SETATTR 7
+#define PSET_GETATTR 8
+#define PSET_ASSIGN_FORCED 9
+
+#define PS_NONE -1
+#define PS_QUERY -2
+#define PS_MYID -3
+#define PS_SOFT -4
+#define PS_HARD -5
+#define PS_QUERY_TYPE -6
+
+/* types of processor sets */
+#define PS_SYSTEM 1
+#define PS_PRIVATE 2
+
+__BEGIN_DECLS
+
+extern int pset_create (psetid_t *newpset);
+extern int pset_destroy (psetid_t pset);
+extern int pset_assign (psetid_t pset, processorid_t cpu, psetid_t *opset);
+extern int pset_info (psetid_t pset, int *type, unsigned int *numcpus,
+ processorid_t *cpulist);
+extern int pset_bind (psetid_t pset, idtype_t idtype, id_t id,
+ psetid_t *opset);
+extern int pset_getloadavg (psetid_t pset, double loadavg[], int nelem);
+extern int pset_list (psetid_t *psetlist, unsigned int *numpsets);
+extern int pset_setattr (psetid_t pset, unsigned int attr);
+extern int pset_getattr (psetid_t pset, unsigned int *attr);
+
+__END_DECLS
+
+#endif /* _SYS_PSET_H */
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/ptms.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/ptms.h
new file mode 100644
index 0000000000..2f22e2f5bc
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/ptms.h
@@ -0,0 +1,37 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _PTMS_SYS_H
+#define _PTMS_SYS_H
+
+#include <sys/types.h>
+
+typedef struct pt_own
+ {
+ uid_t pto_ruid;
+ gid_t pto_rgid;
+ } pt_own_t;
+
+#define ISPTM (('P'<<8)|1)
+#define UNLKPT (('P'<<8)|2)
+#define PTSSTTY (('P'<<8)|3)
+#define ZONEPT (('P'<<8)|4)
+#define OWNERPT (('P'<<8)|5)
+
+#endif /* _PTMS_SYS_H */
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/rctl.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/rctl.h
new file mode 100644
index 0000000000..c9b4c3eb85
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/rctl.h
@@ -0,0 +1,93 @@
+/* Declarations of rctl functions and types.
+ Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _SYS_RCTL_H
+#define _SYS_RCTL_H
+
+#include <features.h>
+
+#define RCTL_LOCAL_NOACTION 0x00000000
+#define RCTL_LOCAL_SIGNAL 0x00000001
+#define RCTL_LOCAL_DENY 0x00000002
+#define RCTL_LOCAL_MAXIMAL 0x80000000
+#define RCTL_LOCAL_PROJDB 0x40000000
+#define RCTL_LOCAL_ACTION_MASK 0xFFFF0000
+#define RCTL_LOCAL_MASK 0xC0000003
+
+#define RCTL_GLOBAL_NOACTION 0x00000000
+#define RCTL_GLOBAL_SYSLOG 0x00000001
+#define RCTL_GLOBAL_NOBASIC 0x80000000
+#define RCTL_GLOBAL_LOWERABLE 0x40000000
+#define RCTL_GLOBAL_DENY_ALWAYS 0x20000000
+#define RCTL_GLOBAL_DENY_NEVER 0x10000000
+#define RCTL_GLOBAL_FILE_SIZE 0x08000000
+#define RCTL_GLOBAL_CPU_TIME 0x04000000
+#define RCTL_GLOBAL_SIGNAL_NEVER 0x02000000
+#define RCTL_GLOBAL_NOLOCALACTION RCTL_GLOBAL_SIGNAL_NEVER
+#define RCTL_GLOBAL_INFINITE 0x01000000
+#define RCTL_GLOBAL_UNOBSERVABLE 0x00800000
+#define RCTL_GLOBAL_SYSLOG_NEVER 0x00080000
+#define RCTL_GLOBAL_BYTES 0x00400000
+#define RCTL_GLOBAL_SECONDS 0x00200000
+#define RCTL_GLOBAL_COUNT 0x00100000
+#define RCTL_GLOBAL_ACTION_MASK 0xFFFF0000
+#define RCTL_GLOBAL_MASK 0xFFF80001
+
+#define RCTL_FIRST 0x00000000
+#define RCTL_NEXT 0x00000001
+#define RCTL_USAGE 0x00000002
+
+#define RCTL_INSERT 0x00000000
+#define RCTL_DELETE 0x00000001
+#define RCTL_REPLACE 0x00000002
+
+#define RCTL_USE_RECIPIENT_PID 0x10000000
+
+#define RCTLSYS_ACTION_MASK 0xFFFF0000
+#define RCTLSYS_MASK 0x10000003
+
+#define RCPRIV_BASIC 0x01000000
+#define RCPRIV_PRIVILEGED 0x04000000
+#define RCPRIV_SYSTEM 0x07000000
+
+typedef enum
+ {
+ RCENTITY_PROCESS,
+ RCENTITY_TASK,
+ RCENTITY_PROJECT,
+ RCENTITY_ZONE
+ } rctl_entity_t;
+#define RC_MAX_ENTITY RCENTITY_ZONE
+
+typedef unsigned long long rctl_qty_t;
+typedef int rctl_priv_t;
+typedef struct rctlblk rctlblk_t;
+typedef struct rctl_set rctl_set_t;
+
+__BEGIN_DECLS
+
+int setrctl (const char *controlname, rctlblk_t *old_blk, rctlblk_t *new_blk,
+ unsigned int flags);
+
+int getrctl (const char *controlname, rctlblk_t *old_blk, rctlblk_t *new_blk,
+ unsigned int flags);
+
+__END_DECLS
+
+#endif /* _SYS_RCTL_H */
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/rctl_impl.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/rctl_impl.h
new file mode 100644
index 0000000000..3dfc594b19
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/rctl_impl.h
@@ -0,0 +1,52 @@
+/* Copyright (C) 2009 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _SYS_RCTL_IMPL_H
+#define _SYS_RCTL_IMPL_H
+
+#include <sys/rctl.h>
+#include <sys/types.h>
+#include <features.h>
+
+#define RCTLCTL_GET 0
+#define RCTLCTL_SET 1
+
+typedef struct rctl_opaque
+ {
+ rctl_qty_t rcq_value;
+ rctl_qty_t rcq_enforced_value;
+ rctl_priv_t rcq_privilege;
+ int rcq_global_flagaction;
+ int rcq_global_syslog_level;
+ int rcq_local_flagaction;
+ int rcq_local_signal;
+ id_t rcq_local_recipient_pid;
+ hrtime_t rcq_firing_time;
+ } rctl_opaque_t;
+
+#define RCTLBLK_INC(b, n) (rctlblk_t *)(((char *)b) + (n * rctlblk_size ()))
+
+__BEGIN_DECLS
+
+extern int rctlctl (const char *, rctlblk_t *, int);
+extern size_t rctllist (char *, size_t);
+extern int setprojrctl (const char *, rctlblk_t *, size_t, int);
+
+__END_DECLS
+
+#endif /* _SYS_RCTL_IMPL_H */
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/reboot.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/reboot.h
new file mode 100644
index 0000000000..4f0ff0e161
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/reboot.h
@@ -0,0 +1,52 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _SYS_REBOOT_H
+#define _SYS_REBOOT_H
+
+#include <features.h>
+
+#define RB_AUTOBOOT 0
+#define RB_ASKNAME 0x00000001
+#define RB_SINGLE 0x00000002
+#define RB_NOSYNC 0x00000004
+#define RB_HALT 0x00000008
+#define RB_INITNAME 0x00000010
+#define RB_NOBOOTRC 0x00000020
+#define RB_DEBUG 0x00000040
+#define RB_DUMP 0x00000080
+#define RB_WRITABLE 0x00000100
+#define RB_STRING 0x00000200
+#define RB_CONFIG 0x00000800
+#define RB_RECONFIG 0x00001000
+#define RB_VERBOSE 0x00002000
+#define RB_FORTHDEBUG 0x00004000
+#define RB_FORTHDEBUGDBP 0x00008000
+#define RB_KMDB 0x00020000
+#define RB_NOBOOTCLUSTER 0x00040000
+#define RB_DEBUGENTER 0x00080000
+
+__BEGIN_DECLS
+
+/* Reboot or halt the system. */
+extern int reboot (int __howto, char *bootargs) __THROW;
+
+__END_DECLS
+
+#endif /* _SYS_REBOOT_H */
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/reg.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/reg.h
new file mode 100644
index 0000000000..edcd34fee2
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/reg.h
@@ -0,0 +1 @@
+#include <sys/regset.h>
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/sendfile.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/sendfile.h
new file mode 100644
index 0000000000..bb29d07511
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/sendfile.h
@@ -0,0 +1,91 @@
+/* sendfile -- copy data directly from one file descriptor to another
+ Copyright (C) 1998,99,01,2002,2004,2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _SYS_SENDFILE_H
+#define _SYS_SENDFILE_H 1
+
+#include <features.h>
+#include <sys/types.h>
+
+#define SENDFILEV 0
+#define SENDFILEV64 1
+
+#define SFV_FD_SELF (-2)
+
+typedef struct sendfilevec
+{
+ int sfv_fd;
+ unsigned int sfv_flag;
+ off_t sfv_off;
+ size_t sfv_len;
+} sendfilevec_t;
+
+#ifdef __USE_LARGEFILE64
+typedef struct sendfilevec64
+{
+ int sfv_fd;
+ unsigned int sfv_flag;
+ off64_t sfv_off;
+ size_t sfv_len;
+} sendfilevec64_t;
+#endif
+
+__BEGIN_DECLS
+
+/* Send up to COUNT bytes from file associated with IN_FD starting at
+ *OFFSET to descriptor OUT_FD. Set *OFFSET to the IN_FD's file position
+ following the read bytes. If OFFSET is a null pointer, use the normal
+ file position instead. Return the number of written bytes, or -1 in
+ case of error. */
+#ifndef __USE_FILE_OFFSET64
+extern ssize_t sendfile (int __out_fd, int __in_fd, off_t *__offset,
+ size_t __count) __THROW;
+#else
+# ifdef __REDIRECT_NTH
+extern ssize_t __REDIRECT_NTH (sendfile,
+ (int __out_fd, int __in_fd, __off64_t *__offset,
+ size_t __count), sendfile64);
+# else
+# define sendfile sendfile64
+# endif
+#endif
+#ifdef __USE_LARGEFILE64
+extern ssize_t sendfile64 (int __out_fd, int __in_fd, __off64_t *__offset,
+ size_t __count) __THROW;
+#endif
+
+#ifndef __USE_FILE_OFFSET64
+extern ssize_t sendfilev (int, const sendfilevec_t *,
+ int, size_t *) __THROW;
+#else
+# ifdef __REDIRECT_NTH
+extern ssize_t __REDIRECT_NTH (sendfilev,
+ (int, const sendfilevec64_t *, int, size_t *), sendfilev64);
+# else
+# define sendfilev sendfilev64
+# endif
+#endif
+#ifdef __USE_LARGEFILE64
+extern ssize_t sendfilev64 (int, const sendfilevec64_t *,
+ int, size_t *) __THROW;
+#endif
+
+__END_DECLS
+
+#endif /* sys/sendfile.h */
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/sid.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/sid.h
new file mode 100644
index 0000000000..ebb481dfc4
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/sid.h
@@ -0,0 +1,28 @@
+/* Copyright (C) 2009 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _SYS_SID_H
+#define _SYS_SID_H
+
+#include <sys/types.h>
+
+int allocids (int, int, uid_t *, int, gid_t *);
+int idmap_reg (int);
+int idmap_unreg (int);
+
+#endif /* _SYS_SID_H */
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/siginfo.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/siginfo.h
new file mode 100644
index 0000000000..b1ddf1ffee
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/siginfo.h
@@ -0,0 +1,25 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _SYS_SIGINFO_H
+#define _SYS_SIGINFO_H
+
+#define __need_siginfo_t
+#include <bits/siginfo.h>
+
+#endif /* _SYS_SIGINFO_H */
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/sockio.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/sockio.h
new file mode 100644
index 0000000000..6ec92cf732
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/sockio.h
@@ -0,0 +1 @@
+#include <sys/ioctl.h>
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/swap.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/swap.h
new file mode 100644
index 0000000000..2e8476695f
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/swap.h
@@ -0,0 +1,78 @@
+/* Calls to enable and disable swapping on specified locations.
+ OpenSolaris version.
+ Copyright (C) 1996, 1997, 2000, 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef __SYS_SWAP_H
+#define __SYS_SWAP_H
+
+/* Docs: http://docs.sun.com/app/docs/doc/816-5167/swapctl-2?a=view */
+
+#include <features.h>
+#include <bits/types.h>
+
+/* swapctl cmd values. */
+#define SC_ADD 1
+#define SC_LIST 2
+#define SC_REMOVE 3
+#define SC_GETNSWP 4
+#define SC_AINFO 5
+
+/* swapctl arg for SC_ADD and SC_REMOVE. */
+typedef struct swapres
+ {
+ char *sr_name;
+ __off_t sr_start;
+ __off_t sr_length;
+ } swapres_t;
+
+typedef struct swapent
+ {
+ char *ste_path;
+ __off_t ste_start;
+ __off_t ste_length;
+ long ste_pages;
+ long ste_free;
+ int ste_flags;
+ } swapent_t;
+
+/* ste_flags values. */
+#define ST_INDEL 1
+#define ST_DOINGDEL 2
+
+/* swapctl arg for SC_LIST. */
+typedef struct swaptable
+ {
+ int swt_n;
+ swapent_t swt_ent[1];
+ } swaptbl_t;
+
+__BEGIN_DECLS
+
+/* Make the block special device PATH available to the system for swapping.
+ This call is restricted to the super-user. */
+extern int swapon (__const char *__path) __THROW;
+
+/* Stop using block special device PATH for swapping. */
+extern int swapoff (__const char *__path) __THROW;
+
+extern int swapctl (int cmd, void *arg);
+
+__END_DECLS
+
+#endif /* sys/swap.h */
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/syscall.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/syscall.h
new file mode 100644
index 0000000000..4ff347c272
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/syscall.h
@@ -0,0 +1,301 @@
+/* Copyright (C) 1998, 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _SYSCALL_H
+#define _SYSCALL_H 1
+
+/* OpenSolaris syscall numbers */
+
+#define SYS_syscall 0
+#define SYS_exit 1
+#define SYS_forkall 2
+#define SYS_read 3
+#define SYS_write 4
+#define SYS_open 5
+#define SYS_close 6
+#define SYS_wait 7
+#define SYS_creat 8
+#define SYS_link 9
+#define SYS_unlink 10
+#define SYS_exec 11
+#define SYS_chdir 12
+#define SYS_time 13
+#define SYS_mknod 14
+#define SYS_chmod 15
+#define SYS_chown 16
+#define SYS_brk 17
+#define SYS_stat 18
+#define SYS_lseek 19
+#define SYS_getpid 20
+#define SYS_mount 21
+#define SYS_umount 22
+#define SYS_setuid 23
+#define SYS_getuid 24
+#define SYS_stime 25
+#define SYS_pcsample 26
+#define SYS_alarm 27
+#define SYS_fstat 28
+#define SYS_pause 29
+#define SYS_utime 30
+#define SYS_stty 31
+#define SYS_gtty 32
+#define SYS_access 33
+#define SYS_nice 34
+#define SYS_statfs 35
+#define SYS_sync 36
+#define SYS_kill 37
+#define SYS_fstatfs 38
+#define SYS_pgrpsys 39
+#define SYS_uucopystr 40
+#define SYS_dup 41
+#define SYS_pipe 42
+#define SYS_times 43
+#define SYS_profil 44
+#define SYS_plock 45
+#define SYS_setgid 46
+#define SYS_getgid 47
+#define SYS_signal 48
+#define SYS_msgsys 49
+#define SYS_syssun 50
+#define SYS_sysi86 50
+#define SYS_sysppc 50
+#define SYS_acct 51
+#define SYS_shmsys 52
+#define SYS_semsys 53
+#define SYS_ioctl 54
+#define SYS_uadmin 55
+#define SYS_utssys 57
+#define SYS_fdsync 58
+#define SYS_execve 59
+#define SYS_umask 60
+#define SYS_chroot 61
+#define SYS_fcntl 62
+#define SYS_ulimit 63
+/* 64 - 69 are reserved */
+#define SYS_tasksys 70
+#define SYS_acctctl 71
+#define SYS_exacctsys 72
+#define SYS_getpagesizes 73
+#define SYS_rctlsys 74
+#define SYS_sidsys 75
+#define SYS_fsat 76
+#define SYS_lwp_park 77
+#define SYS_sendfilev 78
+#define SYS_rmdir 79
+#define SYS_mkdir 80
+#define SYS_getdents 81
+#define SYS_privsys 82
+#define SYS_ucredsys 83
+#define SYS_sysfs 84
+#define SYS_getmsg 85
+#define SYS_putmsg 86
+#define SYS_poll 87
+#define SYS_lstat 88
+#define SYS_symlink 89
+#define SYS_readlink 90
+#define SYS_setgroups 91
+#define SYS_getgroups 92
+#define SYS_fchmod 93
+#define SYS_fchown 94
+#define SYS_sigprocmask 95
+#define SYS_sigsuspend 96
+#define SYS_sigaltstack 97
+#define SYS_sigaction 98
+#define SYS_sigpending 99
+#define SYS_context 100
+#define SYS_evsys 101
+#define SYS_evtrapret 102
+#define SYS_statvfs 103
+#define SYS_fstatvfs 104
+#define SYS_getloadavg 105
+#define SYS_nfssys 106
+#define SYS_waitid 107
+#define SYS_waitsys SYS_waitid
+#define SYS_sigsendsys 108
+#define SYS_hrtsys 109
+/* 110 unused */
+#define SYS_sigresend 111
+#define SYS_priocntlsys 112
+#define SYS_pathconf 113
+#define SYS_mincore 114
+#define SYS_mmap 115
+#define SYS_mprotect 116
+#define SYS_munmap 117
+#define SYS_fpathconf 118
+#define SYS_vfork 119
+#define SYS_fchdir 120
+#define SYS_readv 121
+#define SYS_writev 122
+#define SYS_xstat 123
+#define SYS_lxstat 124
+#define SYS_fxstat 125
+#define SYS_xmknod 126
+/* 127 unused */
+#define SYS_setrlimit 128
+#define SYS_getrlimit 129
+#define SYS_lchown 130
+#define SYS_memcntl 131
+#define SYS_getpmsg 132
+#define SYS_putpmsg 133
+#define SYS_rename 134
+#define SYS_uname 135
+#define SYS_setegid 136
+#define SYS_sysconfig 137
+#define SYS_adjtime 138
+#define SYS_systeminfo 139
+#define SYS_sharefs 140
+#define SYS_seteuid 141
+#define SYS_forksys 142
+#define SYS_fork1 143
+#define SYS_sigtimedwait 144
+#define SYS_lwp_info 145
+#define SYS_yield 146
+#define SYS_lwp_sema_wait 147
+#define SYS_lwp_sema_post 148
+#define SYS_lwp_sema_trywait 149
+#define SYS_lwp_detach 150
+#define SYS_corectl 151
+#define SYS_modctl 152
+#define SYS_fchroot 153
+#define SYS_utimes 154
+#define SYS_vhangup 155
+#define SYS_gettimeofday 156
+#define SYS_getitimer 157
+#define SYS_setitimer 158
+#define SYS_lwp_create 159
+#define SYS_lwp_exit 160
+#define SYS_lwp_suspend 161
+#define SYS_lwp_continue 162
+#define SYS_lwp_kill 163
+#define SYS_lwp_self 164
+#define SYS_lwp_sigmask 165
+#define SYS_lwp_private 166
+#define SYS_lwp_wait 167
+#define SYS_lwp_mutex_wakeup 168
+#define SYS_lwp_mutex_lock 169
+#define SYS_lwp_cond_wait 170
+#define SYS_lwp_cond_signal 171
+#define SYS_lwp_cond_broadcast 172
+#define SYS_pread 173
+#define SYS_pwrite 174
+#define SYS_llseek 175
+#define SYS_inst_sync 176
+#define SYS_brand 177
+#define SYS_kaio 178
+#define SYS_cpc 179
+#define SYS_lgrpsys 180
+#define SYS_meminfosys SYS_lgrpsys
+#define SYS_rusagesys 181
+#define SYS_port 182
+#define SYS_pollsys 183
+#define SYS_labelsys 184
+#define SYS_acl 185
+#define SYS_auditsys 186
+#define SYS_processor_bind 187
+#define SYS_processor_info 188
+#define SYS_p_online 189
+#define SYS_sigqueue 190
+#define SYS_clock_gettime 191
+#define SYS_clock_settime 192
+#define SYS_clock_getres 193
+#define SYS_timer_create 194
+#define SYS_timer_delete 195
+#define SYS_timer_settime 196
+#define SYS_timer_gettime 197
+#define SYS_timer_getoverrun 198
+#define SYS_nanosleep 199
+#define SYS_facl 200
+#define SYS_door 201
+#define SYS_setreuid 202
+#define SYS_setregid 203
+#define SYS_install_utrap 204
+#define SYS_signotify 205
+#define SYS_schedctl 206
+#define SYS_pset 207
+#define SYS_sparc_utrap_install 208
+#define SYS_resolvepath 209
+#define SYS_lwp_mutex_timedlock 210
+#define SYS_lwp_sema_timedwait 211
+#define SYS_lwp_rwlock_sys 212
+#define SYS_getdents64 213
+#define SYS_mmap64 214
+#define SYS_stat64 215
+#define SYS_lstat64 216
+#define SYS_fstat64 217
+#define SYS_statvfs64 218
+#define SYS_fstatvfs64 219
+#define SYS_setrlimit64 220
+#define SYS_getrlimit64 221
+#define SYS_pread64 222
+#define SYS_pwrite64 223
+#define SYS_creat64 224
+#define SYS_open64 225
+#define SYS_rpcsys 226
+#define SYS_zone 227
+#define SYS_autofssys 228
+#define SYS_getcwd 229
+#define SYS_so_socket 230
+#define SYS_so_socketpair 231
+#define SYS_bind 232
+#define SYS_listen 233
+#define SYS_accept 234
+#define SYS_connect 235
+#define SYS_shutdown 236
+#define SYS_recv 237
+#define SYS_recvfrom 238
+#define SYS_recvmsg 239
+#define SYS_send 240
+#define SYS_sendmsg 241
+#define SYS_sendto 242
+#define SYS_getpeername 243
+#define SYS_getsockname 244
+#define SYS_getsockopt 245
+#define SYS_setsockopt 246
+#define SYS_sockconfig 247
+#define SYS_ntp_gettime 248
+#define SYS_ntp_adjtime 249
+#define SYS_lwp_mutex_unlock 250
+#define SYS_lwp_mutex_trylock 251
+#define SYS_lwp_mutex_register 252
+#define SYS_cladm 253
+#define SYS_uucopy 254
+#define SYS_umount2 255
+
+#ifndef __ASSEMBLER__
+typedef struct
+ {
+ unsigned int word[16];
+ } sysset_t;
+
+typedef struct
+ {
+ long sys_rval1;
+ long sys_rval2;
+ } sysret_t;
+
+#include <features.h>
+
+__BEGIN_DECLS
+
+extern int __systemcall (sysret_t *, int, ...);
+
+__END_DECLS
+
+#endif
+
+#endif /* sys/syscall.h */
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/sysconfig.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/sysconfig.h
new file mode 100644
index 0000000000..c93c572f00
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/sysconfig.h
@@ -0,0 +1,66 @@
+/* Definitions for sysconfig found on Solaris systems.
+ Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _BITS_SYSCONFIG_H
+#define _BITS_SYSCONFIG_H
+
+#define _CONFIG_NGROUPS 2
+#define _CONFIG_CHILD_MAX 3
+#define _CONFIG_OPEN_FILES 4
+#define _CONFIG_POSIX_VER 5
+#define _CONFIG_PAGESIZE 6
+#define _CONFIG_CLK_TCK 7
+#define _CONFIG_XOPEN_VER 8
+#define _CONFIG_PROF_TCK 10
+#define _CONFIG_NPROC_CONF 11
+#define _CONFIG_NPROC_ONLN 12
+#define _CONFIG_AIO_LISTIO_MAX 13
+#define _CONFIG_AIO_MAX 14
+#define _CONFIG_AIO_PRIO_DELTA_MAX 15
+#define _CONFIG_DELAYTIMER_MAX 16
+#define _CONFIG_MQ_OPEN_MAX 17
+#define _CONFIG_MQ_PRIO_MAX 18
+#define _CONFIG_RTSIG_MAX 19
+#define _CONFIG_SEM_NSEMS_MAX 20
+#define _CONFIG_SEM_VALUE_MAX 21
+#define _CONFIG_SIGQUEUE_MAX 22
+#define _CONFIG_SIGRT_MIN 23
+#define _CONFIG_SIGRT_MAX 24
+#define _CONFIG_TIMER_MAX 25
+#define _CONFIG_PHYS_PAGES 26
+#define _CONFIG_AVPHYS_PAGES 27
+#define _CONFIG_COHERENCY 28
+#define _CONFIG_SPLIT_CACHE 29
+#define _CONFIG_ICACHESZ 30
+#define _CONFIG_DCACHESZ 31
+#define _CONFIG_ICACHELINESZ 32
+#define _CONFIG_DCACHELINESZ 33
+#define _CONFIG_ICACHEBLKSZ 34
+#define _CONFIG_DCACHEBLKSZ 35
+#define _CONFIG_DCACHETBLKSZ 36
+#define _CONFIG_ICACHE_ASSOC 37
+#define _CONFIG_DCACHE_ASSOC 38
+#define _CONFIG_MAXPID 42
+#define _CONFIG_STACK_PROT 43
+#define _CONFIG_NPROC_MAX 44
+#define _CONFIG_CPUID_MAX 45
+#define _CONFIG_SYMLOOP_MAX 46
+#define _CONFIG_EPHID_MAX 47
+
+#endif /* _BITS_SYSCONFIG_H */
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/sysmacros.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/sysmacros.h
new file mode 100644
index 0000000000..74095a247c
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/sysmacros.h
@@ -0,0 +1,107 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _SYS_SYSMACROS_H
+#define _SYS_SYSMACROS_H
+
+#include <features.h>
+#include <sys/isa_defs.h>
+
+#ifdef __USE_MISC
+
+# define dtob(DD) ((DD) << DEV_BSHIFT)
+# define btod(BB) (((BB) + DEV_BSIZE - 1) >> DEV_BSHIFT)
+# define btodt(BB) ((BB) >> DEV_BSHIFT)
+# define lbtod(BB) (((offset_t)(BB) + DEV_BSIZE - 1) >> DEV_BSHIFT)
+
+# define O_BITSMAJOR 7
+# define O_BITSMINOR 8
+# define O_MAXMAJ 0x7f
+# define O_MAXMIN 0xff
+# define L_BITSMAJOR32 14
+# define L_BITSMINOR32 18
+# define L_MAXMAJ32 0x3fff
+# define L_MAXMIN32 0x3ffff
+
+# ifdef _LP64
+# define L_BITSMAJOR 32
+# define L_BITSMINOR 32
+# define L_MAXMAJ 0xfffffffful
+# define L_MAXMIN 0xfffffffful
+# else
+# define L_BITSMAJOR L_BITSMAJOR32
+# define L_BITSMINOR L_BITSMINOR32
+# define L_MAXMAJ L_MAXMAJ32
+# define L_MAXMIN L_MAXMIN32
+# endif
+
+# define major(x) (major_t)(((dev_t)(x)) >> L_BITSMINOR)
+# define getmajor(x) major(x)
+# define minor(x) (minor_t)((x) & L_MAXMIN)
+# define getminor(x) minor(x)
+
+# define makedev(x, y) (dev_t)(((dev_t)(x) << L_BITSMINOR) | \
+ ((y) & L_MAXMIN))
+# define makedevice(x, y) makedev(x, y)
+
+# define emajor(x) (major_t)(((unsigned int)(x) >> O_BITSMINOR) > \
+ O_MAXMAJ) ? NODEV : (((unsigned int)(x) >> O_BITSMINOR) & O_MAXMAJ)
+# define eminor(x) (minor_t)((x) & O_MAXMIN)
+
+# define cmpdev(x) (o_dev_t)((((x) >> L_BITSMINOR) > O_MAXMAJ || \
+ ((x) & L_MAXMIN) > O_MAXMIN) ? NODEV : \
+ ((((x) >> L_BITSMINOR) << O_BITSMINOR) | ((x) & O_MAXMIN)))
+# define expdev(x) (dev_t)(((dev_t)(((x) >> O_BITSMINOR) & O_MAXMAJ) << \
+ L_BITSMINOR) | ((x) & O_MAXMIN))
+
+# define howmany(x, y) (((x)+((y)-1))/(y))
+# define roundup(x, y) ((((x)+((y)-1))/(y))*(y))
+
+# define IS_P2ALIGNED(v, a) ((((uintptr_t)(v)) & ((uintptr_t)(a) - 1)) == 0)
+# define ISP2(x) (((x) & ((x) - 1)) == 0)
+
+# define P2ALIGN(x, align) ((x) & -(align))
+# define P2PHASE(x, align) ((x) & ((align) - 1))
+# define P2NPHASE(x, align) (-(x) & ((align) - 1))
+# define P2ROUNDUP(x, align) (-(-(x) & -(align)))
+# define P2END(x, align) (-(~(x) & -(align)))
+# define P2PHASEUP(x, align, phase) ((phase) - (((phase) - (x)) & -(align)))
+# define P2CROSS(x, y, align) (((x) ^ (y)) > (align) - 1)
+# define P2SAMEHIGHBIT(x, y) (((x) ^ (y)) < ((x) & (y)))
+
+# define P2ALIGN_TYPED(x, align, type) ((type)(x) & -(type)(align))
+# define P2PHASE_TYPED(x, align, type) ((type)(x) & ((type)(align) - 1))
+# define P2NPHASE_TYPED(x, align, type) (-(type)(x) & ((type)(align) - 1))
+# define P2ROUNDUP_TYPED(x, align, type) (-(-(type)(x) & -(type)(align)))
+# define P2END_TYPED(x, align, type) (-(~(type)(x) & -(type)(align)))
+# define P2PHASEUP_TYPED(x, align, phase, type) ((type)(phase) - \
+ (((type)(phase) - (type)(x)) & -(type)(align)))
+# define P2CROSS_TYPED(x, y, align, type) (((type)(x) ^ (type)(y)) > \
+ (type)(align) - 1)
+# define P2SAMEHIGHBIT_TYPED(x, y, type) (((type)(x) ^ (type)(y)) < \
+ ((type)(x) & (type)(y)))
+
+/* For compatibility with GNU/Linux. */
+# define gnu_dev_major(dev) major (dev)
+# define gnu_dev_minor(dev) minor (dev)
+# define gnu_dev_makedev(maj, min) makedev (maj, min)
+
+#endif /* __USE_MISC */
+
+#endif /* _SYS_SYSMACROS_H */
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/systeminfo.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/systeminfo.h
new file mode 100644
index 0000000000..ac32b78811
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/systeminfo.h
@@ -0,0 +1,53 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _SYSTEMINFO_H
+#define _SYSTEMINFO_H
+
+#include <features.h>
+
+#define SI_SYSNAME 1
+#define SI_HOSTNAME 2
+#define SI_RELEASE 3
+#define SI_VERSION 4
+#define SI_MACHINE 5
+#define SI_ARCHITECTURE 6
+#define SI_HW_SERIAL 7
+#define SI_HW_PROVIDER 8
+#define SI_SRPC_DOMAIN 9
+
+#define SI_SET_HOSTNAME 258
+
+#define SI_SET_SRPC_DOMAIN 265
+
+#define SI_PLATFORM 513
+#define SI_ISALIST 514
+#define SI_DHCP_CACHE 515
+#define SI_ARCHITECTURE_32 516
+#define SI_ARCHITECTURE_64 517
+#define SI_ARCHITECTURE_K 518
+#define SI_ARCHITECTURE_NATIVE 519
+
+__BEGIN_DECLS
+
+extern long sysinfo (int command, char *buf, long count);
+
+__END_DECLS
+
+#endif /* _SYSTEMINFO_H */
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/task.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/task.h
new file mode 100644
index 0000000000..ab51c85b61
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/task.h
@@ -0,0 +1,44 @@
+/* Declarations of privilege functions and types.
+ Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _SYS_TASK_H
+#define _SYS_TASK_H
+
+#include <sys/types.h>
+#include <sys/rctl.h>
+#include <sys/param.h>
+#include <features.h>
+
+#define TASK_NORMAL 0x00
+#define TASK_FINAL 0x01
+#define TASK_MASK 0x01
+
+#define TASK_PROJ_PURGE 0x00100000
+#define TASK_PROJ_MASK 0x00100000
+
+struct task;
+
+__BEGIN_DECLS
+
+extern taskid_t settaskid (projid_t, unsigned int);
+extern taskid_t gettaskid (void);
+
+__END_DECLS
+
+#endif /* _SYS_TASK_H */
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/termio.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/termio.h
new file mode 100644
index 0000000000..1da76d5058
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/termio.h
@@ -0,0 +1 @@
+#include <sys/termios.h>
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/time_impl.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/time_impl.h
new file mode 100644
index 0000000000..18a03a58e7
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/time_impl.h
@@ -0,0 +1 @@
+#include <sys/time.h>
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/timex.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/timex.h
new file mode 100644
index 0000000000..8a59d5fe06
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/timex.h
@@ -0,0 +1,155 @@
+/* Copyright (C) 1995, 1996, 1997, 1999, 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _SYS_TIMEX_H
+#define _SYS_TIMEX_H 1
+
+#include <features.h>
+#include <sys/time.h>
+#include <sys/types.h>
+
+struct ntptimeval
+{
+ struct timeval time; /* current time (ro) */
+ int32_t maxerror; /* maximum error (us) (ro) */
+ int32_t esterror; /* estimated error (us) (ro) */
+};
+
+#ifdef _SYSCALL32
+# include <sys/types32.h>
+struct ntptimeval32
+{
+ struct timeval32 time;
+ int32_t maxerror;
+ int32_t esterror;
+};
+#endif
+
+struct timex
+{
+ uint32_t modes; /* mode selector */
+ int32_t offset; /* time offset (usec) */
+ int32_t freq; /* frequency offset (scaled ppm) */
+ int32_t maxerror; /* maximum error (usec) */
+ int32_t esterror; /* estimated error (usec) */
+ int32_t status; /* clock command/status */
+ int32_t constant; /* pll time constant */
+ int32_t precision; /* clock precision (usec) (read only) */
+ int32_t tolerance; /* clock frequency tolerance (ppm) (read only) */
+ int32_t ppsfreq; /* pps frequency (scaled ppm) (ro) */
+ int32_t jitter; /* pps jitter (us) (ro) */
+ int32_t shift; /* interval duration (s) (shift) (ro) */
+ int32_t stabil; /* pps stability (scaled ppm) (ro) */
+ int32_t jitcnt; /* jitter limit exceeded (ro) */
+ int32_t calcnt; /* calibration intervals (ro) */
+ int32_t errcnt; /* calibration errors (ro) */
+ int32_t stbcnt; /* stability limit exceeded (ro) */
+};
+
+/* Engineering parameters of the PLL. */
+#define SCALE_KG (1<<6)
+#define SCALE_KF (1<<16)
+#define SCALE_KH (1<<2)
+#define MAXTC (1<<6)
+
+
+/* PLL variables. */
+#define SCALE_PHASE (1<<22)
+#define SCALE_USEC (1<<16)
+#define SCALE_UPDATE (SCALE_KG * MAXTC)
+#define FINEUSEC (1<<22)
+
+/* Performance envelope of the PLL. */
+#define MAXPHASE 512000
+#define MAXFREQ (512 * SCALE_USEC)
+#define MAXTIME (200 << PPS_AVG)
+#define MINSEC 16
+#define MAXSEC 1200
+
+/* Used if pulse-per-second (PPS) is present. */
+#define PPS_AVG 2
+#define PPS_SHIFT 2
+#define PPS_SHIFTMAX 8
+#define PPS_VALID 120
+#define MAXGLITCH 30
+
+/* Mode codes (timex.mode) */
+#define ADJ_OFFSET 0x0001 /* time offset */
+#define ADJ_FREQUENCY 0x0002 /* frequency offset */
+#define ADJ_MAXERROR 0x0004 /* maximum time error */
+#define ADJ_ESTERROR 0x0008 /* estimated time error */
+#define ADJ_STATUS 0x0010 /* clock status */
+#define ADJ_TIMECONST 0x0020 /* pll time constant */
+#define ADJ_TICK 0x4000 /* tick value */
+#define ADJ_OFFSET_SINGLESHOT 0x8000 /* old-fashioned adjtime */
+
+/* xntp 3.4 compatibility names */
+#define MOD_OFFSET ADJ_OFFSET
+#define MOD_FREQUENCY ADJ_FREQUENCY
+#define MOD_MAXERROR ADJ_MAXERROR
+#define MOD_ESTERROR ADJ_ESTERROR
+#define MOD_STATUS ADJ_STATUS
+#define MOD_TIMECONST ADJ_TIMECONST
+#define MOD_CLKB ADJ_TICK
+#define MOD_CLKA ADJ_OFFSET_SINGLESHOT /* 0x8000 in original */
+
+
+/* Status codes (timex.status) */
+#define STA_PLL 0x0001 /* enable PLL updates (rw) */
+#define STA_PPSFREQ 0x0002 /* enable PPS freq discipline (rw) */
+#define STA_PPSTIME 0x0004 /* enable PPS time discipline (rw) */
+#define STA_FLL 0x0008 /* select frequency-lock mode (rw) */
+
+#define STA_INS 0x0010 /* insert leap (rw) */
+#define STA_DEL 0x0020 /* delete leap (rw) */
+#define STA_UNSYNC 0x0040 /* clock unsynchronized (rw) */
+#define STA_FREQHOLD 0x0080 /* hold frequency (rw) */
+
+#define STA_PPSSIGNAL 0x0100 /* PPS signal present (ro) */
+#define STA_PPSJITTER 0x0200 /* PPS signal jitter exceeded (ro) */
+#define STA_PPSWANDER 0x0400 /* PPS signal wander exceeded (ro) */
+#define STA_PPSERROR 0x0800 /* PPS signal calibration error (ro) */
+
+#define STA_CLOCKERR 0x1000 /* clock hardware fault (ro) */
+
+#define STA_RONLY (STA_PPSSIGNAL | STA_PPSJITTER | STA_PPSWANDER | \
+ STA_PPSERROR | STA_CLOCKERR) /* read-only bits */
+
+/* Clock states (time_state) */
+#define TIME_OK 0 /* clock synchronized, no leap second */
+#define TIME_INS 1 /* insert leap second */
+#define TIME_DEL 2 /* delete leap second */
+#define TIME_OOP 3 /* leap second in progress */
+#define TIME_WAIT 4 /* leap second has occurred */
+#define TIME_ERROR 5 /* clock not synchronized */
+#define TIME_BAD TIME_ERROR /* bw compat */
+
+/* Maximum time constant of the PLL. */
+#define MAXTC 6
+
+__BEGIN_DECLS
+
+extern int __adjtimex (struct timex *__ntx) __THROW;
+extern int adjtimex (struct timex *__ntx) __THROW;
+
+extern int ntp_gettime (struct ntptimeval *__ntv) __THROW;
+extern int ntp_adjtime (struct timex *__tntx) __THROW;
+
+__END_DECLS
+
+#endif /* sys/timex.h */
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/tsol/label.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/tsol/label.h
new file mode 100644
index 0000000000..0feca36f97
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/tsol/label.h
@@ -0,0 +1,44 @@
+/* Copyright (C) 2008, 2009 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _SYS_TSOL_LABEL_H
+#define _SYS_TSOL_LABEL_H
+
+#include <sys/types.h>
+
+typedef struct _mac_label_impl m_label_t;
+typedef m_label_t blevel_t;
+typedef m_label_t bslabel_t;
+typedef m_label_t bclear_t;
+
+typedef struct _tsol_binary_level_lrange
+ {
+ m_label_t *lower_bound;
+ m_label_t *upper_bound;
+ } m_range_t;
+
+typedef m_range_t blrange_t;
+
+typedef struct tsol_mlp_s
+ {
+ unsigned char mlp_ipp;
+ uint16_t mlp_port;
+ uint16_t mlp_port_upper;
+ } tsol_mlp_t;
+
+#endif /* _SYS_TSOL_LABEL_H */
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/ttold.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/ttold.h
new file mode 100644
index 0000000000..755272bbf6
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/ttold.h
@@ -0,0 +1,35 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _SYS_TTOLD_H
+#define _SYS_TTOLD_H
+
+#include <sys/ioctl.h>
+
+struct tc
+ {
+ char t_intrc;
+ char t_quitc;
+ char t_startc;
+ char t_stopc;
+ char t_eofc;
+ char t_brkc;
+ };
+
+#endif /* _SYS_TTOLD_H */
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/tty.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/tty.h
new file mode 100644
index 0000000000..e2e0dac385
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/tty.h
@@ -0,0 +1,25 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _SYS_TTY_H
+#define _SYS_TTY_H
+
+#include <sys/termios.h>
+
+#endif /* _SYS_TTY_H */
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/ttydefaults.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/ttydefaults.h
new file mode 100644
index 0000000000..555ba51966
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/ttydefaults.h
@@ -0,0 +1,101 @@
+/*-
+ * Copyright (c) 1982, 1986, 1993
+ * The Regents of the University of California. All rights reserved.
+ * (c) UNIX System Laboratories, Inc.
+ * All or some portions of this file are derived from material licensed
+ * to the University of California by American Telephone and Telegraph
+ * Co. or Unix System Laboratories, Inc. and are reproduced herein with
+ * the permission of UNIX System Laboratories, Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * @(#)ttydefaults.h 8.4 (Berkeley) 1/21/94
+ */
+
+/*
+ * System wide defaults for terminal state. 4.4 BSD/generic GNU version.
+ */
+#ifndef _SYS_TTYDEFAULTS_H_
+#define _SYS_TTYDEFAULTS_H_
+
+/*
+ * Defaults on "first" open.
+ */
+#define TTYDEF_IFLAG (BRKINT | ISTRIP | ICRNL | IMAXBEL | IXON | IXANY)
+#define TTYDEF_OFLAG (OPOST | ONLCR | OXTABS)
+#define TTYDEF_LFLAG (ECHO | ICANON | ISIG | IEXTEN | ECHOE|ECHOKE|ECHOCTL)
+#define TTYDEF_CFLAG (CREAD | CS7 | PARENB | HUPCL)
+#define TTYDEF_SPEED (B9600)
+
+/*
+ * Control Character Defaults
+ */
+#define CTRL(x) (x&037)
+#define CEOF CTRL('d')
+#ifdef _POSIX_VDISABLE
+# define CEOL _POSIX_VDISABLE
+#else
+# define CEOL ((unsigned char)'\377') /* XXX avoid _POSIX_VDISABLE */
+#endif
+#define CERASE 0177
+#define CINTR CTRL('c')
+#ifdef _POSIX_VDISABLE
+# define CSTATUS _POSIX_VDISABLE
+#else
+# define CSTATUS ((unsigned char)'\377') /* XXX avoid _POSIX_VDISABLE */
+#endif
+#define CKILL CTRL('u')
+#define CMIN 1
+#define CQUIT 034 /* FS, ^\ */
+#define CSUSP CTRL('z')
+#define CTIME 0
+#define CDSUSP CTRL('y')
+#define CSTART CTRL('q')
+#define CSTOP CTRL('s')
+#define CSWTCH CTRL('z')
+#define CLNEXT CTRL('v')
+#define CDISCARD CTRL('o')
+#define CWERASE CTRL('w')
+#define CREPRINT CTRL('r')
+#define CEOT CEOF
+/* compat */
+#define CBRK CEOL
+#define CRPRNT CREPRINT
+#define CFLUSH CDISCARD
+
+/* PROTECTED INCLUSION ENDS HERE */
+#endif /* !_SYS_TTYDEFAULTS_H_ */
+
+/*
+ * #define TTYDEFCHARS to include an array of default control characters.
+ */
+#ifdef TTYDEFCHARS
+cc_t ttydefchars[NCCS] = {
+ CEOF, CEOL, CEOL, CERASE, CWERASE, CKILL, CREPRINT,
+ _POSIX_VDISABLE, CINTR, CQUIT, CSUSP, CDSUSP, CSTART, CSTOP, CLNEXT,
+ CDISCARD, CMIN, CTIME, CSTATUS, _POSIX_VDISABLE
+};
+#undef TTYDEFCHARS
+#endif
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/types32.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/types32.h
new file mode 100644
index 0000000000..9d13a5e8ad
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/types32.h
@@ -0,0 +1,66 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _SYS_TYPES32_H
+#define _SYS_TYPES32_H
+
+#include <bits/types.h>
+
+typedef __uint32_t caddr32_t;
+typedef __int32_t daddr32_t;
+typedef __int32_t off32_t;
+typedef __uint32_t ino32_t;
+typedef __int32_t blkcnt32_t;
+typedef __uint32_t fsblkcnt32_t;
+typedef __uint32_t fsfilcnt32_t;
+typedef __int32_t id32_t;
+typedef __uint32_t major32_t;
+typedef __uint32_t minor32_t;
+typedef __int32_t key32_t;
+typedef __uint32_t mode32_t;
+typedef __uint32_t uid32_t;
+typedef __uint32_t gid32_t;
+typedef __uint32_t nlink32_t;
+typedef __uint32_t dev32_t;
+typedef __int32_t pid32_t;
+typedef __uint32_t size32_t;
+typedef __int32_t ssize32_t;
+typedef __int32_t time32_t;
+typedef __int32_t clock32_t;
+
+struct timeval32
+ {
+ time32_t tv_sec;
+ __int32_t tv_usec;
+ };
+
+typedef struct timespec32
+ {
+ time32_t tv_sec;
+ __int32_t tv_nsec;
+ } timespec32_t;
+
+typedef struct timespec32 timestruc32_t;
+
+typedef struct itimerspec32
+ {
+ struct timespec32 it_interval;
+ struct timespec32 it_value;
+ } itimerspec32_t;
+
+#endif /* _SYS_TYPES32_H */
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/uadmin.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/uadmin.h
new file mode 100644
index 0000000000..c495021132
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/uadmin.h
@@ -0,0 +1,65 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _UADMINP_H
+#define _UADMINP_H
+
+#include <sys/types.h>
+
+/* uadmin cmd's. */
+#define A_REBOOT 1
+#define A_SHUTDOWN 2
+#define A_FREEZE 3
+#define A_REMOUNT 4
+#define A_DUMP 5
+#define A_FTRACE 15
+#define A_SWAPCTL 16
+#define A_SDTTEST 22
+
+/* Shutdown-related fcn's. */
+#define AD_HALT 0
+#define AD_BOOT 1
+#define AD_IBOOT 2
+#define AD_SBOOT 3
+#define AD_SIBOOT 4
+#define AD_POWEROFF 6
+#define AD_NOSYNC 7
+#define AD_FASTREBOOT 8
+#define AD_FASTREBOOT_DRYRUN 9
+
+/* Freeze-related fcn's. */
+#define AD_COMPRESS 0
+#define AD_FORCE 1
+#define AD_CHECK 2
+#define AD_REUSEINIT 3
+#define AD_REUSABLE 4
+#define AD_REUSEFINI 5
+#define AD_SUSPEND_TO_DISK AD_COMPRESS
+#define AD_CHECK_SUSPEND_TO_DISK AD_CHECK
+#define AD_SUSPEND_TO_RAM 20
+#define AD_CHECK_SUSPEND_TO_RAM 21
+
+#define AD_FTRACE_START 1
+#define AD_FTRACE_STOP 2
+
+#define BOOTARGS_MAX 256
+
+extern int uadmin (int, int, uintptr_t);
+
+#endif /* _UADMINP_H */
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/ucontext.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/ucontext.h
new file mode 100644
index 0000000000..e017381d4f
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/ucontext.h
@@ -0,0 +1,65 @@
+/* Declaration of ucontext_t.
+ Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _SYS_UCONTEXT_H
+#define _SYS_UCONTEXT_H 1
+
+#ifndef __stack_t_defined
+# define __need_stack_t
+# include <bits/sigstack.h>
+#endif
+#include <bits/sigset.h>
+#include <bits/regset.h>
+#include <features.h>
+
+typedef struct ucontext
+{
+ unsigned long uc_flags;
+ struct ucontext *uc_link;
+ __sigset_t uc_sigmask;
+ stack_t uc_stack;
+ mcontext_t uc_mcontext;
+ long uc_filler[5];
+} ucontext_t;
+
+/* uc_flags */
+#define UC_SIGMASK 0x01
+#define UC_STACK 0x02
+#define UC_CPU 0x04
+#define UC_MAU 0x08
+#define UC_FPU UC_MAU
+#define UC_MCONTEXT (UC_CPU | UC_FPU)
+#define UC_ALL (UC_SIGMASK | UC_STACK | UC_MCONTEXT)
+
+#define GETCONTEXT 0
+#define SETCONTEXT 1
+#define GETUSTACK 2
+#define SETUSTACK 3
+
+__BEGIN_DECLS
+
+int getustack (stack_t **);
+
+int setustack (stack_t *);
+
+int stack_getbounds (stack_t *);
+
+__END_DECLS
+
+#endif /* _SYS_UCONTEXT_H */
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/utime.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/utime.h
new file mode 100644
index 0000000000..65633b84f3
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/utime.h
@@ -0,0 +1,37 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _SYS_UTIME_H
+#define _SYS_UTIME_H
+
+#include <utime.h>
+
+#ifdef _SYSCALL32
+
+# include <sys/types32.h>
+
+struct utimbuf32
+ {
+ time32_t actime;
+ time32_t modtime;
+ };
+
+#endif
+
+#endif /* _SYS_UTIME_H */
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/utssys.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/utssys.h
new file mode 100644
index 0000000000..885b4774a3
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/utssys.h
@@ -0,0 +1,81 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _SYS_UTSSYS_H
+#define _SYS_UTSSYS_H
+
+#include <sys/types.h>
+
+#define UTS_UNAME 0x00
+#define UTS_USTAT 0x02
+#define UTS_FUSERS 0x03
+
+/* UTS_FUSERS flags. */
+#define F_FILE_ONLY 0x01
+#define F_CONTAINED 0x02
+#define F_NBMANDLIST 0x04
+#define F_DEVINFO 0x08
+#define F_KINFO_COUNT 0x10
+
+typedef struct f_user
+ {
+ int fu_flags; /* see below */
+ union
+ {
+ struct
+ {
+ pid_t u_pid;
+ uid_t u_uid;
+ } u_info;
+ struct
+ {
+ int k_modid;
+ int k_instance;
+ int k_minor;
+ } k_info;
+ } fu_info;
+ } f_user_t;
+
+#define fu_pid fu_info.u_info.u_pid
+#define fu_uid fu_info.u_info.u_uid
+#define fu_modid fu_info.k_info.k_modid
+#define fu_instance fu_info.k_info.k_instance
+#define fu_minor fu_info.k_info.k_minor
+
+/* fu_flags values. */
+#define F_CDIR 0x01
+#define F_RDIR 0x02
+#define F_TEXT 0x04
+#define F_MAP 0x08
+#define F_OPEN 0x10
+#define F_TRACE 0x20
+#define F_TTY 0x40
+#define F_NBM 0x80
+#define F_KERNEL 0x80000000
+
+typedef struct fu_data
+ {
+ int fud_user_max;
+ int fud_user_count;
+ struct f_user fud_user[1];
+ } fu_data_t;
+
+#define fu_data_size(x) (sizeof(fu_data_t) - sizeof(f_user_t) + \
+ ((x) * sizeof(f_user_t)))
+
+#endif /* _SYS_UTSSYS_H */
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/vfstab.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/vfstab.h
new file mode 100644
index 0000000000..53d4a0bb04
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/vfstab.h
@@ -0,0 +1,58 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _SYS_VFSTAB_H
+#define _SYS_VFSTAB_H
+
+#include <features.h>
+#include <stdio.h>
+#include <paths.h>
+
+#define VFSTAB _PATH_MNTTAB
+
+#define VFS_LINE_MAX 1024
+
+#define VFS_TOOLONG 1
+#define VFS_TOOMANY 2
+#define VFS_TOOFEW 3
+
+
+struct vfstab
+ {
+ char *vfs_special;
+ char *vfs_fsckdev;
+ char *vfs_mountp;
+ char *vfs_fstype;
+ char *vfs_fsckpass;
+ char *vfs_automnt;
+ char *vfs_mntopts;
+ };
+
+__BEGIN_DECLS
+
+extern int getvfsent (FILE *, struct vfstab *);
+extern int getvfsspec (FILE *, struct vfstab *, char *);
+extern int getvfsfile (FILE *, struct vfstab *, char *);
+extern int getvfsany (FILE *, struct vfstab *, struct vfstab *);
+extern void vfsnull (FILE *, struct vfstab *);
+extern void putvfsent (FILE *, struct vfstab *);
+
+__END_DECLS
+
+#endif /* _SYS_VFSTAB_H */
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/wait.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/wait.h
new file mode 100644
index 0000000000..7c24bdffda
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/wait.h
@@ -0,0 +1,172 @@
+/* Copyright (C) 1991-1994,1996-2001,2003,2004,2005,2007,2008
+ Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+/*
+ * POSIX Standard: 3.2.1 Wait for Process Termination <sys/wait.h>
+ */
+
+#ifndef _SYS_WAIT_H
+#define _SYS_WAIT_H 1
+
+#include <features.h>
+
+__BEGIN_DECLS
+
+#include <signal.h>
+#include <sys/resource.h>
+#include <sys/procset.h>
+
+/* These macros could also be defined in <stdlib.h>. */
+#if !defined _STDLIB_H || !defined __USE_XOPEN
+/* This will define the `W*' macros for the flag
+ bits to `waitpid', `wait3', and `wait4'. */
+# include <bits/waitflags.h>
+
+# ifdef __USE_BSD
+
+/* Lots of hair to allow traditional BSD use of `union wait'
+ as well as POSIX.1 use of `int' for the status word. */
+
+# if defined __GNUC__ && !defined __cplusplus
+# define __WAIT_INT(status) \
+ (__extension__ (((union { __typeof(status) __in; int __i; }) \
+ { .__in = (status) }).__i))
+# else
+# define __WAIT_INT(status) (*(__const int *) &(status))
+# endif
+
+/* This is the type of the argument to `wait'. The funky union
+ causes redeclarations with ether `int *' or `union wait *' to be
+ allowed without complaint. __WAIT_STATUS_DEFN is the type used in
+ the actual function definitions. */
+
+# if !defined __GNUC__ || __GNUC__ < 2 || defined __cplusplus
+# define __WAIT_STATUS void *
+# define __WAIT_STATUS_DEFN void *
+# else
+/* This works in GCC 2.6.1 and later. */
+typedef union
+ {
+ union wait *__uptr;
+ int *__iptr;
+ } __WAIT_STATUS __attribute__ ((__transparent_union__));
+# define __WAIT_STATUS_DEFN int *
+# endif
+
+# else /* Don't use BSD. */
+
+# define __WAIT_INT(status) (status)
+# define __WAIT_STATUS int *
+# define __WAIT_STATUS_DEFN int *
+
+# endif /* Use BSD. */
+
+/* This will define all the `__W*' macros. */
+# include <bits/waitstatus.h>
+
+# define WEXITSTATUS(status) __WEXITSTATUS(__WAIT_INT(status))
+# define WTERMSIG(status) __WTERMSIG(__WAIT_INT(status))
+# define WSTOPSIG(status) __WSTOPSIG(__WAIT_INT(status))
+# define WIFEXITED(status) __WIFEXITED(__WAIT_INT(status))
+# define WIFSIGNALED(status) __WIFSIGNALED(__WAIT_INT(status))
+# define WIFSTOPPED(status) __WIFSTOPPED(__WAIT_INT(status))
+# ifdef __WIFCONTINUED
+# define WIFCONTINUED(status) __WIFCONTINUED(__WAIT_INT(status))
+# endif
+#endif /* <stdlib.h> not included. */
+
+#ifdef __USE_BSD
+# define WCOREFLAG __WCOREFLAG
+# define WCOREDUMP(status) __WCOREDUMP(__WAIT_INT(status))
+# define W_EXITCODE(ret, sig) __W_EXITCODE(ret, sig)
+# define W_STOPCODE(sig) __W_STOPCODE(sig)
+#endif
+
+/* Wait for a child to die. When one does, put its status in *STAT_LOC
+ and return its process ID. For errors, return (pid_t) -1.
+
+ This function is a cancellation point and therefore not marked with
+ __THROW. */
+extern __pid_t wait (__WAIT_STATUS __stat_loc);
+
+#ifdef __USE_BSD
+/* Special values for the PID argument to `waitpid' and `wait4'. */
+# define WAIT_ANY (-1) /* Any process. */
+# define WAIT_MYPGRP 0 /* Any process in my process group. */
+#endif
+
+/* Wait for a child matching PID to die.
+ If PID is greater than 0, match any process whose process ID is PID.
+ If PID is (pid_t) -1, match any process.
+ If PID is (pid_t) 0, match any process with the
+ same process group as the current process.
+ If PID is less than -1, match any process whose
+ process group is the absolute value of PID.
+ If the WNOHANG bit is set in OPTIONS, and that child
+ is not already dead, return (pid_t) 0. If successful,
+ return PID and store the dead child's status in STAT_LOC.
+ Return (pid_t) -1 for errors. If the WUNTRACED bit is
+ set in OPTIONS, return status for stopped children; otherwise don't.
+
+ This function is a cancellation point and therefore not marked with
+ __THROW. */
+extern __pid_t waitpid (__pid_t __pid, int *__stat_loc, int __options);
+
+#if defined __USE_SVID || defined __USE_XOPEN
+# define __need_siginfo_t
+# include <bits/siginfo.h>
+/* Wait for a childing matching IDTYPE and ID to change the status and
+ place appropriate information in *INFOP.
+ If IDTYPE is P_PID, match any process whose process ID is ID.
+ If IDTYPE is P_PGID, match any process whose process group is ID.
+ If IDTYPE is P_ALL, match any process.
+ If the WNOHANG bit is set in OPTIONS, and that child
+ is not already dead, clear *INFOP and return 0. If successful, store
+ exit code and status in *INFOP.
+
+ This function is a cancellation point and therefore not marked with
+ __THROW. */
+extern int waitid (idtype_t __idtype, __id_t __id, siginfo_t *__infop,
+ int __options);
+#endif
+
+#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED
+/* This being here makes the prototypes valid whether or not
+ we have already included <sys/resource.h> to define `struct rusage'. */
+struct rusage;
+
+/* Wait for a child to exit. When one does, put its status in *STAT_LOC and
+ return its process ID. For errors return (pid_t) -1. If USAGE is not
+ nil, store information about the child's resource usage there. If the
+ WUNTRACED bit is set in OPTIONS, return status for stopped children;
+ otherwise don't. */
+extern __pid_t wait3 (__WAIT_STATUS __stat_loc, int __options,
+ struct rusage * __usage) __THROW;
+#endif
+
+#ifdef __USE_BSD
+/* PID is like waitpid. Other args are like wait3. */
+extern __pid_t wait4 (__pid_t __pid, __WAIT_STATUS __stat_loc, int __options,
+ struct rusage *__usage) __THROW;
+#endif /* Use BSD. */
+
+
+__END_DECLS
+
+#endif /* sys/wait.h */
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/zone.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/zone.h
new file mode 100644
index 0000000000..37bf4d8f87
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/zone.h
@@ -0,0 +1,166 @@
+/* Declarations of zone functions and types.
+ Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _SYS_ZONE_H
+#define _SYS_ZONE_H
+
+#include <sys/types.h>
+#include <sys/priv.h>
+#include <sys/uadmin.h>
+#include <sys/param.h>
+#include <sys/tsol/label.h>
+
+/* Subcall numbers. */
+#define ZONE_CREATE 0
+#define ZONE_DESTROY 1
+#define ZONE_GETATTR 2
+#define ZONE_ENTER 3
+#define ZONE_LIST 4
+#define ZONE_SHUTDOWN 5
+#define ZONE_LOOKUP 6
+#define ZONE_BOOT 7
+#define ZONE_VERSION 8
+#define ZONE_SETATTR 9
+#define ZONE_ADD_DATALINK 10
+#define ZONE_DEL_DATALINK 11
+#define ZONE_CHECK_DATALINK 12
+#define ZONE_LIST_DATALINK 13
+
+/* Miscellaneous. */
+#define GLOBAL_ZONEID 0
+#define GLOBAL_ZONENAME "global"
+#define MIN_ZONEID 0
+#define MIN_USERZONEID 1
+#define MAX_ZONEID 9999
+#define ZONEID_WIDTH 4
+#define ALL_ZONES (-1)
+#define ZONENAME_MAX 64
+#define ZONENAME_REGEXP "[a-zA-Z0-9][-_.a-zA-Z0-9]{0,62}"
+#define ZONES_TMPDIR "/var/run/zones"
+#define ZONE_DOOR_PATH ZONES_TMPDIR "/%s.zoneadmd_door"
+
+/* Zone attributes. */
+#define ZONE_ATTR_ROOT 1
+#define ZONE_ATTR_NAME 2
+#define ZONE_ATTR_STATUS 3
+#define ZONE_ATTR_PRIVSET 4
+#define ZONE_ATTR_UNIQID 5
+#define ZONE_ATTR_POOLID 6
+#define ZONE_ATTR_INITPID 7
+#define ZONE_ATTR_SLBL 8
+#define ZONE_ATTR_INITNAME 9
+#define ZONE_ATTR_BOOTARGS 10
+#define ZONE_ATTR_BRAND 11
+#define ZONE_ATTR_PHYS_MCAP 12
+#define ZONE_ATTR_SCHED_CLASS 13
+#define ZONE_ATTR_FLAGS 14
+#define ZONE_ATTR_BRAND_ATTRS 32768
+
+/* Zone event strings. */
+#define ZONE_EVENT_CHANNEL "com.sun:zones:status"
+#define ZONE_EVENT_STATUS_CLASS "status"
+#define ZONE_EVENT_STATUS_SUBCLASS "change"
+#define ZONE_EVENT_UNINITIALIZED "uninitialized"
+#define ZONE_EVENT_INITIALIZED "initialized"
+#define ZONE_EVENT_READY "ready"
+#define ZONE_EVENT_RUNNING "running"
+#define ZONE_EVENT_SHUTTING_DOWN "shutting_down"
+
+#define ZONE_CB_NAME "zonename"
+#define ZONE_CB_NEWSTATE "newstate"
+#define ZONE_CB_OLDSTATE "oldstate"
+#define ZONE_CB_TIMESTAMP "when"
+#define ZONE_CB_ZONEID "zoneid"
+
+/* Zone flags. */
+#define ZF_HASHED_LABEL 0x2
+#define ZF_IS_SCRATCH 0x4
+#define ZF_NET_EXCL 0x8
+
+/* Zone create flags. */
+#define ZCF_NET_EXCL 0x1
+
+/* Exit values. */
+#define ZONE_SUBPROC_OK 0
+#define ZONE_SUBPROC_USAGE 253
+#define ZONE_SUBPROC_NOTCOMPLETE 254
+#define ZONE_SUBPROC_FATAL 255
+
+typedef enum
+ {
+ ZONE_IS_UNINITIALIZED = 0,
+ ZONE_IS_INITIALIZED,
+ ZONE_IS_READY,
+ ZONE_IS_BOOTING,
+ ZONE_IS_RUNNING,
+ ZONE_IS_SHUTTING_DOWN,
+ ZONE_IS_EMPTY,
+ ZONE_IS_DOWN,
+ ZONE_IS_DYING,
+ ZONE_IS_DEAD
+ } zone_status_t;
+#define ZONE_MIN_STATE ZONE_IS_UNINITIALIZED
+#define ZONE_MAX_STATE ZONE_IS_DEAD
+
+typedef struct
+ {
+ const char *zone_name;
+ const char *zone_root;
+ const struct priv_set *zone_privs;
+ size_t zone_privssz;
+ const char *rctlbuf;
+ size_t rctlbufsz;
+ int *extended_error;
+ const char *zfsbuf;
+ size_t zfsbufsz;
+ int match;
+ uint32_t doi;
+ const bslabel_t *label;
+ int flags;
+ } zone_def;
+
+typedef enum zone_cmd
+ {
+ Z_READY,
+ Z_BOOT,
+ Z_FORCEBOOT,
+ Z_REBOOT,
+ Z_HALT,
+ Z_NOTE_UNINSTALLING,
+ Z_MOUNT,
+ Z_FORCEMOUNT,
+ Z_UNMOUNT
+ } zone_cmd_t;
+
+typedef struct zone_cmd_arg
+ {
+ uint64_t uniqid;
+ zone_cmd_t cmd;
+ uint32_t _pad;
+ char locale[MAXPATHLEN];
+ char bootbuf[BOOTARGS_MAX];
+ } zone_cmd_arg_t;
+
+typedef struct zone_cmd_rval
+ {
+ int rval;
+ char errbuf[1];
+ } zone_cmd_rval_t;
+
+#endif /* _SYS_ZONE_H */
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/syscallP.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/syscallP.h
new file mode 100644
index 0000000000..2a201f6ed2
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/syscallP.h
@@ -0,0 +1,243 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _SYSCALL_PRIV_H
+#define _SYSCALL_PRIV_H
+
+/* SYS_pgrpsys */
+#define SYS_SUB_getpgrp 0
+#define SYS_SUB_setpgrp 1
+#define SYS_SUB_getsid 2
+#define SYS_SUB_setsid 3
+#define SYS_SUB_getpgid 4
+#define SYS_SUB_setpgid 5
+
+/* SYS_signal */
+#define SYS_SUB_signal 0
+#define SYS_SUB_sigset 1
+#define SYS_SUB_sighold 2
+#define SYS_SUB_sigrelse 3
+#define SYS_SUB_sigignore 4
+#define SYS_SUB_sigpause 5
+
+/* SYS_msgsys */
+#define SYS_SUB_msgget 0
+#define SYS_SUB_msgctl 1
+#define SYS_SUB_msgrcv 2
+#define SYS_SUB_msgsnd 3
+#define SYS_SUB_msgids 4
+#define SYS_SUB_msgsnap 5
+
+/* SYS_shmsys */
+#define SYS_SUB_shmat 0
+#define SYS_SUB_shmctl 1
+#define SYS_SUB_shmdt 2
+#define SYS_SUB_shmget 3
+#define SYS_SUB_shmids 4
+
+/* SYS_semsys */
+#define SYS_SUB_semctl 0
+#define SYS_SUB_semget 1
+#define SYS_SUB_semop 2
+#define SYS_SUB_semids 3
+#define SYS_SUB_semtimedop 4
+
+/* SYS_utssys */
+#define SYS_SUB_uname 0 /* obsolete */
+/* subcode 1 unused */
+#define SYS_SUB_ustat 2
+#define SYS_SUB_fusers 3
+
+/* SYS_tasksys */
+#define SYS_SUB_settaskid 0
+#define SYS_SUB_gettaskid 1
+#define SYS_SUB_getprojid 2
+
+/* SYS_exacctsys */
+#define SYS_SUB_getacct 0
+#define SYS_SUB_putacct 1
+#define SYS_SUB_wracct 2
+
+/* SYS_getpagesizes */
+#define SYS_SUB_getpagesizes 0
+#define SYS_SUB_getpagesizes2 1
+
+/* SYS_rctlsys */
+#define SYS_SUB_rctlsys_get 0
+#define SYS_SUB_rctlsys_set 1
+#define SYS_SUB_rctlsys_list 2
+#define SYS_SUB_rctlsys_ctl 3
+#define SYS_SUB_rctlsys_projset 4
+
+/* SYS_sidsys */
+#define SYS_SUB_allocids 0
+#define SYS_SUB_idmap_reg 1
+#define SYS_SUB_idmap_unreg 2
+
+/* SYS_fsat */
+#define SYS_SUB_openat 0
+#define SYS_SUB_openat64 1
+#define SYS_SUB_fstatat64 2
+#define SYS_SUB_fstatat 3
+#define SYS_SUB_fchownat 4
+#define SYS_SUB_unlinkat 5
+#define SYS_SUB_futimesat 6
+#define SYS_SUB_renameat 7
+#define SYS_SUB_accessat 8
+#define SYS_SUB_openattrdirat 9
+
+/* SYS_lwp_park */
+#define SYS_SUB_lwp_park 0
+#define SYS_SUB_lwp_unpark 1
+#define SYS_SUB_lwp_unpark_all 2
+#define SYS_SUB_lwp_unpark_cancel 3
+#define SYS_SUB_lwp_set_park 4
+
+/* SYS_sendfilev */
+#define SYS_SUB_sendfilev 0
+#define SYS_SUB_sendfilev64 1
+
+/* SYS_privsys */
+#define SYS_SUB_setppriv 0
+#define SYS_SUB_getppriv 1
+#define SYS_SUB_getimplinfo 2
+#define SYS_SUB_setpflags 3
+#define SYS_SUB_getpflags 4
+#define SYS_SUB_issetugid 5
+
+/* SYS_ucredsys */
+#define SYS_SUB_ucred_get 0
+#define SYS_SUB_getpeerucred 1
+
+/* SYS_sigpending */
+#define SYS_SUB_sigpending 1
+#define SYS_SUB_sigfillset 2
+
+/* SYS_context */
+#define SYS_SUB_getcontext 0
+#define SYS_SUB_setcontext 1
+#define SYS_SUB_getustack 2
+#define SYS_SUB_setustack 3
+
+/* SYS_forksys */
+#define SYS_SUB_forkx 0
+#define SYS_SUB_forkallx 1
+#define SYS_SUB_vforkx 2
+
+/* SYS_coresys */
+#define SYS_SUB_core_set_options 1
+#define SYS_SUB_core_get_options 2
+#define SYS_SUB_core_set_global_path 3
+#define SYS_SUB_core_get_global_path 4
+#define SYS_SUB_core_set_process_path 5
+#define SYS_SUB_core_get_process_path 6
+#define SYS_SUB_core_set_global_content 7
+#define SYS_SUB_core_get_global_content 8
+#define SYS_SUB_core_set_process_content 9
+#define SYS_SUB_core_get_process_content 10
+#define SYS_SUB_core_set_default_path 11
+#define SYS_SUB_core_get_default_path 12
+#define SYS_SUB_core_set_default_content 13
+#define SYS_SUB_core_get_default_content 14
+
+/* SYS_lgrpsys / SYS_meminfosys */
+#define SYS_SUB_meminfo 0
+#define SYS_SUB_lgrp_generation 1
+#define SYS_SUB_lgrp_version 2
+#define SYS_SUB_lgrp_snapshot 3
+#define SYS_SUB_lgrp_affinity_set 4
+#define SYS_SUB_lgrp_affinity_get 5
+#define SYS_SYB_lgrp_latency 6
+#define SYS_SUB_lgrp_home 7
+
+/* SYS_rusagesys */
+#define SYS_SUB_getrusage 0
+#define SYS_SUB_getrusage_chld 1
+#define SYS_SUB_getrusage_lwp 2
+#define SYS_SUB_getvmusage 3
+
+/* SYS_port */
+#define SYS_SUB_port_create 0
+#define SYS_SUB_port_associate 1
+#define SYS_SUB_port_dissociate 2
+#define SYS_SUB_port_send 3
+#define SYS_SUB_port_sendn 4
+#define SYS_SUB_port_get 5
+#define SYS_SUB_port_getn 6
+#define SYS_SUB_port_alert 7
+#define SYS_SUB_port_dispatch 8
+
+/* SYS_door */
+#define SYS_SUB_door_create 0
+#define SYS_SUB_door_revoke 1
+#define SYS_SUB_door_info 2
+#define SYS_SUB_door_call 3
+/* Subcodes 4 and 5 missing. */
+#define SYS_SUB_door_bind 6
+#define SYS_SUB_door_unbind 7
+#define SYS_SUB_door_unrefsys 8
+#define SYS_SUB_door_ucred 9
+#define SYS_SUB_door_return 10
+#define SYS_SUB_door_getparam 11
+#define SYS_SUB_door_setparam 12
+
+/* SYS_pset */
+#define SYS_SUB_pset_create 0
+#define SYS_SUB_pset_destroy 1
+#define SYS_SUB_pset_assign 2
+#define SYS_SUB_pset_info 3
+#define SYS_SUB_pset_bind 4
+#define SYS_SUB_pset_getloadavg 5
+#define SYS_SUB_pset_list 6
+#define SYS_SUB_pset_setattr 7
+#define SYS_SUB_pset_getattr 8
+#define SYS_SUB_pset_assign_forced 9
+
+/* SYS_rwlock */
+#define SYS_SUB_lwp_rwlock_rdlock 0
+#define SYS_SUB_lwp_rwlock_wrlock 1
+#define SYS_SUB_lwp_rwlock_tryrdlock 2
+#define SYS_SUB_lwp_rwlock_trywrlock 3
+#define SYS_SUB_lwp_rwlock_unlock 4
+
+/* SYS_zone */
+#define SYS_SUB_zone_create 0
+#define SYS_SUB_zone_destroy 1
+#define SYS_SUB_zone_getattr 2
+#define SYS_SUB_zone_enter 3
+#define SYS_SUB_zone_list 4
+#define SYS_SUB_zone_shutdown 5
+#define SYS_SUB_zone_lookup 6
+#define SYS_SUB_zone_boot 7
+#define SYS_SUB_zone_version 8
+#define SYS_SUB_zone_setattr 9
+#define SYS_SUB_zone_add_datalink 10
+#define SYS_SUB_zone_del_datalink 11
+#define SYS_SUB_zone_check_datalink 12
+#define SYS_SUB_zone_list_datalink 13
+
+/* SYS_labelsys */
+#define SYS_SUB_syslabeling 1
+#define SYS_SUB_tnrh 2
+#define SYS_SUB_tnrhtp 3
+#define SYS_SUB_tnmlp 4
+#define SYS_SUB_getlabel 5
+#define SYS_SUB_pgetlabel 6
+
+#endif /* _SYSCALL_PRIV_H */
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/syscalls.list b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/syscalls.list
new file mode 100644
index 0000000000..e0d0c4f5f2
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/syscalls.list
@@ -0,0 +1,240 @@
+# File name Caller Syscall name Args Strong name Weak names
+
+# Important: see NOTES.opensolaris about syscalls that return a 64-bit integer.
+
+#
+# these implement libc functions directly
+#
+
+autofssys - autofssys iip _autofssys
+acct - acct i:s acct
+acctctl - acctctl i:ipi acctctl
+acl - acl i:siip acl
+cladm - cladm i:iip cladm
+clock_getres - clock_getres i:ip clock_getres
+creat - creat Ci:si __libc_creat creat
+facl - facl i:iiip facl
+fpathconf - fpathconf i:ii __fpathcon fpathconf
+fstatvfs - fstatvfs i:ip __fstatvfs fstatvfs
+fstatvfs64 - fstatvfs64 i:ip __fstatvfs64 fstatvfs64
+getcpuid - getcpuid i: getcpuid
+getpflags - privsys:getpflags i:i getpflags
+getmsg - getmsg Ri:ppp getmsg
+getpmsg - getpmsg i:pppp getpmsg
+getpagesizes - getpagesizes:getpagesizes2 i:pi __getpagesizes getpagesizes getpagesizes2
+getpgid - pgrpsys:getpgid i:i __getpgid getpgid
+getpgrp - pgrpsys:getpgrp i: __getpgrp getpgrp
+getprojid - tasksys:getprojid i: getprojid
+getrlimit64 - getrlimit64 i:ip getrlimit64
+getsid - pgrpsys:getsid i:i __getsid getsid
+gettaskid - tasksys:gettaskid i: gettaskid
+getustack - context:getustack i:p getustack
+getvmusage - rusagesys:getvmusage i:iipp getvmusage
+gtty - gtty i:ip gtty
+idmap_reg - sidsys:idmap_reg i:i idmap_reg
+idmap_unreg - sidsys:idmap_unreg i:i idmap_unreg
+inst_sync - inst_sync i:si inst_sync
+ioctl - ioctl Ri:iiI __ioctl ioctl
+issetugid - privsys:issetugid Ei: issetugid
+lchown - lchown i:sii __lchown lchown
+lgrpsys - lgrpsys i:iip _lgrpsys
+memcntl - memcntl i:piiiii memcntl
+mincore - mincore i:anV mincore
+modctl - modctl i:ip modctl
+mmap64 - mmap64 i:piiiii __mmap64 mmap64
+mount - mount i:ppippipi __mount mount
+nanosleep - nanosleep Ci:pP __libc_nanosleep __nanosleep nanosleep
+pathconf - pathconf i:pi __pathconf pathconf
+pcsample - pcsample i:pi pcsample
+ppoll - pollsys RCi:pipp ppoll
+pread - pread RCi:iPii __libc_pread __pread pread
+pread64 - pread64 Ci:iPii __libc_pread64 __pread64 pread64
+profil - profil :piii __profil profil
+pwrite - pwrite RCi:iPii __libc_pwrite __pwrite pwrite
+pwrite64 - pwrite64 RCi:iPii __libc_pwrite64 __pwrite64 pwrite64
+read - read RCi:ibn __libc_read __read read
+readv - readv RCi:ipi __readv readv
+resolvepath - resolvepath i:spi resolvepath
+sched_yield - yield i: __sched_yield sched_yield
+setcontext - context:setcontext i:p __setcontext setcontext
+setpgid - pgrpsys:setpgid i:ii __setpgid setpgid
+setpgrp - pgrpsys:setpgrp i: __setpgrp setpgrp
+setpflags - privsys:setpflags i:ii setpflags
+setrlimit64 - setrlimit64 i:ip setrlimit64
+setsid - pgrpsys:setsid i: __setsid setsid
+setustack - context:setustack i:p setustack
+shmat - shmsys:shmat p:ipi shmat
+shmctl - shmsys:shmctl i:iip shmctl
+shmdt - shmsys:shmdt i:p shmdt
+shmget - shmsys:shmget i:iii shmget
+sigaltstack - sigaltstack i:PP __sigaltstack sigaltstack
+sigfillset - sigpending:sigfillset i:P __sigfillset sigfillset
+sigpending - sigpending:sigpending i:p sigpending
+sigsendset - sigsendsys i:pi sigsendset
+sockconfig - sockconfig i:iiis _sockconfig sockconfig
+statvfs - statvfs i:sp __statvfs statvfs
+statvfs64 - statvfs64 i:sp __statvfs64 statvfs64
+stty - stty i:ip stty
+sysfs - sysfs i:iii sysfs
+systeminfo - systeminfo i:ipi sysinfo
+swapctl - uadmin:swapctl i:ip swapctl
+uadmin - uadmin i:iii __uadmin uadmin
+umount2 - umount2 i:si umount2
+utssys - utssys i:piip utssys
+uucopy - uucopy i:ppi uucopy
+uucopystr - uucopystr i:ppi uucopystr
+vhangup - vhangup i: vhangup
+waitid - waitid RCi:iipi __waitid waitid
+write - write RCi:ibn __libc_write __write write
+writev - writev RCi:ipi __writev writev
+
+# msg
+msgctl - msgsys:msgctl i:iip __msgctl msgctl
+msgget - msgsys:msgget i:ii __msgget msgget
+msgrcv - msgsys:msgrcv Ci:ipiii __libc_msgrcv msgrcv
+msgsnd - msgsys:msgsnd Ci:ipii __msgsnd msgsnd
+
+# exacctsys
+getacct - exacctsys:getacct i:iipi getacct
+putacct - exacctsys:putacct i:iipii putacct
+wracct - exacctsys:wracct i:iii wracct
+
+# *at
+fchownat - fsat:fchownat i:isiii fchownat
+futimesat - fsat:futimesat i:isi futimesat
+renameat - fsat:renameat i:isis renameat
+unlinkat - fsat:unlinkat i:isi unlinkat
+
+# ntp
+ntp_adjtime - ntp_adjtime i:p __adjtimex adjtimex ntp_adjtime __adjtimex_internal
+ntp_gettime - ntp_gettime i:p ntp_gettime
+
+# sem
+semctl - semsys:semctl i:iiiv semctl
+semget - semsys:semget i:iii semget
+semop - semsys:semop i:ipi semop
+semtimedop - semsys:semtimedop i:ipip semtimedop
+
+# corectl
+core_get_default_content - corectl:core_get_default_content i:p core_get_default_content
+core_get_default_path - corectl:core_get_default_path i:pi core_get_default_path
+core_get_global_content - corectl:core_get_global_content i:p core_get_global_content
+core_get_global_path - corectl:core_get_global_path i:pi core_get_global_path
+core_get_options - corectl:core_get_options i: core_get_options
+core_get_process_content - corectl:core_get_process_content i:pi core_get_process_content
+core_get_process_path - corectl:core_get_process_path i:pii core_get_process_path
+core_set_default_content - corectl:core_set_default_content i:p core_set_default_content
+core_set_default_path - corectl:core_set_default_path i:pi core_set_default_path
+core_set_global_content - corectl:core_set_global_content i:p core_set_global_content
+core_set_global_path - corectl:core_set_global_path i:pi core_set_global_path
+core_set_options - corectl:core_set_options i:i core_set_options
+core_set_process_content - corectl:core_set_process_content i:pi core_set_process_content
+core_set_process_path - corectl:core_set_process_path i:pii core_set_process_path
+
+# zones
+zone_add_datalink - zone:zone_add_datalink i:is zone_add_datalink
+zone_boot - zone:zone_boot i:i zone_boot
+zone_check_datalink - zone:zone_check_datalink i:ps zone_check_datalink
+zone_destroy - zone:zone_destroy i:i zone_destroy
+zone_enter - zone:zone_enter i:i zone_enter
+zone_getattr - zone:zone_getattr i:iipi zone_getattr
+zone_list - zone:zone_list i:pp zone_list
+zone_list_datalink - zone:zone_list_datalink i:ipp zone_list_datalink
+zone_remove_datalink - zone:zone_del_datalink i:s zone_remove_datalink
+zone_setattr - zone:zone_setattr i:iipi zone_setattr
+zone_shutdown - zone:zone_shutdown i:i zone_shutdown
+zone_version - zone:zone_version i:p zone_version
+
+# processor
+p_online - p_online i:ii p_online
+processor_bind - processor_bind i:iiip processor_bind
+processor_info - processor_info i:ip processor_info
+pset_create - pset:pset_create i:p pset_create
+pset_destroy - pset:pset_destroy i:i pset_destroy
+pset_assign - pset:pset_assign i:iip pset_assign
+pset_info - pset:pset_info i:ippp pset_info
+pset_bind - pset:pset_bind i:iiip pset_bind
+pset_list - pset:pset_list i:pp pset_list
+pset_setattr - pset:pset_setattr i:ii pset_setattr
+pset_getattr - pset:pset_getattr i:ip pset_getattr
+
+# sockets
+_so_accept - accept Ci:iBN _so_accept
+_so_bind - bind i:ipii _so_bind
+_so_connect - connect Ci:ipi _so_connect
+_so_getpeername - getpeername i:ibNi _so_getpeername
+_so_getsockname - getsockname i:ibNi _so_getsockname
+_so_getsockopt - getsockopt i:iiiBNi _so_getsockopt
+_so_listen - listen i:iii _so_listen
+recv - recv RCi:ibni __libc_recv __recv recv _so_recv
+recvfrom - recvfrom RCi:ibniBN __libc_recvfrom __recvfrom recvfrom _so_recvfrom
+_so_recvmsg - recvmsg RCi:ipi _so_recvmsg
+_so_send - send RCi:ibni _so_send
+_so_sendmsg - sendmsg RCi:ipi _so_sendmsg
+_so_sendto - sendto RCi:ibnibn _so_sendto
+_so_setsockopt - setsockopt i:iiibn _so_setsockopt
+_so_shutdown - shutdown i:iii _so_shutdown
+_so_socket - so_socket i:iiipi _so_socket
+_so_socketpair - so_socketpair i:p _so_socketpair
+
+# misc
+_sysconfig - sysconfig i:i _sysconfig
+is_system_labeled - labelsys:syslabeling i: is_system_labeled
+
+#
+# implement these in helper files
+#
+
+sys_access - access i:si __syscall_access
+sys_accessat - fsat:accessat i:isi __syscall_accessat
+sys_allocids - sidsys:allocids i:iii __syscall_allocids
+sys_brk - brk i:p __syscall_brk
+sys_fcntl - fcntl Ri:iiF __syscall_fcntl
+sys_fdsync - fdsync Ci:ii __syscall_fdsync
+sys_forkx - forksys:forkx i:i __syscall_forkx
+sys_fstat - fstat i:ip __syscall_fstat
+sys_fstat64 - fstat64 i:ip __syscall_fstat64
+sys_fstatat - fsat:fstatat i:ispi __syscall_fstatat
+sys_fstatat64 - fsat:fstatat64 i:ispi __syscall_fstatat64
+sys_door - door i:iiiiii __syscall_door
+sys_getcontext - context:getcontext i:p __syscall_getcontext
+sys_getcwd - getcwd i:pi __syscall_getcwd
+sys_getdents - getdents i:ipi __syscall_getdents
+sys_getdents64 - getdents64 i:ipi __syscall_getdents64
+sys_getloadavg - getloadavg i:pi __syscall_getloadavg
+sys_getpeerucred - ucredsys:getpeerucred i:ip __syscall_getpeerucred
+sys_lstat - lstat i:sp __syscall_lstat
+sys_lstat64 - lstat64 i:sp __syscall_lstat64
+sys_lwp_private - lwp_private i:iii __syscall_lwp_private
+sys_lwp_sigmask - lwp_sigmask Ei:iii __syscall_lwp_sigmask
+sys_meminfo - meminfosys:meminfo i:ip __syscall_meminfo
+sys_mknod - mknod i:sii __syscall_mknod
+sys_open - open i:siv __syscall_open
+sys_open64 - open64 i:pii __syscall_open64
+sys_openat - fsat:openat i:isiv __syscall_openat
+sys_openat64 - fsat:openat64 i:isiv __syscall_openat64
+sys_pipe - pipe i: __syscall_pipe
+sys_port - port i:i __syscall_port
+sys_priocntlsys - priocntlsys i:ipiv __syscall_priocntlsys
+sys_privsys - privsys i:iipii __syscall_privsys
+sys_pset_getloadavg - pset:pset_getloadavg i:ipi __syscall_pset_getloadavg
+sys_putmsg - putmsg Ri:ippi __syscall_putmsg
+sys_putpmsg - putpmsg i:ippii __syscall_putpmsg
+sys_rctlsys - rctlsys i:ipppii __syscall_rctlsys
+sys_rusagesys - rusagesys i:ip __syscall_rusagesys
+sys_sendfilev - sendfilev:sendfilev i:ipip __syscall_sendfilev
+sys_sendfilev64 - sendfilev:sendfilev64 i:ipip __syscall_sendfilev64
+sys_settaskid - tasksys:settaskid i:ii __syscall_settaskid
+sys_sigaction - sigaction i:iPP __syscall_sigaction
+sys_sigqueue - sigqueue i:iiPii __syscall_sigqueue
+sys_sigtimedwait - sigtimedwait Ci:pPP __syscall_sigtimedwait
+sys_stat - stat i:sp __syscall_stat
+sys_stat64 - stat64 i:sp __syscall_stat64
+sys_stime - stime i:i __syscall_stime
+sys_time - time i: __syscall_time
+sys_ucred_get - ucredsys:ucred_get i:ip __syscall_ucred_get
+sys_uname - uname i:p __syscall_uname
+sys_utimes - utimes i:sp __syscall_utimes
+sys_utssys - utssys i:piiP __syscall_utssys
+sys_zone_create - zone:zone_create i:p __syscall_zone_create
+sys_zone_lookup - zone:zone_lookup i:p __syscall_zone_lookup
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sysconf.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sysconf.c
new file mode 100644
index 0000000000..d13d7a62a1
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sysconf.c
@@ -0,0 +1,106 @@
+/* Get file-specific information about a file. OpenSolaris version.
+ Copyright (C) 2003, 2004, 2006, 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <unistd.h>
+#include <sys/sysconfig.h>
+
+extern long _sysconfig (int which);
+
+static long int posix_sysconf (int name);
+
+
+/* Get the value of the system variable NAME. */
+long int
+__sysconf (int name)
+{
+ switch (name)
+ {
+ case _SC_NGROUPS_MAX:
+ return _sysconfig (_CONFIG_NGROUPS);
+ case _SC_STREAM_MAX:
+ return __getdtablesize ();
+ case _SC_NPROCESSORS_MAX:
+ return _sysconfig (_CONFIG_NPROC_MAX);
+ case _SC_STACK_PROT:
+ return _sysconfig (_CONFIG_STACK_PROT);
+ case _SC_AIO_LISTIO_MAX:
+ return _sysconfig (_CONFIG_AIO_LISTIO_MAX);
+ case _SC_AIO_MAX:
+ return _sysconfig (_CONFIG_AIO_MAX);
+ case _SC_AIO_PRIO_DELTA_MAX:
+ return _sysconfig (_CONFIG_AIO_PRIO_DELTA_MAX);
+ case _SC_DELAYTIMER_MAX:
+ return _sysconfig (_CONFIG_DELAYTIMER_MAX);
+ case _SC_MQ_OPEN_MAX:
+ return _sysconfig (_CONFIG_MQ_OPEN_MAX);
+ case _SC_MQ_PRIO_MAX:
+ return _sysconfig (_CONFIG_MQ_PRIO_MAX);
+ case _SC_RTSIG_MAX:
+ return _sysconfig (_CONFIG_RTSIG_MAX);
+ case _SC_SEM_NSEMS_MAX:
+ return _sysconfig (_CONFIG_SEM_NSEMS_MAX);
+ case _SC_SEM_VALUE_MAX:
+ return _sysconfig (_CONFIG_SEM_VALUE_MAX);
+ case _SC_SIGQUEUE_MAX:
+ return _sysconfig (_CONFIG_SIGQUEUE_MAX);
+ case _SC_SIGRT_MAX:
+ return _sysconfig (_CONFIG_SIGRT_MAX);
+ case _SC_SIGRT_MIN:
+ return _sysconfig (_CONFIG_SIGRT_MIN);
+ case _SC_TIMER_MAX:
+ return _sysconfig (_CONFIG_TIMER_MAX);
+ case _SC_COHER_BLKSZ:
+ return _sysconfig (_CONFIG_COHERENCY);
+ case _SC_SPLIT_CACHE:
+ return _sysconfig (_CONFIG_SPLIT_CACHE);
+ case _SC_ICACHE_SZ:
+ return _sysconfig (_CONFIG_ICACHESZ);
+ case _SC_DCACHE_SZ:
+ return _sysconfig (_CONFIG_DCACHESZ);
+ case _SC_ICACHE_LINESZ:
+ return _sysconfig (_CONFIG_ICACHELINESZ);
+ case _SC_DCACHE_LINESZ:
+ return _sysconfig (_CONFIG_DCACHELINESZ);
+ case _SC_ICACHE_BLKSZ:
+ return _sysconfig (_CONFIG_ICACHEBLKSZ);
+ case _SC_DCACHE_BLKSZ:
+ return _sysconfig (_CONFIG_DCACHEBLKSZ);
+ case _SC_ICACHE_ASSOC:
+ return _sysconfig (_CONFIG_ICACHE_ASSOC);
+ case _SC_DCACHE_ASSOC:
+ return _sysconfig (_CONFIG_DCACHE_ASSOC);
+ case _SC_MAXPID:
+ return _sysconfig (_CONFIG_MAXPID);
+ case _SC_CPUID_MAX:
+ return _sysconfig (_CONFIG_CPUID_MAX);
+ case _SC_EPHID_MAX:
+ return _sysconfig (_CONFIG_EPHID_MAX);
+ case _SC_SYMLOOP_MAX:
+ return _sysconfig (_CONFIG_SYMLOOP_MAX);
+ default:
+ return posix_sysconf (name);
+ }
+}
+
+/* Now the POSIX version. */
+#undef __sysconf
+#define __sysconf static posix_sysconf
+#include <sysdeps/posix/sysconf.c>
+
+weak_alias (__sysconf, _sysconf)
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/system.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/system.c
new file mode 100644
index 0000000000..13cb35dfba
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/system.c
@@ -0,0 +1,81 @@
+/* Copyright (C) 2002, 2003, 2005, 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sysdep.h>
+#include <inline-syscall.h>
+#include <signal.h>
+#include <unistd.h>
+#include <stddef.h>
+#include <not-cancel.h>
+
+DECLARE_INLINE_SYSCALL (int64_t, lwp_sigmask, int how, unsigned int bits0,
+ unsigned int bits1);
+
+
+#ifdef _LIBC_REENTRANT
+static void cancel_handler (void *arg);
+
+# define CLEANUP_HANDLER \
+ __libc_cleanup_region_start (1, cancel_handler, &pid)
+
+# define CLEANUP_RESET \
+ __libc_cleanup_region_end (0)
+
+#define FORK() __fork_block_signals (&pid)
+
+static inline pid_t __fork_block_signals (pid_t *pid)
+{
+ /* Block all signals. */
+ rval_t oldmask;
+ oldmask.rval64 = INLINE_SYSCALL (lwp_sigmask, 3, SIG_SETMASK,
+ (unsigned int)-1, (unsigned int)-1);
+
+ *pid = fork ();
+
+ /* Restore signals. */
+ (void)INLINE_SYSCALL (lwp_sigmask, 3, SIG_SETMASK,
+ (unsigned int)oldmask.rval1, (unsigned int)oldmask.rval2);
+
+ return *pid;
+}
+#endif
+
+#include <sysdeps/posix/system.c>
+
+#ifdef _LIBC_REENTRANT
+/* The cancellation handler. */
+static void
+cancel_handler (void *arg)
+{
+ pid_t child = *(pid_t *) arg;
+
+ __kill (child, SIGKILL);
+
+ TEMP_FAILURE_RETRY (__waitpid (child, NULL, 0));
+
+ DO_LOCK ();
+
+ if (SUB_REF () == 0)
+ {
+ (void) __sigaction (SIGQUIT, &quit, (struct sigaction *) NULL);
+ (void) __sigaction (SIGINT, &intr, (struct sigaction *) NULL);
+ }
+
+ DO_UNLOCK ();
+}
+#endif
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/tcdrain.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/tcdrain.c
new file mode 100644
index 0000000000..3ce4f892bf
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/tcdrain.c
@@ -0,0 +1,41 @@
+/* Copyright (C) 1995, 1996, 1997, 2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <termios.h>
+#include <sys/ioctl.h>
+#include <sysdep-cancel.h>
+
+/* Wait for pending output to be written on FD. */
+int
+__libc_tcdrain (int fd)
+{
+ if (SINGLE_THREAD_P)
+ /* With an argument of 1, TCSBRK for output to be drain. */
+ return ioctl (fd, TCSBRK, 1);
+
+ int oldtype = LIBC_CANCEL_ASYNC ();
+
+ /* With an argument of 1, TCSBRK for output to be drain. */
+ int res = ioctl (fd, TCSBRK, 1);
+
+ LIBC_CANCEL_RESET (oldtype);
+
+ return res;
+}
+weak_alias (__libc_tcdrain, tcdrain)
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/tcgetattr.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/tcgetattr.c
new file mode 100644
index 0000000000..f843fa0a52
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/tcgetattr.c
@@ -0,0 +1,31 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sys/ioctl.h>
+#include <termios.h>
+
+int
+__tcgetattr (fd, termios_p)
+ int fd;
+ struct termios *termios_p;
+{
+ return ioctl(fd, TCGETS, termios_p);
+}
+
+weak_alias (__tcgetattr, tcgetattr)
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/tcsetattr.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/tcsetattr.c
new file mode 100644
index 0000000000..a3ffe9078f
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/tcsetattr.c
@@ -0,0 +1,44 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sys/ioctl.h>
+#include <termios.h>
+#include <errno.h>
+
+int
+tcsetattr (fd, optional_actions, termios_p)
+ int fd;
+ int optional_actions;
+ const struct termios *termios_p;
+{
+ switch (optional_actions)
+ {
+ case TCSANOW:
+ return __ioctl (fd, TCSETS, termios_p);
+ case TCSADRAIN:
+ return __ioctl (fd, TCSETSW, termios_p);
+ case TCSAFLUSH:
+ return __ioctl (fd, TCSETSF, termios_p);
+ default:
+ __set_errno (EINVAL);
+ return -1;
+ }
+}
+
+libc_hidden_def(tcsetattr)
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/termio.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/termio.h
new file mode 100644
index 0000000000..0e610f0c56
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/termio.h
@@ -0,0 +1,6 @@
+/* Compatible <termio.h> for old `struct termio' ioctl interface.
+ This is obsolete; use the POSIX.1 `struct termios' interface
+ defined in <termios.h> instead. */
+
+#include <termios.h>
+#include <sys/ioctl.h>
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/thr_sighndlrinfo.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/thr_sighndlrinfo.c
new file mode 100644
index 0000000000..cc8b0111a4
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/thr_sighndlrinfo.c
@@ -0,0 +1,30 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <stdint.h>
+#include <signal.h>
+
+extern void __sighandler (int, siginfo_t *, void *);
+extern void __sighandler_end (void);
+
+void thr_sighndlrinfo (void (**func)(void), int *funcsize)
+{
+ *func = (void (*)(void))&__sighandler;
+ *funcsize = (int)((uintptr_t)&__sighandler_end - (uintptr_t)&__sighandler);
+}
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/thread_db.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/thread_db.h
new file mode 100644
index 0000000000..e9e0c5ac03
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/thread_db.h
@@ -0,0 +1,454 @@
+/* thread_db.h -- interface to libthread_db.so library for debugging -lpthread
+ Copyright (C) 1999,2001,2002,2003 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _THREAD_DB_H
+#define _THREAD_DB_H 1
+
+/* This is the debugger interface for the NPTL library. It is
+ modelled closely after the interface with same names in Solaris
+ with the goal to share the same code in the debugger. */
+#include <pthread.h>
+#include <stdint.h>
+#include <sys/types.h>
+#include <sys/procfs_isa.h>
+#include <thread.h>
+
+
+/* Error codes of the library. */
+typedef enum
+{
+ TD_OK, /* No error. */
+ TD_ERR, /* No further specified error. */
+ TD_NOTHR, /* No matching thread found. */
+ TD_NOSV, /* No matching synchronization handle found. */
+ TD_NOLWP, /* No matching light-weighted process found. */
+ TD_BADPH, /* Invalid process handle. */
+ TD_BADTH, /* Invalid thread handle. */
+ TD_BADSH, /* Invalid synchronization handle. */
+ TD_BADTA, /* Invalid thread agent. */
+ TD_BADKEY, /* Invalid key. */
+ TD_NOMSG, /* No event available. */
+ TD_NOFPREGS, /* No floating-point register content available. */
+ TD_NOLIBTHREAD, /* Application not linked with thread library. */
+ TD_NOEVENT, /* Requested event is not supported. */
+ TD_NOCAPAB, /* Capability not available. */
+ TD_DBERR, /* Internal debug library error. */
+ TD_NOAPLIC, /* Operation is not applicable. */
+ TD_NOTSD, /* No thread-specific data available. */
+ TD_MALLOC, /* Out of memory. */
+ TD_PARTIALREG, /* Not entire register set was read or written. */
+ TD_NOXREGS, /* X register set not available for given thread. */
+ TD_TLSDEFER, /* Thread has not yet allocated TLS for given module. */
+ TD_NOTALLOC = TD_TLSDEFER,
+ TD_VERSION, /* Version if libpthread and libthread_db do not match. */
+ TD_NOTLS /* There is no TLS segment in the given module. */
+} td_err_e;
+
+
+/* Possible thread states. TD_THR_ANY_STATE is a pseudo-state used to
+ select threads regardless of state in td_ta_thr_iter(). */
+typedef enum
+{
+ TD_THR_ANY_STATE,
+ TD_THR_UNKNOWN,
+ TD_THR_STOPPED,
+ TD_THR_RUN,
+ TD_THR_ACTIVE,
+ TD_THR_ZOMBIE,
+ TD_THR_SLEEP,
+ TD_THR_STOPPED_ASLEEP
+} td_thr_state_e;
+
+/* Thread type: user or system. TD_THR_ANY_TYPE is a pseudo-type used
+ to select threads regardless of type in td_ta_thr_iter(). */
+typedef enum
+{
+ TD_THR_ANY_TYPE,
+ TD_THR_USER,
+ TD_THR_SYSTEM
+} td_thr_type_e;
+
+
+/* Types of the debugging library. */
+
+/* Handle for a process. This type is opaque. */
+typedef struct td_thragent td_thragent_t;
+
+/* The actual thread handle type. This is also opaque. */
+typedef struct td_thrhandle
+{
+ td_thragent_t *th_ta_p;
+ psaddr_t th_unique;
+} td_thrhandle_t;
+
+
+/* Forward declaration of a type defined by and for the dynamic linker. */
+struct link_map;
+
+
+/* Flags for `td_ta_thr_iter'. */
+#define TD_THR_ANY_USER_FLAGS 0xffffffff
+#define TD_THR_LOWEST_PRIORITY -20
+#define TD_SIGNO_MASK NULL
+
+
+#define TD_EVENTSIZE 2
+#define BT_UISHIFT 5 /* log base 2 of BT_NBIPUI, to extract word index */
+#define BT_NBIPUI (1 << BT_UISHIFT) /* n bits per uint */
+#define BT_UIMASK (BT_NBIPUI - 1) /* to extract bit index */
+
+/* Bitmask of enabled events. */
+typedef struct td_thr_events
+{
+ uint32_t event_bits[TD_EVENTSIZE];
+} td_thr_events_t;
+
+/* Event set manipulation macros. */
+#define __td_eventmask(n) \
+ (UINT32_C (1) << (((n) - 1) & BT_UIMASK))
+#define __td_eventword(n) \
+ ((UINT32_C ((n) - 1)) >> BT_UISHIFT)
+
+#define td_event_emptyset(setp) \
+ do { \
+ int __i; \
+ for (__i = TD_EVENTSIZE; __i > 0; --__i) \
+ (setp)->event_bits[__i - 1] = 0; \
+ } while (0)
+
+#define td_event_fillset(setp) \
+ do { \
+ int __i; \
+ for (__i = TD_EVENTSIZE; __i > 0; --__i) \
+ (setp)->event_bits[__i - 1] = UINT32_C (0xffffffff); \
+ } while (0)
+
+#define td_event_addset(setp, n) \
+ (((setp)->event_bits[__td_eventword (n)]) |= __td_eventmask (n))
+#define td_event_delset(setp, n) \
+ (((setp)->event_bits[__td_eventword (n)]) &= ~__td_eventmask (n))
+#define td_eventismember(setp, n) \
+ (__td_eventmask (n) & ((setp)->event_bits[__td_eventword (n)]))
+#if TD_EVENTSIZE == 2
+# define td_eventisempty(setp) \
+ (!((setp)->event_bits[0]) && !((setp)->event_bits[1]))
+#else
+# error "td_eventisempty must be changed to match TD_EVENTSIZE"
+#endif
+
+/* Events reportable by the thread implementation. */
+typedef enum
+{
+ TD_ALL_EVENTS, /* Pseudo-event number. */
+ TD_EVENT_NONE = TD_ALL_EVENTS, /* Depends on context. */
+ TD_READY, /* Is executable now. */
+ TD_SLEEP, /* Blocked in a synchronization obj. */
+ TD_SWITCHTO, /* Now assigned to a process. */
+ TD_SWITCHFROM, /* Not anymore assigned to a process. */
+ TD_LOCK_TRY, /* Trying to get an unavailable lock. */
+ TD_CATCHSIG, /* Signal posted to the thread. */
+ TD_IDLE, /* Process getting idle. */
+ TD_CREATE, /* New thread created. */
+ TD_DEATH, /* Thread terminated. */
+ TD_PREEMPT, /* Preempted. */
+ TD_PRI_INHERIT, /* Inherited elevated priority. */
+ TD_REAP, /* Reaped. */
+ TD_CONCURRENCY, /* Number of processes changing. */
+ TD_TIMEOUT, /* Conditional variable wait timed out. */
+ TD_MIN_EVENT_NUM = TD_READY,
+ TD_MAX_EVENT_NUM = TD_TIMEOUT,
+ TD_EVENTS_ENABLE = 31 /* Event reporting enabled. */
+} td_event_e;
+
+/* Values representing the different ways events are reported. */
+typedef enum
+{
+ NOTIFY_BPT, /* User must insert breakpoint at u.bptaddr. */
+ NOTIFY_AUTOBPT, /* Breakpoint at u.bptaddr is automatically
+ inserted. */
+ NOTIFY_SYSCALL /* System call u.syscallno will be invoked. */
+} td_notify_e;
+
+/* Description how event type is reported. */
+typedef struct td_notify
+{
+ td_notify_e type; /* Way the event is reported. */
+ union
+ {
+ psaddr_t bptaddr; /* Address of breakpoint. */
+ int syscallno; /* Number of system call used. */
+ } u;
+} td_notify_t;
+
+/* Structure used to report event. */
+typedef struct td_event_msg
+{
+ td_event_e event; /* Event type being reported. */
+ const td_thrhandle_t *th_p; /* Thread reporting the event. */
+ union
+ {
+# if 0
+ td_synchandle_t *sh; /* Handle of synchronization object. */
+#endif
+ uintptr_t data; /* Event specific data. */
+ } msg;
+} td_event_msg_t;
+
+/* Structure containing event data available in each thread structure. */
+typedef struct
+{
+ td_thr_events_t eventmask; /* Mask of enabled events. */
+ td_event_e eventnum; /* Number of last event. */
+ void *eventdata; /* Data associated with event. */
+} td_eventbuf_t;
+
+
+/* Gathered statistics about the process. */
+typedef struct td_ta_stats
+{
+ int nthreads; /* Total number of threads in use. */
+ int r_concurrency; /* Concurrency level requested by user. */
+ int nrunnable_num; /* Average runnable threads, numerator. */
+ int nrunnable_den; /* Average runnable threads, denominator. */
+ int a_concurrency_num; /* Achieved concurrency level, numerator. */
+ int a_concurrency_den; /* Achieved concurrency level, denominator. */
+ int nlwps_num; /* Average number of processes in use,
+ numerator. */
+ int nlwps_den; /* Average number of processes in use,
+ denominator. */
+ int nidle_num; /* Average number of idling processes,
+ numerator. */
+ int nidle_den; /* Average number of idling processes,
+ denominator. */
+} td_ta_stats_t;
+
+
+/* Callback for iteration over threads. */
+typedef int td_thr_iter_f (const td_thrhandle_t *, void *);
+
+/* Callback for iteration over thread local data. */
+typedef int td_key_iter_f (thread_key_t, void (*) (void *), void *);
+
+
+
+/* Forward declaration. This has to be defined by the user. */
+struct ps_prochandle;
+
+
+/* Information about the thread. */
+typedef struct td_thrinfo
+{
+ td_thragent_t *ti_ta_p; /* Process handle. */
+ unsigned int ti_user_flags; /* Unused. */
+ thread_t ti_tid; /* Thread ID returned by
+ pthread_create(). */
+ char *ti_tls; /* Pointer to thread-local data. */
+ psaddr_t ti_startfunc; /* Start function passed to
+ pthread_create(). */
+ psaddr_t ti_stkbase; /* Base of thread's stack. */
+ long int ti_stksize; /* Size of thread's stack. */
+ psaddr_t ti_ro_area; /* Unused. */
+ int ti_ro_size; /* Unused. */
+ td_thr_state_e ti_state; /* Thread state. */
+ unsigned char ti_db_suspended; /* Nonzero if suspended by debugger. */
+ td_thr_type_e ti_type; /* Type of the thread (system vs
+ user thread). */
+ intptr_t ti_pc; /* Unused. */
+ intptr_t ti_sp; /* Unused. */
+ short int ti_flags; /* Unused. */
+ int ti_pri; /* Thread priority. */
+ lwpid_t ti_lid; /* Kernel PID for this thread. */
+ sigset_t ti_sigmask; /* Signal mask. */
+ unsigned char ti_traceme; /* Nonzero if event reporting
+ enabled. */
+ unsigned char ti_preemptflag; /* Unused. */
+ unsigned char ti_pirecflag; /* Unused. */
+ sigset_t ti_pending; /* Set of pending signals. */
+ td_thr_events_t ti_events; /* Set of enabled events. */
+} td_thrinfo_t;
+
+
+
+/* Prototypes for exported library functions. */
+
+/* Initialize the thread debug support library. */
+extern td_err_e td_init (void);
+
+/* Historical relict. Should not be used anymore. */
+extern td_err_e td_log (void);
+
+/* Return list of symbols the library can request. */
+extern const char **td_symbol_list (void);
+
+/* Generate new thread debug library handle for process PS. */
+extern td_err_e td_ta_new (struct ps_prochandle *__ps, td_thragent_t **__ta);
+
+/* Free resources allocated for TA. */
+extern td_err_e td_ta_delete (td_thragent_t *__ta);
+
+/* Get number of currently running threads in process associated with TA. */
+extern td_err_e td_ta_get_nthreads (const td_thragent_t *__ta, int *__np);
+
+/* Return process handle passed in `td_ta_new' for process associated with
+ TA. */
+extern td_err_e td_ta_get_ph (const td_thragent_t *__ta,
+ struct ps_prochandle **__ph);
+
+/* Map thread library handle PT to thread debug library handle for process
+ associated with TA and store result in *TH. */
+extern td_err_e td_ta_map_id2thr (const td_thragent_t *__ta, pthread_t __pt,
+ td_thrhandle_t *__th);
+
+/* Map process ID LWPID to thread debug library handle for process
+ associated with TA and store result in *TH. */
+extern td_err_e td_ta_map_lwp2thr (const td_thragent_t *__ta, lwpid_t __lwpid,
+ td_thrhandle_t *__th);
+
+
+/* Call for each thread in a process associated with TA the callback function
+ CALLBACK. */
+extern td_err_e td_ta_thr_iter (const td_thragent_t *__ta,
+ td_thr_iter_f *__callback, void *__cbdata_p,
+ td_thr_state_e __state, int __ti_pri,
+ sigset_t *__ti_sigmask_p,
+ unsigned int __ti_user_flags);
+
+/* Call for each defined thread local data entry the callback function KI. */
+extern td_err_e td_ta_tsd_iter (const td_thragent_t *__ta, td_key_iter_f *__ki,
+ void *__p);
+
+
+/* Get event address for EVENT. */
+extern td_err_e td_ta_event_addr (const td_thragent_t *__ta,
+ td_event_e __event, td_notify_t *__ptr);
+
+/* Enable EVENT in global mask. */
+extern td_err_e td_ta_set_event (const td_thragent_t *__ta,
+ td_thr_events_t *__event);
+
+/* Disable EVENT in global mask. */
+extern td_err_e td_ta_clear_event (const td_thragent_t *__ta,
+ td_thr_events_t *__event);
+
+/* Return information about last event. */
+extern td_err_e td_ta_event_getmsg (const td_thragent_t *__ta,
+ td_event_msg_t *__msg);
+
+
+/* Set suggested concurrency level for process associated with TA. */
+extern td_err_e td_ta_setconcurrency (const td_thragent_t *__ta, int __level);
+
+
+/* Enable collecting statistics for process associated with TA. */
+extern td_err_e td_ta_enable_stats (const td_thragent_t *__ta, int __enable);
+
+/* Reset statistics. */
+extern td_err_e td_ta_reset_stats (const td_thragent_t *__ta);
+
+/* Retrieve statistics from process associated with TA. */
+extern td_err_e td_ta_get_stats (const td_thragent_t *__ta,
+ td_ta_stats_t *__statsp);
+
+
+/* Validate that TH is a thread handle. */
+extern td_err_e td_thr_validate (const td_thrhandle_t *__th);
+
+/* Return information about thread TH. */
+extern td_err_e td_thr_get_info (const td_thrhandle_t *__th,
+ td_thrinfo_t *__infop);
+
+/* Retrieve floating-point register contents of process running thread TH. */
+extern td_err_e td_thr_getfpregs (const td_thrhandle_t *__th,
+ prfpregset_t *__regset);
+
+/* Retrieve general register contents of process running thread TH. */
+extern td_err_e td_thr_getgregs (const td_thrhandle_t *__th,
+ prgregset_t __gregs);
+
+/* Retrieve extended register contents of process running thread TH. */
+extern td_err_e td_thr_getxregs (const td_thrhandle_t *__th, void *__xregs);
+
+/* Get size of extended register set of process running thread TH. */
+extern td_err_e td_thr_getxregsize (const td_thrhandle_t *__th, int *__sizep);
+
+/* Set floating-point register contents of process running thread TH. */
+extern td_err_e td_thr_setfpregs (const td_thrhandle_t *__th,
+ const prfpregset_t *__fpregs);
+
+/* Set general register contents of process running thread TH. */
+extern td_err_e td_thr_setgregs (const td_thrhandle_t *__th,
+ prgregset_t __gregs);
+
+/* Set extended register contents of process running thread TH. */
+extern td_err_e td_thr_setxregs (const td_thrhandle_t *__th,
+ const void *__addr);
+
+
+/* Get address of the given module's TLS storage area for the given thread. */
+extern td_err_e td_thr_tlsbase (const td_thrhandle_t *__th,
+ unsigned long int __modid,
+ psaddr_t *__base);
+
+/* Get address of thread local variable. */
+extern td_err_e td_thr_tls_get_addr (const td_thrhandle_t *__th,
+ psaddr_t __map_address, size_t __offset,
+ psaddr_t *__address);
+
+
+/* Enable reporting for EVENT for thread TH. */
+extern td_err_e td_thr_event_enable (const td_thrhandle_t *__th, int __event);
+
+/* Enable EVENT for thread TH. */
+extern td_err_e td_thr_set_event (const td_thrhandle_t *__th,
+ td_thr_events_t *__event);
+
+/* Disable EVENT for thread TH. */
+extern td_err_e td_thr_clear_event (const td_thrhandle_t *__th,
+ td_thr_events_t *__event);
+
+/* Get event message for thread TH. */
+extern td_err_e td_thr_event_getmsg (const td_thrhandle_t *__th,
+ td_event_msg_t *__msg);
+
+
+/* Set priority of thread TH. */
+extern td_err_e td_thr_setprio (const td_thrhandle_t *__th, int __prio);
+
+
+/* Set pending signals for thread TH. */
+extern td_err_e td_thr_setsigpending (const td_thrhandle_t *__th,
+ unsigned char __n, const sigset_t *__ss);
+
+/* Set signal mask for thread TH. */
+extern td_err_e td_thr_sigsetmask (const td_thrhandle_t *__th,
+ const sigset_t *__ss);
+
+
+/* Return thread local data associated with key TK in thread TH. */
+extern td_err_e td_thr_tsd (const td_thrhandle_t *__th,
+ const thread_key_t __tk, void **__data);
+
+
+/* Suspend execution of thread TH. */
+extern td_err_e td_thr_dbsuspend (const td_thrhandle_t *__th);
+
+/* Resume execution of thread TH. */
+extern td_err_e td_thr_dbresume (const td_thrhandle_t *__th);
+
+#endif /* thread_db.h */
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/time.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/time.c
new file mode 100644
index 0000000000..28aa636014
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/time.c
@@ -0,0 +1,32 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <inline-syscall.h>
+#include <time.h>
+
+DECLARE_INLINE_SYSCALL (time_t, time, void);
+
+time_t time(time_t *t)
+{
+ time_t _t = INLINE_SYSCALL (time, 0);
+ if(t)
+ *t = _t;
+ return _t;
+}
+libc_hidden_def (time)
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/truncate.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/truncate.c
new file mode 100644
index 0000000000..50b0a4fecf
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/truncate.c
@@ -0,0 +1,41 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <not-cancel.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <fcntl.h>
+
+int
+__truncate (path, length)
+ const char *path;
+ off_t length;
+{
+ int fd, ret;
+
+ fd = open_not_cancel_2 (path, O_WRONLY);
+ if (fd == -1)
+ return -1;
+
+ ret = __ftruncate (fd, length);
+ close_not_cancel_no_status (fd);
+
+ return ret;
+}
+weak_alias (__truncate, truncate)
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/truncate64.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/truncate64.c
new file mode 100644
index 0000000000..f9277f001d
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/truncate64.c
@@ -0,0 +1,40 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <not-cancel.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <fcntl.h>
+
+int
+truncate64 (path, length)
+ const char *path;
+ off64_t length;
+{
+ int fd, ret;
+
+ fd = open64_not_cancel_2 (path, O_WRONLY);
+ if (fd == -1)
+ return -1;
+
+ ret = __ftruncate64 (fd, length);
+ close_not_cancel_no_status (fd);
+
+ return ret;
+}
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/ttyname.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/ttyname.c
new file mode 100644
index 0000000000..9e7fe9a87d
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/ttyname.c
@@ -0,0 +1,49 @@
+/* Copyright (C) 1991,92,93,1996-2002,2006,2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#define __TTYNAME_NO_CHECKS
+#define __ASSUME_PROC_SELF_FD_NOT_SYMLINK
+#include <sysdeps/unix/sysv/linux/ttyname.c>
+
+char *
+_ttyname_dev (dev_t rdev, char *buffer, size_t buflen)
+{
+ struct stat64 st;
+ int dostat = 0;
+ char *name;
+ int save = errno;
+
+ if (__xstat64 (_STAT_VER, "/dev/pts", &st) == 0 && S_ISDIR (st.st_mode))
+ {
+ dostat = 1;
+ name = getttyname ("/dev/pts", rdev, -1, save, &dostat);
+ }
+ else
+ {
+ __set_errno (save);
+ name = NULL;
+ }
+
+ if (!name && dostat != -1)
+ {
+ dostat = 1;
+ name = getttyname ("/dev", rdev, -1, save, &dostat);
+ }
+
+ return name;
+}
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/ttyname_r.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/ttyname_r.c
new file mode 100644
index 0000000000..ebdc8d7220
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/ttyname_r.c
@@ -0,0 +1,3 @@
+#define __TTYNAME_NO_CHECKS
+#define __ASSUME_PROC_SELF_FD_NOT_SYMLINK
+#include <sysdeps/unix/sysv/linux/ttyname_r.c>
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/ualarm.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/ualarm.c
new file mode 100644
index 0000000000..5522f58892
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/ualarm.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/bsd/ualarm.c>
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/ucred.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/ucred.c
new file mode 100644
index 0000000000..5da3485d5e
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/ucred.c
@@ -0,0 +1,328 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <inline-syscall.h>
+#include <unistd.h>
+#include <ucredP.h>
+#include <auditP.h>
+#include <priv.h>
+#include <procfs.h>
+#include <errno.h>
+#include <assert.h>
+
+DECLARE_INLINE_SYSCALL (int, getpeerucred, int fd, ucred_t *ucred);
+DECLARE_INLINE_SYSCALL (int, ucred_get, pid_t pid, ucred_t *ucred);
+
+/* Docs: http://docs.sun.com/app/docs/doc/816-5168/ucred-get-3c?a=view
+ http://docs.sun.com/app/docs/doc/816-5168/getpeerucred-3c?l=ru&a=view */
+
+
+ucred_t *_ucred_alloc (void)
+{
+ size_t uc_size = ucred_size ();
+ ucred_t *uc = malloc (uc_size);
+ if (uc)
+ uc->uc_size = uc_size;
+ return uc;
+}
+
+
+ucred_t *ucred_get (pid_t pid)
+{
+ ucred_t *uc = _ucred_alloc ();
+ if (!uc)
+ return NULL;
+
+ int res = INLINE_SYSCALL (ucred_get, 2, pid, uc);
+ if (res != 0)
+ return NULL;
+
+ return uc;
+}
+
+
+void ucred_free (ucred_t *uc)
+{
+ free(uc);
+}
+
+
+uid_t ucred_geteuid (const ucred_t *uc)
+{
+ if (uc->uc_credoff == 0)
+ {
+ __set_errno (EINVAL);
+ return (uid_t)-1;
+ }
+
+ return (uid_t)((prcred_t *)((char *)uc + uc->uc_credoff))->pr_euid;
+}
+
+
+uid_t ucred_getruid (const ucred_t *uc)
+{
+ if (uc->uc_credoff == 0)
+ {
+ __set_errno (EINVAL);
+ return (uid_t)-1;
+ }
+
+ return (uid_t)((prcred_t *)((char *)uc + uc->uc_credoff))->pr_ruid;
+}
+
+
+uid_t ucred_getsuid (const ucred_t *uc)
+{
+ if (uc->uc_credoff == 0)
+ {
+ __set_errno (EINVAL);
+ return (uid_t)-1;
+ }
+
+ return (uid_t)((prcred_t *)((char *)uc + uc->uc_credoff))->pr_suid;
+}
+
+
+gid_t ucred_getegid (const ucred_t *uc)
+{
+ if (uc->uc_credoff == 0)
+ {
+ __set_errno (EINVAL);
+ return (gid_t)-1;
+ }
+
+ return (gid_t)((prcred_t *)((char *)uc + uc->uc_credoff))->pr_egid;
+}
+
+
+gid_t ucred_getrgid (const ucred_t *uc)
+{
+ if (uc->uc_credoff == 0)
+ {
+ __set_errno (EINVAL);
+ return (gid_t)-1;
+ }
+
+ return (gid_t)((prcred_t *)((char *)uc + uc->uc_credoff))->pr_rgid;
+}
+
+
+gid_t ucred_getsgid (const ucred_t *uc)
+{
+ if (uc->uc_credoff == 0)
+ {
+ __set_errno(EINVAL); \
+ return (gid_t)-1; \
+ }
+
+ return (gid_t)((prcred_t *)((char *)uc + uc->uc_credoff))->pr_sgid;
+}
+
+
+int ucred_getgroups (const ucred_t *uc, const gid_t **groups)
+{
+ if (uc->uc_credoff == 0 || groups == NULL)
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ /* The docs say that *groups should always be free'd, so we make sure
+ it's NULL if there are no groups. */
+ prcred_t *cred = (prcred_t *)((char *)uc + uc->uc_credoff);
+ if (cred->pr_ngroups > 0)
+ *groups = cred->pr_groups;
+ else
+ *groups = NULL;
+
+ return cred->pr_ngroups;
+}
+
+
+const priv_set_t *ucred_getprivset (const ucred_t *uc, const char *set)
+{
+ /* Get prpriv_t. */
+ if (uc->uc_privoff == 0)
+ {
+ __set_errno (EINVAL);
+ return NULL;
+ }
+ prpriv_t * pr = (prpriv_t *)((char *)uc + uc->uc_privoff);
+
+ /* Get priv set number. */
+ int setnum = priv_getsetbyname (set);
+ if (setnum == -1)
+ return NULL;
+
+ return (priv_set_t *)&pr->pr_sets[setnum * pr->pr_setsize];
+}
+
+
+pid_t ucred_getpid (const ucred_t *uc)
+{
+ if(uc->uc_pid == (pid_t)-1)
+ __set_errno (EINVAL);
+
+ return uc->uc_pid;
+}
+
+
+projid_t ucred_getprojid (const ucred_t *uc)
+{
+ if(uc->uc_projid == (projid_t)-1)
+ __set_errno (EINVAL);
+
+ return uc->uc_projid;
+}
+
+
+zoneid_t ucred_getzoneid (const ucred_t *uc)
+{
+ if(uc->uc_zoneid == (zoneid_t)-1)
+ __set_errno (EINVAL);
+
+ return uc->uc_zoneid;
+}
+
+
+unsigned int ucred_getpflags (const ucred_t *uc, unsigned int flags)
+{
+ /* Get prpriv_t. */
+ if (uc->uc_privoff == 0)
+ {
+ __set_errno (EINVAL);
+ return (unsigned int)-1;
+ }
+ prpriv_t *pr = (prpriv_t *)((char *)uc + uc->uc_privoff);
+
+ /* Iterate over all priv_info_t's. Note that the first priv_info_t follows
+ the list of priv sets. */
+ priv_info_t * pi = (priv_info_t *)&pr->pr_sets[pr->pr_nsets * pr->pr_setsize];
+ uint32_t left = pr->pr_infosize;
+ while (left)
+ {
+ if (pi->priv_info_type == PRIV_INFO_FLAGS)
+ return ((priv_info_uint_t *)pi)->val & flags;
+
+ left -= pi->priv_info_size;
+ pi = (priv_info_t *)((char *)pi + pi->priv_info_size);
+ }
+
+ /* We didn't find PRIV_INFO_FLAGS. */
+ __set_errno (EINVAL);
+ return (unsigned int)-1;
+}
+
+
+m_label_t *ucred_getlabel (const ucred_t *uc)
+{
+ extern int is_system_labeled (void);
+
+ if (!is_system_labeled () || uc->uc_labeloff == 0)
+ {
+ __set_errno (EINVAL);
+ return NULL;
+ }
+
+ return (m_label_t *)((char *)uc + uc->uc_labeloff);
+}
+
+
+au_id_t ucred_getauid (const ucred_t *uc)
+{
+ if (uc->uc_audoff == 0)
+ return AU_NOAUDITID;
+ const auditinfo64_addr_t *info = (auditinfo64_addr_t *)
+ ((char *)uc + uc->uc_audoff);
+
+ return info->ai_auid;
+}
+
+
+au_asid_t ucred_getasid (const ucred_t *uc)
+{
+ if (uc->uc_audoff == 0)
+ return (au_asid_t)-1;
+ const auditinfo64_addr_t *info = (auditinfo64_addr_t *)
+ ((char *)uc + uc->uc_audoff);
+
+ return info->ai_asid;
+}
+
+
+const au_tid64_addr_t * ucred_getatid (const ucred_t *uc)
+{
+ if (uc->uc_audoff == 0)
+ {
+ __set_errno (EINVAL);
+ return NULL;
+ }
+ const auditinfo64_addr_t *info = (auditinfo64_addr_t *)
+ ((char *)uc + uc->uc_audoff);
+
+ return &info->ai_termid;
+}
+
+
+const au_mask_t * ucred_getamask (const ucred_t *uc)
+{
+ if (uc->uc_audoff == 0)
+ {
+ __set_errno (EINVAL);
+ return NULL;
+ }
+ const auditinfo64_addr_t *info = (auditinfo64_addr_t *)
+ ((char *)uc + uc->uc_audoff);
+
+ return &info->ai_mask;
+}
+
+
+size_t ucred_size (void)
+{
+ const priv_impl_info_t *info = getprivimplinfo ();
+
+ return sizeof (ucred_t) + sizeof (prcred_t) + sizeof (prpriv_t) +
+ ((int)sysconf (_SC_NGROUPS_MAX) - 1) * sizeof (gid_t) +
+ sizeof (priv_chunk_t) * (info->priv_setsize * info->priv_nsets - 1) +
+ info->priv_infosize + sizeof (auditinfo64_addr_t) + BSLABEL_T_SIZE;
+}
+
+
+int getpeerucred (int fd, ucred_t **ucred)
+{
+ ucred_t *uc = *ucred;
+
+ /* alloc ucred if needed */
+ if (*ucred == NULL)
+ {
+ uc = _ucred_alloc ();
+ if (!uc)
+ return -1;
+ *ucred = uc;
+ }
+
+ int res = INLINE_SYSCALL (getpeerucred, 2, fd, uc);
+ if (res == -1 && *ucred == NULL)
+ free (uc);
+ else if (res == 0 && *ucred == NULL)
+ *ucred = uc;
+
+ return res;
+}
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/ucred.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/ucred.h
new file mode 100644
index 0000000000..004a4d2d9e
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/ucred.h
@@ -0,0 +1,54 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _UCRED_H
+#define _UCRED_H
+
+#include <features.h>
+#include <sys/types.h>
+#include <sys/priv.h>
+#include <sys/tsol/label.h>
+
+typedef struct ucred_s ucred_t;
+
+__BEGIN_DECLS
+
+extern ucred_t *ucred_get (pid_t pid);
+extern void ucred_free (ucred_t *uc);
+extern size_t ucred_size (void);
+
+extern uid_t ucred_geteuid (const ucred_t *uc);
+extern uid_t ucred_getruid (const ucred_t *uc);
+extern uid_t ucred_getsuid (const ucred_t *uc);
+extern gid_t ucred_getegid (const ucred_t *uc);
+extern gid_t ucred_getrgid (const ucred_t *uc);
+extern gid_t ucred_getsgid (const ucred_t *uc);
+extern pid_t ucred_getpid (const ucred_t *uc);
+extern projid_t ucred_getprojid (const ucred_t *uc);
+extern zoneid_t ucred_getzoneid (const ucred_t *uc);
+
+extern int ucred_getgroups (const ucred_t *uc, const gid_t **groups);
+extern const priv_set_t *ucred_getprivset (const ucred_t *uc, const char *set);
+extern unsigned int ucred_getpflags (const ucred_t *uc, unsigned int flags);
+extern m_label_t *ucred_getlabel (const ucred_t *uc);
+
+extern int getpeerucred (int fd, ucred_t **ucred);
+
+__END_DECLS
+
+#endif /* _UCRED_H */
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/ucredP.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/ucredP.h
new file mode 100644
index 0000000000..0e8721e1e2
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/ucredP.h
@@ -0,0 +1,43 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _UCREDP_H
+#define _UCREDP_H
+
+#include <sys/types.h>
+
+struct ucred_s
+ {
+ uint32_t uc_size;
+ uint32_t uc_credoff;
+ uint32_t uc_privoff;
+ pid_t uc_pid;
+ uint32_t uc_audoff;
+ zoneid_t uc_zoneid;
+ projid_t uc_projid;
+ uint32_t uc_labeloff;
+ };
+
+#include <ucred.h>
+
+#define BSLABEL_T_SIZE 36
+
+extern ucred_t *_ucred_alloc (void);
+
+#endif /* _UCREDP_H */
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/ulimit.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/ulimit.h
new file mode 100644
index 0000000000..3a315c1962
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/ulimit.h
@@ -0,0 +1,50 @@
+/* Copyright (C) 1997, 1998, 1999 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _ULIMIT_H
+#define _ULIMIT_H 1
+
+#include <features.h>
+
+/* Constants used as the first parameter for `ulimit'. They denote limits
+ which can be set or retrieved using this function. */
+enum
+{
+ UL_GETFSIZE = 1, /* Return limit on the size of a file,
+ in units of 512 bytes. */
+#define UL_GETFSIZE UL_GETFSIZE
+ UL_SETFSIZE, /* Set limit on the size of a file to
+ second argument. */
+#define UL_SETFSIZE UL_SETFSIZE
+
+ UL_GMEMLIM,
+#define UL_GMEMLIM UL_GMEMLIM
+
+ UL_GDESLIM
+#define UL_GDESLIM UL_GDESLIM
+};
+
+
+__BEGIN_DECLS
+
+/* Control process limits according to CMD. */
+extern long int ulimit (int __cmd, ...) __THROW;
+
+__END_DECLS
+
+#endif /* ulimit.h */
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/ulltostr.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/ulltostr.c
new file mode 100644
index 0000000000..a7438b7f1d
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/ulltostr.c
@@ -0,0 +1,30 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+/* Docs: http://docs.sun.com/app/docs/doc/816-0213/6m6ne385a */
+
+char *ulltostr (unsigned long long value, char *endptr)
+{
+ while (value)
+ {
+ *--endptr = '0' + (value % 10);
+ value /= 10;
+ }
+ return endptr;
+}
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/umount.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/umount.c
new file mode 100644
index 0000000000..52d22ff7f1
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/umount.c
@@ -0,0 +1,28 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+extern int umount2 (const char*, int);
+
+int
+__umount (const char *name)
+{
+ return umount2 (name, 0);
+}
+
+weak_alias (__umount, umount);
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/uname.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/uname.c
new file mode 100644
index 0000000000..617c68a579
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/uname.c
@@ -0,0 +1,48 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <inline-syscall.h>
+#include <sys/utsname.h>
+#include <string.h>
+
+/* TODO: temporary hack */
+#define UNAME_SYSNAME "GNU/kOpenSolaris"
+#define UNAME_MACHINE "i686"
+
+DECLARE_INLINE_SYSCALL (int, uname, struct utsname *buf);
+
+int
+__uname (struct utsname *uname)
+{
+ int result = INLINE_SYSCALL (uname, 1, uname);
+
+ /* TODO: temporary hack */
+ if (result >= 0)
+ {
+ memcpy (uname->sysname, UNAME_SYSNAME, sizeof(UNAME_SYSNAME));
+ memcpy (uname->machine, UNAME_MACHINE, sizeof(UNAME_MACHINE));
+ }
+
+ /* the uname syscall returns 1 on success */
+ return (result >= 0) ? 0 : -1;
+}
+
+weak_alias (__uname, uname)
+libc_hidden_def (__uname)
+libc_hidden_def (uname)
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/unlockpt.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/unlockpt.c
new file mode 100644
index 0000000000..9184ad96f8
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/unlockpt.c
@@ -0,0 +1,40 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <stdlib.h>
+#include <streams/stropts.h>
+#include <sys/ptms.h>
+#include <stddef.h>
+#include <errno.h>
+
+int
+unlockpt (int fd)
+{
+ /* Send UNLKPT down. */
+ struct strioctl si;
+ si.ic_cmd = UNLKPT;
+ si.ic_timout = 0;
+ si.ic_len = 0;
+ si.ic_dp = NULL;
+
+ int res = (ioctl (fd, I_STR, &si) < 0) ? -1 :0;
+ if (res != 0 && errno == ENOTTY)
+ __set_errno (EINVAL);
+ return res;
+}
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/user_attr-lookup.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/user_attr-lookup.c
new file mode 100644
index 0000000000..066cc510c1
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/user_attr-lookup.c
@@ -0,0 +1,23 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#define DATABASE_NAME user_attr
+#define DEFAULT_CONFIG "files nis"
+
+#include "XXX-lookup.c"
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/user_attrP.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/user_attrP.h
new file mode 100644
index 0000000000..5c8a670334
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/user_attrP.h
@@ -0,0 +1,43 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _USER_ATTRP_H
+#define _USER_ATTRP_H
+
+#include <sys/types.h>
+#include <nss/nss.h>
+
+#define NSS_BUFLEN_USERATTR 1024
+
+typedef struct userstr_s
+ {
+ char *name;
+ char *qualifier;
+ char *res1;
+ char *res2;
+ char *attr;
+ } userstr_t;
+
+struct parser_data;
+extern int _nss_files_parse_userattr (char *line, struct userstr_s *result,
+ struct parser_data *data,
+ size_t datalen, int *errnop);
+libc_hidden_proto (_nss_files_parse_userattr)
+
+#endif /* _USER_ATTRP_H */
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/usleep.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/usleep.c
new file mode 100644
index 0000000000..f390c9367c
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/usleep.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/usleep.c>
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/ustat.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/ustat.c
new file mode 100644
index 0000000000..9cfd8ed518
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/ustat.c
@@ -0,0 +1,34 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <inline-syscall.h>
+#include <ustat.h>
+#include <sys/types.h>
+#include <unistd.h>
+
+DECLARE_INLINE_SYSCALL (int, utssys, void *buf, long arg, int type,
+ void *outbp);
+
+int
+ustat (dev, ust)
+ dev_t dev;
+ struct ustat * ust;
+{
+ return INLINE_SYSCALL (utssys, 3, ust, dev, SYS_SUB_ustat, NULL);
+}
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/vfstab.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/vfstab.c
new file mode 100644
index 0000000000..97d72a35f5
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/vfstab.c
@@ -0,0 +1,117 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <stdio.h>
+#include <sys/vfstab.h>
+#include <string.h>
+
+#define _VFS_DELIM " \t"
+#define _VFS_CMP(x, y, f) (!y->f || (y->f && strcmp (x->f, y->f) == 0))
+
+static __thread char vfs_buf[VFS_LINE_MAX + 2];
+
+
+static int vfs_strtok_r (char *str, const char *delim,
+ char **saveptr, char **strt)
+{
+ int ret = (*strt = strtok_r (str, delim, saveptr)) ? 1 : 0;
+ if (*strt && strcmp (*strt, "-") == 0)
+ *strt = NULL;
+ return ret;
+}
+
+
+int getvfsent (FILE *fp, struct vfstab *vp)
+{
+ while (fgets (vfs_buf, VFS_LINE_MAX + 2, fp) != NULL)
+ {
+ /* Check for long lines. */
+ size_t len = strlen (vfs_buf);
+ if (len > VFS_LINE_MAX)
+ return VFS_TOOLONG;
+
+ /* Trim leading spaces/tabs. */
+ char *bufp = vfs_buf;
+ while (*bufp == ' ' || *bufp == '\t')
+ bufp++;
+ len = strlen (bufp);
+
+ /* Ignore empty lines and lines starting with #. */
+ if (len && (bufp[0] == '\n' || bufp[0] == '#'))
+ continue;
+
+ bufp[len - 1] = '\0';
+
+ /* Tokenize. */
+ char *tokp = NULL;
+ if (!vfs_strtok_r (bufp, _VFS_DELIM, &tokp, &vp->vfs_special) ||
+ !vfs_strtok_r (NULL, _VFS_DELIM, &tokp, &vp->vfs_fsckdev) ||
+ !vfs_strtok_r (NULL, _VFS_DELIM, &tokp, &vp->vfs_mountp) ||
+ !vfs_strtok_r (NULL, _VFS_DELIM, &tokp, &vp->vfs_fstype) ||
+ !vfs_strtok_r (NULL, _VFS_DELIM, &tokp, &vp->vfs_fsckpass) ||
+ !vfs_strtok_r (NULL, _VFS_DELIM, &tokp, &vp->vfs_automnt) ||
+ !vfs_strtok_r (NULL, _VFS_DELIM, &tokp, &vp->vfs_mntopts))
+ return VFS_TOOFEW;
+
+ /* If we can still tokenize the line is too long. */
+ if (strtok_r (NULL, _VFS_DELIM, &tokp))
+ return VFS_TOOMANY;
+
+ return 0;
+ }
+
+ return -1;
+}
+
+
+int getvfsany (FILE *fp, struct vfstab *vp, struct vfstab *vpref)
+{
+ int res;
+ while ((res = getvfsent (fp, vp)) == 0)
+ {
+ if (_VFS_CMP (vp, vpref, vfs_special) &&
+ _VFS_CMP (vp, vpref, vfs_fsckdev) &&
+ _VFS_CMP (vp, vpref, vfs_mountp) &&
+ _VFS_CMP (vp, vpref, vfs_fstype) &&
+ _VFS_CMP (vp, vpref, vfs_fsckpass) &&
+ _VFS_CMP (vp, vpref, vfs_automnt) &&
+ _VFS_CMP (vp, vpref, vfs_mntopts))
+ return 0;
+ }
+
+ return res;
+}
+
+
+int getvfsfile (FILE *fp, struct vfstab *vp, char *file)
+{
+ struct vfstab vref = {
+ .vfs_mountp = file
+ };
+ return getvfsany (fp, vp, &vref);
+}
+
+
+int getvfsspec (FILE *fp, struct vfstab *vp, char *spec)
+{
+ struct vfstab vref = {
+ .vfs_special = spec
+ };
+ return getvfsany (fp, vp, &vref);
+}
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/wait.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/wait.c
new file mode 100644
index 0000000000..e223d46e1a
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/wait.c
@@ -0,0 +1,3 @@
+#include <sysdep-cancel.h>
+#include <sysdeps/posix/wait.c>
+LIBC_CANCEL_HANDLED (); /* waitpid handles cancellation */
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/wait3.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/wait3.c
new file mode 100644
index 0000000000..0b3bdee771
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/wait3.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/bsd/bsd4.4/wait3.c>
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/wait4.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/wait4.c
new file mode 100644
index 0000000000..9f8cfada0a
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/wait4.c
@@ -0,0 +1,60 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sys/types.h>
+#include <sys/resource.h>
+#include <sys/wait.h>
+#include <sys/times.h>
+#include <time.h>
+
+/* Solaris only supports user/system time fields of rusage for wait. */
+
+pid_t
+__wait4 (__pid_t pid, __WAIT_STATUS stat_loc, int options,
+ struct rusage *usage)
+{
+ /* start time */
+ struct tms start;
+ if (usage && times (&start) == (clock_t)-1)
+ return -1;
+
+ /* wait */
+ pid = __waitpid (pid, stat_loc.__iptr, options);
+ if (pid == -1)
+ return -1;
+
+ /* end time */
+ struct tms end;
+ if (usage && times (&end) == (clock_t)-1)
+ return -1;
+
+ /* compute deltas */
+ if (usage)
+ {
+ clock_t dutime = end.tms_cutime - start.tms_cutime;
+ clock_t dstime = end.tms_cstime - start.tms_cstime;
+ usage->ru_utime.tv_sec = dutime / CLOCKS_PER_SEC;
+ usage->ru_utime.tv_usec = (dutime % CLOCKS_PER_SEC) * (1000000 / CLOCKS_PER_SEC);
+ usage->ru_stime.tv_sec = dstime / CLOCKS_PER_SEC;
+ usage->ru_stime.tv_usec = (dstime % CLOCKS_PER_SEC) * (1000000 / CLOCKS_PER_SEC);
+ }
+
+ return pid;
+}
+weak_alias (__wait4, wait4)
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/waitpid.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/waitpid.c
new file mode 100644
index 0000000000..62a780f8c6
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/waitpid.c
@@ -0,0 +1,92 @@
+/* Copyright (C) 1991,92,95,96,97,2002,2003 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sysdep-cancel.h>
+#include <stdlib.h>
+#include <sys/wait.h>
+#include <unistd.h>
+#include <not-cancel.h>
+#include <stdio.h>
+
+__pid_t
+__waitpid_not_cancel (__pid_t pid, int *stat_loc, int options)
+{
+ int res;
+ siginfo_t info;
+
+ /* wait until the child dies */
+ options |= WEXITED | WTRAPPED;
+
+ /* implement waitpid by calling waitid */
+ if (pid < -1)
+ res = waitid_not_cancel (P_PGID, -pid, &info, options);
+ else if (pid == -1)
+ res = waitid_not_cancel (P_ALL, 0, &info, options);
+ else if (pid == 0)
+ res = waitid_not_cancel (P_PGID, getpgid(0), &info, options);
+ else /* if(pid > 0) */
+ res = waitid_not_cancel (P_PID, pid, &info, options);
+
+ if (res == -1)
+ return -1;
+
+ /* use info.si_code and info.si_status to set stat_loc */
+ if (stat_loc)
+ {
+ switch (info.si_code)
+ {
+ case CLD_EXITED:
+ *stat_loc = (info.si_status & 0xff) << 8;
+ break;
+ case CLD_KILLED:
+ *stat_loc = (info.si_status & 0x7f);
+ break;
+ case CLD_DUMPED:
+ *stat_loc = (info.si_status & 0x7f) | WCOREFLG;
+ break;
+ case CLD_TRAPPED:
+ case CLD_STOPPED:
+ *stat_loc = ((info.si_status & 0xff) << 8) | WSTOPFLG;
+ break;
+ case CLD_CONTINUED:
+ *stat_loc = WCONTFLG;
+ break;
+ }
+ }
+
+ return info.si_pid;
+}
+
+__pid_t
+__libc_waitpid (__pid_t pid, int *stat_loc, int options)
+{
+ if (SINGLE_THREAD_P)
+ return __waitpid_not_cancel (pid, stat_loc, options);
+
+ int oldtype = LIBC_CANCEL_ASYNC ();
+
+ __pid_t res = __waitpid_not_cancel (pid, stat_loc, options);
+
+ LIBC_CANCEL_RESET (oldtype);
+
+ return res;
+}
+
+weak_alias (__libc_waitpid, __waitpid)
+libc_hidden_weak (__waitpid)
+weak_alias (__libc_waitpid, waitpid)
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/x86/Makefile b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/x86/Makefile
new file mode 100644
index 0000000000..943714d531
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/x86/Makefile
@@ -0,0 +1,6 @@
+ifeq ($(subdir),misc)
+sysdep_routines += sysi86
+endif
+ifeq ($(subdir),misc)
+gen-as-const-headers += door-offsets.sym
+endif
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/x86/Versions b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/x86/Versions
new file mode 100644
index 0000000000..967d374fea
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/x86/Versions
@@ -0,0 +1,5 @@
+libc {
+ GLIBC_2.7 {
+ sysi86;
+ }
+}
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/x86/bits/machtypes.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/x86/bits/machtypes.h
new file mode 100644
index 0000000000..307fb79292
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/x86/bits/machtypes.h
@@ -0,0 +1,53 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _BITS_MACHTYPES_H
+#define _BITS_MACHTYPES_H
+
+#include <features.h>
+
+#ifdef __USE_MISC
+
+#define REG_LABEL_PC 0
+#define REG_LABEL_SP 1
+#define REG_LABEL_BP 2
+#ifdef __i386__
+# define REG_LABEL_EBX 3
+# define REG_LABEL_ESI 4
+# define REG_LABEL_EDI 5
+# define REG_LABEL_MAX 6
+#else
+# define REG_LABEL_RBX 3
+# define REG_LABEL_R12 4
+# define REG_LABEL_R13 5
+# define REG_LABEL_R14 6
+# define REG_LABEL_R15 7
+# define REG_LABEL_MAX 8
+#endif
+
+typedef struct _label_t
+ {
+ long val[REG_LABEL_MAX];
+ } label_t;
+
+#endif /* __USE_MISC */
+
+typedef unsigned char lock_t;
+
+#endif /* _BITS_MACHTYPES_H */
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/x86/bits/regset.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/x86/bits/regset.h
new file mode 100644
index 0000000000..d8ab9029a3
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/x86/bits/regset.h
@@ -0,0 +1,139 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _BITS_REGSET_H
+#define _BITS_REGSET_H
+
+#include <features.h>
+
+typedef struct __fpu
+ {
+ union
+ {
+ struct __fpchip_state
+ {
+ __uint32_t __state[27];
+ __uint32_t __status;
+ __uint32_t __mxcsr;
+ __uint32_t __xstatus;
+ __uint32_t __pad[2];
+ __uint32_t __xmm[4][8];
+ } __fpchip_state;
+ struct __fp_emul_space
+ {
+ __uint8_t __fp_emul[246];
+ __uint8_t __fp_epad[2];
+ } __fp_emul_space;
+ __uint32_t __f_fpregs[95];
+ } __fp_reg_set;
+ } fpregset_t;
+
+#ifdef __amd64
+# define _NGREG 28
+#else
+# define _NGREG 19
+#endif
+#define NGREG _NGREG
+
+typedef int greg_t;
+
+#if defined (_SYSCALL32)
+typedef int32_t greg32_t;
+typedef int64_t greg64_t;
+#endif
+
+typedef greg_t gregset_t[_NGREG];
+
+typedef struct
+ {
+ gregset_t gregs;
+ fpregset_t fpregs;
+ } mcontext_t;
+
+#ifdef __USE_MISC
+
+struct fxsave_state
+ {
+ __uint16_t fx_fcw;
+ __uint16_t fx_fsw;
+ __uint16_t fx_fctw;
+ __uint16_t fx_fop;
+#ifdef __amd64__
+ __uint64_t fx_rip;
+ __uint64_t fx_rdp;
+#else
+ __uint32_t fx_eip;
+ __uint16_t fx_cs;
+ __uint16_t __fx_ign0;
+ __uint32_t fx_dp;
+ __uint16_t fx_ds;
+ __uint16_t __fx_ign1;
+#endif
+ __uint32_t fx_mxcsr;
+ __uint32_t fx_mxcsr_mask;
+ union
+ {
+ __uint16_t fpr_16[5];
+ unsigned long long fpr_mmx;
+ __uint32_t __fpr_pad[4];
+ } fx_st[8];
+#if defined(__amd64)
+ upad128_t fx_xmm[16]; /* 128-bit registers */
+ upad128_t __fx_ign2[6];
+#else
+ upad128_t fx_xmm[8]; /* 128-bit registers */
+ upad128_t __fx_ign2[14];
+#endif
+ };
+
+struct fnsave_state
+ {
+ __uint16_t f_fcw;
+ __uint16_t __f_ign0;
+ __uint16_t f_fsw;
+ __uint16_t __f_ign1;
+ __uint16_t f_ftw;
+ __uint16_t __f_ign2;
+ __uint32_t f_eip;
+ __uint16_t f_cs;
+ __uint16_t f_fop;
+ __uint32_t f_dp;
+ __uint16_t f_ds;
+ __uint16_t __f_ign3;
+ union
+ {
+ __uint16_t fpr_16[5];
+ } f_st[8];
+ };
+
+typedef struct
+ {
+ union _kfpu_u
+ {
+ struct fxsave_state kfpu_fx;
+#ifdef __i386__
+ struct fnsave_state kfpu_fn;
+#endif
+ } kfpu_u;
+ __uint32_t kfpu_status;
+ __uint32_t kfpu_xstatus;
+ } kfpu_t;
+
+#endif /* __USE_MISC */
+
+#endif /* _BITS_REGSET_H */
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/x86/door-offsets.sym b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/x86/door-offsets.sym
new file mode 100644
index 0000000000..325a4dd6f7
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/x86/door-offsets.sym
@@ -0,0 +1,6 @@
+#include <sysdep.h>
+#include <sys/door.h>
+
+oDOOR_RESULTS_PC offsetof (struct door_results, pc)
+oDOOR_RESULTS_NSERVERS offsetof (struct door_results, nservers)
+oDOOR_RESULTS_DOOR_INFO offsetof (struct door_results, door_info)
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/x86/sys/isa_defs.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/x86/sys/isa_defs.h
new file mode 100644
index 0000000000..6fc89e2c25
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/x86/sys/isa_defs.h
@@ -0,0 +1,73 @@
+/* Declarations of x86 (i386 and amd64) macros.
+ Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _SYS_ISA_DEFS_H
+#define _SYS_ISA_DEFS_H
+
+#define __x86
+
+#define _LITTLE_ENDIAN
+#define _STACK_GROWS_DOWNWARD
+#define _LONG_LONG_LTOH
+#define _BIT_FIELDS_LTOH
+#define _IEEE_754
+#define _CHAR_IS_SIGNED
+#define _BOOL_ALIGNMENT 1
+#define _CHAR_ALIGNMENT 1
+#define _SHORT_ALIGNMENT 2
+#define _INT_ALIGNMENT 4
+#define _FLOAT_ALIGNMENT 4
+#define _FLOAT_COMPLEX_ALIGNMENT 4
+
+#ifdef __amd64__
+# define _LONG_ALIGNMENT 8
+# define _LONG_LONG_ALIGNMENT 8
+# define _DOUBLE_ALIGNMENT 8
+# define _DOUBLE_COMPLEX_ALIGNMENT 8
+# define _LONG_DOUBLE_ALIGNMENT 16
+# define _LONG_DOUBLE_COMPLEX_ALIGNMENT 16
+# define _POINTER_ALIGNMENT 8
+# define _MAX_ALIGNMENT 16
+# define _ALIGNMENT_REQUIRED 1
+# define _LP64
+# define _MULTI_DATAMODEL
+# define __i386_COMPAT
+#else /* __i386__ */
+# define _LONG_ALIGNMENT 4
+# define _LONG_LONG_ALIGNMENT 4
+# define _DOUBLE_ALIGNMENT 4
+# define _DOUBLE_COMPLEX_ALIGNMENT 4
+# define _LONG_DOUBLE_ALIGNMENT 4
+# define _LONG_DOUBLE_COMPLEX_ALIGNMENT 4
+# define _POINTER_ALIGNMENT 4
+# define _MAX_ALIGNMENT 4
+# define _ALIGNMENT_REQUIRED 0
+# define _ILP32
+#endif /* __amd64__ */
+
+#define _LONG_LONG_ALIGNMENT_32 4
+#define _SUNOS_VTOC_16
+#define _DMA_USES_PHYSADDR
+#define _FIRMWARE_NEEDS_FDISK
+#define _PSM_MODULES
+#define _RTC_CONFIG
+#define _DONT_USE_1275_GENERIC_NAMES
+#define _HAVE_CPUID_INSN
+
+#endif /* _SYS_ISA_DEFS_H */
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/x86/sys/procfs_isa.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/x86/sys/procfs_isa.h
new file mode 100644
index 0000000000..1b038915e1
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/x86/sys/procfs_isa.h
@@ -0,0 +1,81 @@
+/* Declarations of x86 (i386 and amd64) procfs structs and macros.
+ Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _SYS_PROCFS_ISA_H
+#define _SYS_PROCFS_ISA_H
+
+#include <sys/regset.h>
+#include <sys/isa_defs.h>
+
+#define PR_MODEL_UNKNOWN 0
+#define PR_MODEL_ILP32 1
+#define PR_MODEL_LP64 2
+
+#ifdef _LP64
+# define PR_MODEL_NATIVE PR_MODEL_LP64
+#else
+# define PR_MODEL_NATIVE PR_MODEL_ILP32
+#endif
+
+typedef unsigned char instr_t;
+
+#define prgregset_t gregset_t
+#define prfpregset_t fpregset_t
+#define prgreg_t greg_t
+#define prfpregset fpu
+
+#define NPRGREG _NGREG
+
+#ifdef _SYSCALL32
+
+typedef unsigned char instr32_t;
+
+# if defined(__amd64)
+# define NPRGREG32 _NGREG32
+# define prgreg32_t greg32_t
+# define prgregset32_t gregset32_t
+# define prfpregset32 fpu32
+# define prfpregset32_t fpregset32_t
+# else
+# define NPRGREG32 _NGREG
+# define prgreg32_t greg_t
+# define prgregset32_t gregset_t
+# define prfpregset32 fpu
+# define prfpregset32_t fpregset_t
+# endif
+
+#endif /* _SYSCALL32 */
+
+#ifdef __amd64__
+# define R_PC REG_RIP
+# define R_PS REG_RFL
+# define R_SP REG_RSP
+# define R_FP REG_RBP
+# define R_R0 REG_RAX
+# define R_R1 REG_RDX
+#else
+# define R_PC EIP
+# define R_PS EFL
+# define R_SP UESP
+# define R_FP EBP
+# define R_R0 EAX
+# define R_R1 EDX
+#endif
+
+#endif /* _SYS_PROCFS_ISA_H */
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/x86/sys/regset.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/x86/sys/regset.h
new file mode 100644
index 0000000000..080ac02930
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/x86/sys/regset.h
@@ -0,0 +1,97 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _SYS_REGSET_H
+#define _SYS_REGSET_H 1
+
+#include <features.h>
+#include <bits/types.h>
+#include <bits/regset.h>
+
+#ifdef __USE_MISC
+
+# define REG_R15 0
+# define REG_R14 1
+# define REG_R13 2
+# define REG_R12 3
+# define REG_R11 4
+# define REG_R10 5
+# define REG_R9 6
+# define REG_R8 7
+# define REG_RDI 8
+# define REG_RSI 9
+# define REG_RBP 10
+# define REG_RBX 11
+# define REG_RDX 12
+# define REG_RCX 13
+# define REG_RAX 14
+# define REG_TRAPNO 15
+# define REG_ERR 16
+# define REG_RIP 17
+# define REG_CS 18
+# define REG_RFL 19
+# define REG_RSP 20
+# define REG_SS 21
+# define REG_FS 22
+# define REG_GS 23
+# define REG_ES 24
+# define REG_DS 25
+# define REG_FSBASE 26
+# define REG_GSBASE 27
+
+# define GS 0
+# define FS 1
+# define ES 2
+# define DS 3
+# define EDI 4
+# define ESI 5
+# define EBP 6
+# define ESP 7
+# define EBX 8
+# define EDX 9
+# define ECX 10
+# define EAX 11
+# define TRAPNO 12
+# ifndef ERR
+# define ERR 13
+# endif
+# define EIP 14
+# define CS 15
+# define EFL 16
+# define UESP 17
+# define SS 18
+
+# ifdef __amd64__
+# define REG_PC REG_RIP
+# define REG_FP REG_RBP
+# define REG_SP REG_RSP
+# define REG_PS REG_RFL
+# define REG_R0 REG_RAX
+# define REG_R1 REG_RDX
+# else /* __i386__ */
+# define REG_PC 14
+# define REG_FP 6
+# define REG_SP 17
+# define REG_PS 16
+# define REG_R0 11
+# define REG_R1 9
+# endif /* __amd64__ */
+
+#endif /* __USE_MISC */
+
+#endif /* _SYS_REGSET_H */
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/x86/sys/stack.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/x86/sys/stack.h
new file mode 100644
index 0000000000..1bc90b7301
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/x86/sys/stack.h
@@ -0,0 +1,27 @@
+/* Declarations of stack macros.
+ Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _STACK_STACK_H
+#define _STACK_STACK_H
+
+#define STACK_ALIGN 16
+#define STACK_BIAS 0
+#define SA(x) (((x) + (STACK_ALIGN - 1)) & ~(STACK_ALIGN - 1))
+
+#endif /* _STACK_STACK_H */
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/x86/syscalls.list b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/x86/syscalls.list
new file mode 100644
index 0000000000..5f1da8c23a
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/x86/syscalls.list
@@ -0,0 +1,3 @@
+# File name Caller Syscall name Args Strong name Weak names
+
+sysi86 - sysi86 i:ip sysi86
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/x86_64/Implies b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/x86_64/Implies
new file mode 100644
index 0000000000..772b20e20f
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/x86_64/Implies
@@ -0,0 +1 @@
+unix/sysv/solaris2/kopensolaris-gnu/x86
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/x86_64/Makefile b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/x86_64/Makefile
new file mode 100644
index 0000000000..f720e2b216
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/x86_64/Makefile
@@ -0,0 +1,3 @@
+ifeq ($(subdir),misc)
+sysdep_routines += sys_sysi86
+endif
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/x86_64/syscall.S b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/x86_64/syscall.S
new file mode 100644
index 0000000000..b08a194426
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/x86_64/syscall.S
@@ -0,0 +1,51 @@
+/* Copyright (C) 2006 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Modification for FreeBSD contributed by Petr Salinger, 2006.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sysdep.h>
+
+ .text;
+ENTRY (__syscall)
+ popl %rcx /* Pop return address into %rcx. */
+ popl %eax /* Pop syscall number into %eax. */
+ pushl %rcx /* Push back return adderss. */
+ syscall /* Do the system call. */
+ pushl %rcx /* Push back return address. */
+ jb SYSCALL_ERROR_LABEL; /* Jump to error handler if error. */
+
+L(pseudo_end):
+ ret /* Return to caller. */
+PSEUDO_END (__syscall)
+weak_alias (__syscall, syscall)
+
+ .text;
+ENTRY (__systemcall)
+ popl %rdx /* Pop return address into %edx. */
+ popl %rcx /* Pop sysret_t into %rcx. */
+ popl %eax /* Pop syscall number into %eax. */
+ pushl %rdx /* Push return address onto stack. */
+ syscall /* Do the system call. */
+ pushl %rcx /* Restore sysret_t on stack. */
+ movl 8(%rsp), %rdx /* Save return address into %rdx. */
+ pushl %rdx /* Restore return address on stack. */
+ jb 1f /* Jump to error handler if error. */
+ movl %rax, 0(%rcx) /* Set sysret_t. */
+ xorl %rax, %rax /* Set return to 0. */
+1:
+ ret
+PSEUDO_END (__syscall)
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/x86_64/vfork.S b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/x86_64/vfork.S
new file mode 100644
index 0000000000..f7c47b404a
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/x86_64/vfork.S
@@ -0,0 +1,56 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sysdep.h>
+
+ENTRY (__vfork)
+
+ /* Save the return address */
+ popl scratch; cfi_adjust_cfa_offset (-8);
+
+ /* Call vforkx(0) */
+ pushl $0
+ pushl $SYS_SUB_vforkx
+ pushl scratch
+ cfi_adjust_cfa_offset (24);
+ DO_CALL (forksys, 1)
+ jb 2f
+ addl $24, %rsp; cfi_adjust_cfa_offset (-24);
+
+ /* In the parent process, %rdx == 0, %rax == child pid.
+ In the child process, %rdx == 1, %rax == parent pid. */
+ decl %rdx
+ andl %rdx, %rax
+
+ /* Jump to the old return address */
+ jmp *scratch
+
+2:
+ /* Restore the return address and jump to the syscall error label */
+ addl $24, %rsp; cfi_adjust_cfa_offset (-24);
+ pushl scratch; cfi_adjust_cfa_offset (8);
+ jmp SYSCALL_ERROR_LABEL
+
+L(pseudo_end):
+ ret
+
+PSEUDO_END (__vfork)
+
+libc_hidden_def (__vfork)
+weak_alias (__vfork, vfork)
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/xmknod.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/xmknod.c
new file mode 100644
index 0000000000..8fc57253e3
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/xmknod.c
@@ -0,0 +1,49 @@
+/* xmknod call using old-style Unix mknod system call.
+ Copyright (C) 1991, 1993, 1995, 1996, 1997, 1998, 2000, 2002, 2003
+ Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/sysmacros.h>
+#include <inline-syscall.h>
+
+#include <sysdep.h>
+#include <syscallP.h>
+#include <bp-checks.h>
+
+DECLARE_INLINE_SYSCALL (int, mknod, const char *, mode_t, dev_t);
+
+/* Create a device file named PATH, with permission and special bits MODE
+ and device number DEV (which can be constructed from major and minor
+ device numbers with the `makedev' macro above). */
+int
+__xmknod (int vers, const char *path, mode_t mode, dev_t *dev)
+{
+ if (vers != _MKNOD_VER)
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ return INLINE_SYSCALL (mknod, 3, CHECK_STRING (path), mode, *dev);
+}
+
+weak_alias (__xmknod, _xmknod)
+libc_hidden_def (__xmknod)
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/xstat.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/xstat.c
new file mode 100644
index 0000000000..f83cde9065
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/xstat.c
@@ -0,0 +1,39 @@
+/* Copyright (C) 1991, 1995, 1996, 1997, 2002, 2008
+ Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <inline-syscall.h>
+#include <errno.h>
+#include <sys/stat.h>
+#include <bp-checks.h>
+
+DECLARE_INLINE_SYSCALL (int, stat, const char *path, struct stat *buf);
+
+int
+__xstat (int vers, const char *file, struct stat *buf)
+{
+ if(vers != _STAT_VER)
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ return INLINE_SYSCALL (stat, 2, file, CHECK_1 (buf));
+}
+
+hidden_def (__xstat)
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/xstat64.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/xstat64.c
new file mode 100644
index 0000000000..a818957dc4
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/xstat64.c
@@ -0,0 +1,39 @@
+/* Copyright (C) 1991, 1995, 1996, 1997, 2002, 2008
+ Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <inline-syscall.h>
+#include <errno.h>
+#include <sys/stat.h>
+#include <bp-checks.h>
+
+DECLARE_INLINE_SYSCALL (int, stat64, const char *path, struct stat64 *buf);
+
+int
+__xstat64 (int vers, const char *file, struct stat64 *buf)
+{
+ if(vers != _STAT_VER)
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ return INLINE_SYSCALL (stat64, 2, file, CHECK_1 (buf));
+}
+
+hidden_def (__xstat64)
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/zone.c b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/zone.c
new file mode 100644
index 0000000000..a62c63be0a
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/zone.c
@@ -0,0 +1,101 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <inline-syscall.h>
+#include <zone.h>
+#include <privP.h>
+#include <dlfcn.h>
+#include <streams/stropts.h>
+#include <sys/ptms.h>
+
+static int (*_zone_get_id) (const char *, zoneid_t *);
+
+DECLARE_INLINE_SYSCALL (zoneid_t, zone_create, zone_def *def);
+DECLARE_INLINE_SYSCALL (zoneid_t, zone_lookup, const char *name);
+
+
+
+zoneid_t getzoneid (void)
+{
+ return INLINE_SYSCALL (zone_lookup, 1, NULL);
+}
+
+
+zoneid_t getzoneidbyname (const char *name)
+{
+ return INLINE_SYSCALL (zone_lookup, 1, name);
+}
+
+
+ssize_t getzonenamebyid (zoneid_t id, char *buf, size_t buflen)
+{
+ return zone_getattr (id, ZONE_ATTR_NAME, buf, buflen);
+}
+
+
+zoneid_t zone_create (const char *name, const char *root,
+ const struct priv_set *privs, const char *rctlbuf, size_t rctlbufsz,
+ const char *zfsbuf, size_t zfsbufsz, int *extended_error, int match,
+ int doi, const bslabel_t *label, int flags)
+{
+ zone_def def;
+ def.zone_name = name;
+ def.zone_root = root;
+ def.zone_privs = privs;
+ def.zone_privssz = __PRIVSETSIZE;
+ def.rctlbuf = rctlbuf;
+ def.rctlbufsz = rctlbufsz;
+ def.extended_error = extended_error;
+ def.zfsbuf = zfsbuf;
+ def.zfsbufsz = zfsbufsz;
+ def.match = match;
+ def.doi = doi;
+ def.label = label;
+ def.flags = flags;
+
+ return INLINE_SYSCALL (zone_create, 1, &def);
+}
+
+
+int zone_get_id (const char *str, zoneid_t *idp)
+{
+ /* libzonecfg.so.1 has the real function. */
+ void *lzc = __libc_dlopen ("libzonecfg.so.1");
+ if (lzc)
+ {
+ _zone_get_id = __libc_dlsym (lzc, "zone_get_id");
+ if (_zone_get_id)
+ return _zone_get_id (str, idp);
+ }
+
+ return ENOSYS;
+}
+
+
+int zonept (int fd, zoneid_t zoneid)
+{
+ /* Send ZONEPT down. */
+ struct strioctl si;
+ si.ic_cmd = ZONEPT;
+ si.ic_timout = 0;
+ si.ic_len = sizeof (zoneid_t);
+ si.ic_dp = (char *)&zoneid;
+
+ return (ioctl (fd, I_STR, &si) < 0) ? -1 : 0;
+}
diff --git a/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/zone.h b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/zone.h
new file mode 100644
index 0000000000..4747b05ee9
--- /dev/null
+++ b/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/zone.h
@@ -0,0 +1,56 @@
+/* Declarations of zone functions and types.
+ Copyright (C) 2008 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _ZONE_H
+#define _ZONE_H
+
+#include <features.h>
+#include <sys/types.h>
+#include <sys/zone.h>
+#include <sys/tsol/label.h>
+
+__BEGIN_DECLS
+
+/* Public interfaces. */
+extern zoneid_t getzoneid (void);
+extern zoneid_t getzoneidbyname (const char *);
+extern ssize_t getzonenamebyid (zoneid_t, char *, size_t);
+
+/* Private interfaces. */
+extern int zonept (int, zoneid_t);
+extern int zone_get_id (const char *, zoneid_t *);
+extern zoneid_t zone_create (const char *, const char *,
+ const struct priv_set *, const char *, size_t, const char *, size_t, int *,
+ int, int, const bslabel_t *, int);
+extern int zone_boot (zoneid_t);
+extern int zone_destroy (zoneid_t);
+extern ssize_t zone_getattr (zoneid_t, int, void *, size_t);
+extern int zone_setattr (zoneid_t, int, void *, size_t);
+extern int zone_enter (zoneid_t);
+extern int zone_list (zoneid_t *, uint_t *);
+extern int zone_shutdown (zoneid_t);
+extern int zone_version (int *);
+extern int zone_add_datalink (zoneid_t, char *);
+extern int zone_remove_datalink (zoneid_t, char *);
+extern int zone_check_datalink (zoneid_t *, char *);
+extern int zone_list_datalink (zoneid_t, int *, char *);
+
+__END_DECLS
+
+#endif /* _ZONE_H */