blob: 3059b9ad69d642a598190298065aabc7af425f0a [file] [log] [blame]
Christopher Nielsen5425db82011-12-20 03:57:58 +11001// Copyright 2009 The Go Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style
3// license that can be found in the LICENSE file.
4
5package syscall
6
Ian Lance Taylor6c517df2016-10-11 21:04:16 -07007func setTimespec(sec, nsec int64) Timespec {
8 return Timespec{Sec: sec, Nsec: int32(nsec)}
Christopher Nielsen5425db82011-12-20 03:57:58 +11009}
10
Ian Lance Taylor6c517df2016-10-11 21:04:16 -070011func setTimeval(sec, usec int64) Timeval {
12 return Timeval{Sec: sec, Usec: int32(usec)}
Christopher Nielsen5425db82011-12-20 03:57:58 +110013}
14
15func SetKevent(k *Kevent_t, fd, mode, flags int) {
16 k.Ident = uint32(fd)
Joel Singb554fb92012-05-15 12:00:13 +100017 k.Filter = uint32(mode)
18 k.Flags = uint32(flags)
Christopher Nielsen5425db82011-12-20 03:57:58 +110019}
20
21func (iov *Iovec) SetLen(length int) {
22 iov.Len = uint32(length)
23}
24
25func (msghdr *Msghdr) SetControllen(length int) {
26 msghdr.Controllen = uint32(length)
27}
28
29func (cmsg *Cmsghdr) SetLen(length int) {
30 cmsg.Len = uint32(length)
31}