| // 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. |
| |
| /* |
| Input to godefs. See also mkerrors.sh and mkall.sh |
| */ |
| |
| #define _LARGEFILE_SOURCE |
| #define _LARGEFILE64_SOURCE |
| #define _FILE_OFFSET_BITS 64 |
| #define _GNU_SOURCE |
| |
| #include <dirent.h> |
| #include <fcntl.h> |
| #include <netinet/in.h> |
| #include <netinet/tcp.h> |
| #include <netpacket/packet.h> |
| #include <signal.h> |
| #include <stdio.h> |
| #include <sys/epoll.h> |
| #include <sys/inotify.h> |
| #include <sys/mman.h> |
| #include <sys/mount.h> |
| #include <sys/param.h> |
| #include <sys/ptrace.h> |
| #include <sys/resource.h> |
| #include <sys/select.h> |
| #include <sys/signal.h> |
| #include <sys/stat.h> |
| #include <sys/statfs.h> |
| #include <sys/sysinfo.h> |
| #include <sys/time.h> |
| #include <sys/times.h> |
| #include <sys/timex.h> |
| #include <sys/types.h> |
| #include <sys/un.h> |
| #include <sys/user.h> |
| #include <sys/utsname.h> |
| #include <sys/wait.h> |
| #include <time.h> |
| #include <unistd.h> |
| #include <ustat.h> |
| #include <utime.h> |
| |
| // Machine characteristics; for internal use. |
| |
| enum |
| { |
| $sizeofPtr = sizeof(void*), |
| $sizeofShort = sizeof(short), |
| $sizeofInt = sizeof(int), |
| $sizeofLong = sizeof(long), |
| $sizeofLongLong = sizeof(long long), |
| $PathMax = PATH_MAX, |
| }; |
| |
| // Basic types |
| |
| typedef short $_C_short; |
| typedef int $_C_int; |
| typedef long $_C_long; |
| typedef long long $_C_long_long; |
| |
| // Time |
| |
| typedef struct timespec $Timespec; |
| typedef struct timeval $Timeval; |
| typedef struct timex $Timex; |
| typedef time_t $Time_t; |
| typedef struct tms $Tms; |
| typedef struct utimbuf $Utimbuf; |
| |
| // Processes |
| |
| typedef struct rusage $Rusage; |
| typedef struct rlimit $Rlimit; |
| |
| typedef gid_t $_Gid_t; |
| |
| // Files |
| |
| typedef struct stat $Stat_t; |
| typedef struct statfs $Statfs_t; |
| |
| typedef struct dirent $Dirent; |
| |
| // Sockets |
| |
| union sockaddr_all { |
| struct sockaddr s1; // this one gets used for fields |
| struct sockaddr_in s2; // these pad it out |
| struct sockaddr_in6 s3; |
| struct sockaddr_un s4; |
| struct sockaddr_ll s5; |
| }; |
| |
| struct sockaddr_any { |
| struct sockaddr addr; |
| char pad[sizeof(union sockaddr_all) - sizeof(struct sockaddr)]; |
| }; |
| |
| typedef struct sockaddr_in $RawSockaddrInet4; |
| typedef struct sockaddr_in6 $RawSockaddrInet6; |
| typedef struct sockaddr_un $RawSockaddrUnix; |
| typedef struct sockaddr_ll $RawSockaddrLinklayer; |
| typedef struct sockaddr $RawSockaddr; |
| typedef struct sockaddr_any $RawSockaddrAny; |
| typedef socklen_t $_Socklen; |
| typedef struct linger $Linger; |
| typedef struct iovec $Iovec; |
| typedef struct msghdr $Msghdr; |
| typedef struct cmsghdr $Cmsghdr; |
| typedef struct ucred $Ucred; |
| |
| enum { |
| $SizeofSockaddrInet4 = sizeof(struct sockaddr_in), |
| $SizeofSockaddrInet6 = sizeof(struct sockaddr_in6), |
| $SizeofSockaddrAny = sizeof(struct sockaddr_any), |
| $SizeofSockaddrUnix = sizeof(struct sockaddr_un), |
| $SizeofSockaddrLinklayer = sizeof(struct sockaddr_ll), |
| $SizeofLinger = sizeof(struct linger), |
| $SizeofMsghdr = sizeof(struct msghdr), |
| $SizeofCmsghdr = sizeof(struct cmsghdr), |
| $SizeofUcred = sizeof(struct ucred), |
| }; |
| |
| |
| // Inotify |
| typedef struct inotify_event $InotifyEvent; |
| |
| enum { |
| $SizeofInotifyEvent = sizeof(struct inotify_event) |
| }; |
| |
| |
| // Ptrace |
| |
| // Register structures |
| typedef struct user_regs_struct $PtraceRegs; |
| |
| // Misc |
| |
| typedef fd_set $FdSet; |
| typedef struct sysinfo $Sysinfo_t; |
| typedef struct utsname $Utsname; |
| typedef struct ustat $Ustat_t; |
| |
| // The real epoll_event is a union, and godefs doesn't handle it well. |
| struct my_epoll_event { |
| uint32_t events; |
| int32_t fd; |
| int32_t pad; |
| }; |
| |
| typedef struct my_epoll_event $EpollEvent; |