トップ «前の日記(2018-01-17) 最新 次の日記(2018-01-19)» 編集

ヨタの日々

2001|08|09|10|11|12|
2002|01|02|03|04|05|06|07|08|09|10|11|12|
2003|01|02|03|04|05|06|07|08|09|10|11|12|
2004|01|02|03|04|05|06|07|08|09|10|11|12|
2005|01|02|03|04|05|06|07|08|09|10|11|12|
2006|01|02|03|04|05|06|07|08|09|10|11|12|
2007|01|02|03|04|05|06|07|08|09|10|11|12|
2008|01|02|03|04|05|06|07|08|09|10|11|12|
2009|01|02|03|04|05|06|07|08|09|10|11|12|
2010|01|02|03|04|05|06|07|08|09|10|11|12|
2011|01|02|03|04|05|06|07|08|09|10|11|12|
2012|01|02|03|04|05|06|07|08|09|10|11|12|
2013|01|02|03|04|05|06|07|08|09|10|11|12|
2014|01|02|03|04|05|06|07|08|09|10|11|12|
2015|01|02|03|04|05|06|07|08|09|10|11|12|
2016|01|02|03|04|05|06|07|08|09|10|11|12|
2017|01|02|03|04|05|06|07|08|09|10|11|12|
2018|01|02|03|04|05|06|07|08|09|10|11|12|
2019|01|02|03|04|05|06|07|08|09|10|11|12|
2020|01|02|03|04|05|06|07|08|09|10|11|12|
2021|01|02|03|04|05|06|07|08|09|10|11|12|
2022|01|02|03|04|05|06|07|08|09|10|11|12|
2023|01|02|03|04|05|06|07|08|12|
2024|01|02|03|04|

2018-01-18 :-)

_ ららぽーと横浜の Japan PIE Week!! でパイを食べました

スイーツだけじゃなくて肉などのパイもありました。お昼にどうぞ。けっこうおなかいっぱいになりました。

Japan PIE Week!!

_ [OpenBSD][golang]golang の Stat_t

Go 言語仕様よく知らないんだけど、C.hugahoge と書いておくとそのビルドシステムにおける型 hogehoge を参照するらしい。

https://github.com/golang/go/blob/master/src/syscall/types_openbsd.go#L119

type Stat_t C.struct_stat

なので、たとえば以下のように書いておくと

https://github.com/moby/moby/blob/master/pkg/system/stat_openbsd.go

func fromStatT(s *syscall.Stat_t) (*StatT, error) {
	return &StatT{size: s.Size,
		mode: uint32(s.Mode),
		uid:  s.Uid,
		gid:  s.Gid,
		rdev: uint64(s.Rdev),
		mtim: s.Mtim}, nil
}

struct stat のメンバー変数 mtime は time_t であることを前提とした書き方だと思うんだけど、OpenBSD の stat(2) の man には timespec の型が書かれてるのであるが、

https://man.openbsd.org/stat.2

    struct timespec st_atim;  /* time of last access */ 
    struct timespec st_mtim;  /* time of last data modification */ 
    struct timespec st_ctim;  /* time of last file status change */ 

実装では ifdef してるのでコンパイル時に time_t が選択されてるということかな。

https://github.com/openbsd/src/blob/master/sys/sys/stat.h

#if __POSIX_VISIBLE >= 200809 || __BSD_VISIBLE
	struct	timespec st_atim;	/* time of last access */
	struct	timespec st_mtim;	/* time of last data modification */
	struct	timespec st_ctim;	/* time of last file status change */
#else
	time_t    st_atime;		/* time of last access */
	long	  st_atimensec;		/* nsec of last access */
	time_t    st_mtime;		/* time of last data modification */
	long	  st_mtimensec;		/* nsec of last data modification */
	time_t    st_ctime;		/* time of last file status change */
	long	  st_ctimensec;		/* nsec of last file status change */
#endif /* __POSIX_VISIBLE >= 200809 || __BSD_VISIBLE */