From Rainer Orth.
From-SVN: r172935
go/sync/waitgroup.go
if LIBGO_IS_SOLARIS
-go_syslog_file = go/syslog/syslog_solaris.go
+go_syslog_file = go/syslog/syslog_libc.go
+else
+if LIBGO_IS_IRIX
+go_syslog_file = go/syslog/syslog_libc.go
else
go_syslog_file = go/syslog/syslog_unix.go
endif
+endif
go_syslog_files = \
go/syslog/syslog.go \
if LIBGO_IS_SOLARIS
syscall_socket_os_file = syscalls/socket_solaris.go
else
+if LIBGO_IS_IRIX
+syscall_socket_os_file = syscalls/socket_irix.go
+else
syscall_socket_os_file = syscalls/socket_bsd.go
endif
endif
+endif
# Support for epoll.
if LIBGO_IS_LINUX
go/sync/rwmutex.go \
go/sync/waitgroup.go
-@LIBGO_IS_SOLARIS_FALSE@go_syslog_file = go/syslog/syslog_unix.go
-@LIBGO_IS_SOLARIS_TRUE@go_syslog_file = go/syslog/syslog_solaris.go
+@LIBGO_IS_IRIX_FALSE@@LIBGO_IS_SOLARIS_FALSE@go_syslog_file = go/syslog/syslog_unix.go
+@LIBGO_IS_IRIX_TRUE@@LIBGO_IS_SOLARIS_FALSE@go_syslog_file = go/syslog/syslog_libc.go
+@LIBGO_IS_SOLARIS_TRUE@go_syslog_file = go/syslog/syslog_libc.go
go_syslog_files = \
go/syslog/syslog.go \
$(go_syslog_file)
# Declare libc_strerror_r which is the Go name for strerror_r.
# RTEMS uses newlib in which strerror_r returns char *.
@LIBGO_IS_RTEMS_TRUE@syscall_errstr_decl_file = syscalls/errstr_decl_rtems.go
-@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_SOLARIS_FALSE@syscall_socket_os_file = syscalls/socket_bsd.go
+@LIBGO_IS_IRIX_FALSE@@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_SOLARIS_FALSE@syscall_socket_os_file = syscalls/socket_bsd.go
+@LIBGO_IS_IRIX_TRUE@@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_SOLARIS_FALSE@syscall_socket_os_file = syscalls/socket_irix.go
@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_SOLARIS_TRUE@syscall_socket_os_file = syscalls/socket_solaris.go
# Define socket sizes and types.
is_alpha=no
is_arm=no
is_m68k=no
-mips_abi=""
+mips_abi=unknown
is_ppc=no
is_ppc64=no
is_sparc=no
LIBGO_IS_M68K_FALSE=
fi
- if test $mips_abi != ""; then
+ if test $mips_abi != unknown; then
LIBGO_IS_MIPS_TRUE=
LIBGO_IS_MIPS_FALSE='#'
else
case "$target" in
+ mips-sgi-irix6.5*)
+ # IRIX 6 needs _XOPEN_SOURCE=500 for the XPG5 version of struct
+ # msghdr in <sys/socket.h>.
+ OSCFLAGS='-D_XOPEN_SOURCE=500'
+ ;;
*-*-solaris2.[89])
# Solaris 8/9 need this so struct msghdr gets the msg_control
# etc. fields in <sys/socket.h> (_XPG4_2).
is_alpha=no
is_arm=no
is_m68k=no
-mips_abi=""
+mips_abi=unknown
is_ppc=no
is_ppc64=no
is_sparc=no
AM_CONDITIONAL(LIBGO_IS_ALPHA, test $is_alpha = yes)
AM_CONDITIONAL(LIBGO_IS_ARM, test $is_arm = yes)
AM_CONDITIONAL(LIBGO_IS_M68K, test $is_m68k = yes)
-AM_CONDITIONAL(LIBGO_IS_MIPS, test $mips_abi != "")
+AM_CONDITIONAL(LIBGO_IS_MIPS, test $mips_abi != unknown)
AM_CONDITIONAL(LIBGO_IS_MIPSO32, test $mips_abi = o32)
AM_CONDITIONAL(LIBGO_IS_MIPSN32, test $mips_abi = n32)
AM_CONDITIONAL(LIBGO_IS_MIPSN64, test $mips_abi = n64)
dnl Some targets need special flags to build sysinfo.go.
case "$target" in
+ mips-sgi-irix6.5*)
+ # IRIX 6 needs _XOPEN_SOURCE=500 for the XPG5 version of struct
+ # msghdr in <sys/socket.h>.
+ OSCFLAGS='-D_XOPEN_SOURCE=500'
+ ;;
*-*-solaris2.[[89]])
# Solaris 8/9 need this so struct msghdr gets the msg_control
# etc. fields in <sys/socket.h> (_XPG4_2).
--- /dev/null
+// Copyright 2011 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// gccgo specific implementation of syslog for Solaris. Solaris uses
+// STREAMS to communicate with syslogd. That is enough of a pain that
+// we just call the libc function.
+
+package syslog
+
+import (
+ "fmt"
+ "os"
+ "syscall"
+)
+
+func unixSyslog() (conn serverConn, err os.Error) {
+ return libcConn(0), nil
+}
+
+type libcConn int
+
+func syslog_c(int, *byte)
+
+func (libcConn) writeBytes(p Priority, prefix string, b []byte) (int, os.Error) {
+ syslog_c(int(p), syscall.StringBytePtr(fmt.Sprintf("%s: %s", prefix, b)))
+ return len(b), nil
+}
+
+func (libcConn) writeString(p Priority, prefix string, s string) (int, os.Error) {
+ syslog_c(int(p), syscall.StringBytePtr(fmt.Sprintf("%s: %s", prefix, s)))
+ return len(s), nil
+}
+
+func (libcConn) close() os.Error {
+ return nil
+}
+++ /dev/null
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// gccgo specific implementation of syslog for Solaris. Solaris uses
-// STREAMS to communicate with syslogd. That is enough of a pain that
-// we just call the libc function.
-
-package syslog
-
-import (
- "fmt"
- "os"
- "syscall"
-)
-
-func unixSyslog() (conn serverConn, err os.Error) {
- return libcConn(0), nil
-}
-
-type libcConn int
-
-func syslog_c(int, *byte)
-
-func (libcConn) writeBytes(p Priority, prefix string, b []byte) (int, os.Error) {
- syslog_c(int(p), syscall.StringBytePtr(fmt.Sprintf("%s: %s", prefix, b)))
- return len(b), nil
-}
-
-func (libcConn) writeString(p Priority, prefix string, s string) (int, os.Error) {
- syslog_c(int(p), syscall.StringBytePtr(fmt.Sprintf("%s: %s", prefix, s)))
- return len(s), nil
-}
-
-func (libcConn) close() os.Error {
- return nil
-}
#define _LARGEFILE_SOURCE
#define _FILE_OFFSET_BITS 64
-#ifdef __sgi__
-/* IRIX 6 needs _XOPEN_SOURCE=500 for the XPG5 version of struct msghdr in
- <sys/socket.h>. */
-#define _XOPEN_SOURCE 500
-#endif
-
#include <sys/types.h>
#include <dirent.h>
#include <errno.h>
grep -v '^// ' gen-sysinfo.go | \
grep -v '^func' | \
grep -v '^type _timeval ' | \
- grep -v '^type _timespec\(_t\)\? ' | \
+ grep -v '^type _timespec_t ' | \
+ grep -v '^type _timespec ' | \
grep -v '^type _timestruc_t ' | \
grep -v '^type _epoll_' | \
grep -v 'in6_addr' | \
grep -v 'sockaddr_in6' | \
sed -e 's/\([^a-zA-Z0-9_]\)_timeval\([^a-zA-Z0-9_]\)/\1Timeval\2/g' \
- -e 's/\([^a-zA-Z0-9_]\)_timespec\(_t\)\?\([^a-zA-Z0-9_]\)/\1Timespec\3/g' \
+ -e 's/\([^a-zA-Z0-9_]\)_timespec_t\([^a-zA-Z0-9_]\)/\1Timespec\2/g' \
+ -e 's/\([^a-zA-Z0-9_]\)_timespec\([^a-zA-Z0-9_]\)/\1Timespec\2/g' \
-e 's/\([^a-zA-Z0-9_]\)_timestruc_t\([^a-zA-Z0-9_]\)/\1Timestruc\2/g' \
>> ${OUT}
echo "type Timespec_sec_t $timespec_sec" >> ${OUT}
echo "type Timespec_nsec_t $timespec_nsec" >> ${OUT}
echo $timespec | \
- sed -e 's/^type \(__\)\?_timespec /type Timespec /' \
+ sed -e 's/^type ___timespec /type Timespec /' \
+ -e 's/^type _timespec /type Timespec /' \
-e 's/tv_sec *[a-zA-Z0-9_]*/Sec Timespec_sec_t/' \
-e 's/tv_nsec *[a-zA-Z0-9_]*/Nsec Timespec_nsec_t/' >> ${OUT}
-e 's/st_mtim/Mtime/' \
-e 's/st_ctim/Ctime/' \
-e 's/\([^a-zA-Z0-9_]\)_timeval\([^a-zA-Z0-9_]\)/\1Timeval\2/g' \
- -e 's/\([^a-zA-Z0-9_]\)_timespec\(_t\)\?\([^a-zA-Z0-9_]\)/\1Timespec\3/g' \
+ -e 's/\([^a-zA-Z0-9_]\)_timespec_t\([^a-zA-Z0-9_]\)/\1Timespec\2/g' \
+ -e 's/\([^a-zA-Z0-9_]\)_timespec\([^a-zA-Z0-9_]\)/\1Timespec\2/g' \
-e 's/\([^a-zA-Z0-9_]\)_timestruc_t\([^a-zA-Z0-9_]\)/\1Timestruc\2/g' \
>> ${OUT}
--- /dev/null
+// socket_irix.go -- Socket handling specific to IRIX 6.
+
+// Copyright 2011 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package syscall
+
+const SizeofSockaddrInet4 = 16
+const SizeofSockaddrInet6 = 28
+const SizeofSockaddrUnix = 110
+
+type RawSockaddrInet4 struct {
+ Family uint16
+ Port uint16
+ Addr [4]byte /* in_addr */
+ Zero [8]uint8
+}
+
+func (sa *RawSockaddrInet4) setLen() Socklen_t {
+ return SizeofSockaddrInet4
+}
+
+type RawSockaddrInet6 struct {
+ Family uint16
+ Port uint16
+ Flowinfo uint32
+ Addr [16]byte /* in6_addr */
+ Scope_id uint32
+}
+
+func (sa *RawSockaddrInet6) setLen() Socklen_t {
+ return SizeofSockaddrInet6
+}
+
+type RawSockaddrUnix struct {
+ Family uint16
+ Path [108]int8
+}
+
+func (sa *RawSockaddrUnix) setLen(int) {
+}
+
+func (sa *RawSockaddrUnix) getLen() (int, int) {
+ if sa.Path[0] == 0 {
+ // "Abstract" Unix domain socket.
+ // Rewrite leading NUL as @ for textual display.
+ // (This is the standard convention.)
+ // Not friendly to overwrite in place,
+ // but the callers below don't care.
+ sa.Path[0] = '@'
+ }
+
+ // Assume path ends at NUL.
+ // This is not technically the Linux semantics for
+ // abstract Unix domain sockets--they are supposed
+ // to be uninterpreted fixed-size binary blobs--but
+ // everyone uses this convention.
+ n := 0
+ for n < len(sa.Path)-3 && sa.Path[n] != 0 {
+ n++
+ }
+
+ return n, 0
+}
+
+type RawSockaddr struct {
+ Family uint16
+ Data [14]int8
+}
+
+// BindToDevice binds the socket associated with fd to device.
+func BindToDevice(fd int, device string) (errno int) {
+ return ENOSYS
+}
+
+// struct ip_mreg is provived in <netinet/in.h>, but protected with _SGIAPI.
+// This could be enabled with -D_SGI_SOURCE, but conflicts with
+// -D_XOPEN_SOURCE=500 required for msg_control etc. in struct msghgr, so
+// simply provide it here.
+type IpMreq struct {
+ Multiaddr [4]byte
+ Interface [4]byte
+}