7a9389330e
gcc/: * gcc.c (default_compilers): Add entry for ".go". * common.opt: Add -static-libgo as a driver option. * doc/install.texi (Configuration): Mention libgo as an option for --enable-shared. Mention go as an option for --enable-languages. * doc/invoke.texi (Overall Options): Mention .go as a file name suffix. Mention go as a -x option. * doc/frontends.texi (G++ and GCC): Mention Go as a supported language. * doc/sourcebuild.texi (Top Level): Mention libgo. * doc/standards.texi (Standards): Add section on Go language. Move references for other languages into their own section. * doc/contrib.texi (Contributors): Mention that I contributed the Go frontend. gcc/testsuite/: * lib/go.exp: New file. * lib/go-dg.exp: New file. * lib/go-torture.exp: New file. * lib/target-supports.exp (check_compile): Match // Go. From-SVN: r167407
51 lines
1.3 KiB
Go
51 lines
1.3 KiB
Go
// socket_epoll.go -- GNU/Linux epoll handling.
|
|
|
|
// Copyright 2009 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.
|
|
|
|
// Support for GNU/Linux epoll.
|
|
// Only for implementing net package.
|
|
// DO NOT USE DIRECTLY.
|
|
|
|
package syscall
|
|
|
|
// We don't take this type directly from the header file because it
|
|
// uses a union. FIXME.
|
|
|
|
type EpollEvent struct {
|
|
Events uint32;
|
|
Fd int32;
|
|
Pad int32;
|
|
};
|
|
|
|
func libc_epoll_create(size int) int __asm__ ("epoll_create");
|
|
func libc_epoll_ctl(epfd, op, fd int, event *EpollEvent) int __asm__ ("epoll_ctl");
|
|
func libc_epoll_wait(epfd int, events *EpollEvent, maxevents int,
|
|
timeout int) int __asm__ ("epoll_wait");
|
|
|
|
|
|
func EpollCreate(size int) (fd int, errno int) {
|
|
fd = libc_epoll_create(int(size));
|
|
if fd < 0 { errno = GetErrno() }
|
|
return;
|
|
}
|
|
|
|
func EpollCtl(epfd, op, fd int, ev *EpollEvent) (errno int) {
|
|
r := libc_epoll_ctl(epfd, op, fd, ev);
|
|
if r < 0 { errno = GetErrno() }
|
|
return;
|
|
}
|
|
|
|
func EpollWait(epfd int, ev []EpollEvent, msec int) (n int, errno int) {
|
|
var events *EpollEvent;
|
|
var maxevents int;
|
|
if len(ev) > 0 {
|
|
maxevents = len(ev);
|
|
events = &ev[0]
|
|
}
|
|
n = libc_epoll_wait(epfd, events, maxevents, msec);
|
|
if n < 0 { errno = GetErrno() }
|
|
return;
|
|
}
|