vendor/golang.org/x/sys/unix/syscall_aix_ppc64.go
changeset 251 1c52a0eeb952
parent 242 2a9ec03fe5a1
child 256 6d9efbef00a9
equal deleted inserted replaced
250:c040f992052f 251:1c52a0eeb952
    27 
    27 
    28 func (msghdr *Msghdr) SetControllen(length int) {
    28 func (msghdr *Msghdr) SetControllen(length int) {
    29 	msghdr.Controllen = uint32(length)
    29 	msghdr.Controllen = uint32(length)
    30 }
    30 }
    31 
    31 
       
    32 func (msghdr *Msghdr) SetIovlen(length int) {
       
    33 	msghdr.Iovlen = int32(length)
       
    34 }
       
    35 
    32 func (cmsg *Cmsghdr) SetLen(length int) {
    36 func (cmsg *Cmsghdr) SetLen(length int) {
    33 	cmsg.Len = uint32(length)
    37 	cmsg.Len = uint32(length)
    34 }
    38 }
       
    39 
       
    40 // In order to only have Timespec structure, type of Stat_t's fields
       
    41 // Atim, Mtim and Ctim is changed from StTimespec to Timespec during
       
    42 // ztypes generation.
       
    43 // On ppc64, Timespec.Nsec is an int64 while StTimespec.Nsec is an
       
    44 // int32, so the fields' value must be modified.
       
    45 func fixStatTimFields(stat *Stat_t) {
       
    46 	stat.Atim.Nsec >>= 32
       
    47 	stat.Mtim.Nsec >>= 32
       
    48 	stat.Ctim.Nsec >>= 32
       
    49 }
       
    50 
       
    51 func Fstat(fd int, stat *Stat_t) error {
       
    52 	err := fstat(fd, stat)
       
    53 	if err != nil {
       
    54 		return err
       
    55 	}
       
    56 	fixStatTimFields(stat)
       
    57 	return nil
       
    58 }
       
    59 
       
    60 func Fstatat(dirfd int, path string, stat *Stat_t, flags int) error {
       
    61 	err := fstatat(dirfd, path, stat, flags)
       
    62 	if err != nil {
       
    63 		return err
       
    64 	}
       
    65 	fixStatTimFields(stat)
       
    66 	return nil
       
    67 }
       
    68 
       
    69 func Lstat(path string, stat *Stat_t) error {
       
    70 	err := lstat(path, stat)
       
    71 	if err != nil {
       
    72 		return err
       
    73 	}
       
    74 	fixStatTimFields(stat)
       
    75 	return nil
       
    76 }
       
    77 
       
    78 func Stat(path string, statptr *Stat_t) error {
       
    79 	err := stat(path, statptr)
       
    80 	if err != nil {
       
    81 		return err
       
    82 	}
       
    83 	fixStatTimFields(statptr)
       
    84 	return nil
       
    85 }