Re: go for linux - incompatiblities? (or: three hacks to support older linux versions)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Steffen Dettmer <steffen.dettmer@xxxxxxxxxxxxxx> writes:

> 1) SYS_TGKILL
>
> hacked in gcc-4.6.0/libgo/syscalls/syscall_linux.go:
>
>    // used by libgo/go/debug/proc/proc_linux.go
>    func Tgkill(tgid int, tid int, sig int) (errno int) {
>            return -1234;
>    }
>
>
> Is the function syscall.Tgkill essential or could something work
> without it? The directory of the only using function is in
> debug, so maybe I can live without it?

syscall.Tgkill is not very important.  I guess we should arrange to call
syscall.Tkill if it is not available.  But tgkill was supposedly added
in version 2.5.75, so it should be available on your version 2.6.18.
What version of glibc are you using?


> 2) problem with type Stat_t
>
> my "man 2 stat" tells:
>
>    struct stat {
>       .....
>       time_t        st_atime;    /* time of last access */
>       time_t        st_mtime;    /* time of last modification */
>       time_t        st_ctime;    /* time of last change */
>    };
>
> with "gcc-4.6.0/libgo/mksysinfo.sh" doing:
>
>     314 # The stat type.
>     315 # Prefer largefile variant if available.
>     316 stat=`grep '^type _stat64 ' gen-sysinfo.go || true`
>     ...
>     332          -e 's/st_atim/Atime/' \
>     333          -e 's/st_mtim/Mtime/' \
>     334          -e 's/st_ctim/Ctime/' \
>
> resulting in "i686-pc-linux-gnu/libgo/sysinfo.go"
>
>    // orignally one single line:
>    type Stat_t struct { Dev uint64; __pad1 uint32; __Ino uint32;
>       Mode uint32; Nlink uint32; Uid uint32; Gid uint32; Rdev uint64;
>       __pad2 uint32; Size int64; Blksize int32; Blocks int64;
>       Atimee int32; __unused1 uint32;
>       Mtimee int32; __unused2 uint32;
>       Ctimee int32; __unused3 uint32;
>       Ino uint64; }
>
> so I hacked in libgo/go/os/stat.go:
>
>      15 func fileInfoFromStat(
>         name string, fi *FileInfo, lstat, stat *syscall.Stat_t) *FileInfo {
>    ...
>      26         // i686-pc-linux-gnu/libgo/sysinfo.go
>      27         fi.Atime_ns = int64(stat.Atimee)*1e9 // stat.__unused1
>      28         fi.Mtime_ns = int64(stat.Mtimee)*1e9 // stat.__unused2
>      29         fi.Ctime_ns = int64(stat.Ctimee)*1e9 // stat.__unused3
>
> I think this would work well for me, right?

Yes, that should be fine.


> 3) epoll
>
> manually added (to continue testing) in "i686-pc-linux-gnu/libgo/sysinfo.go"
>
>    // from /usr/include/sys/epoll.h
>    const EPOLLIN = 0x001
>    const EPOLLOUT = 0x004
>    const EPOLLONESHOT = (1 << 30)
>    const EPOLL_CTL_MOD = 3
>    const EPOLL_CTL_ADD = 1
>    const EPOLL_CTL_DEL = 2
>
> no idea why they are missing.

This must have also have to do with your glibc version.

> Should I try to adjust "gcc-4.6.0/libgo/mksysinfo.sh",
> maybe trying to create some patch,
> or won't this make sense, because useless anyway?

Yes, adjusting mksysinfo.sh sounds like the way to fix these issues.

Ian


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux