Commit Graph

6 Commits

Author SHA1 Message Date
Zach Koopmans b822923b70 [syserr] Covert all linuxerr returns to error type.
Change the linuxerr.ErrorFromErrno to return an error type and not
a *errors.Error type. The latter results in problems comparing to nil
as <nil><nil> != <nil><*errors.Error>.

In a follow up, there will be a change to remove *errors.Error.Errno(),
which will also encourage users to not use Errnos to reference linuxerr.

PiperOrigin-RevId: 406444419
2021-10-29 14:03:16 -07:00
Zach Koopmans 02370bbd31 [syserror] Convert remaining syserror definitions to linuxerr.
Convert remaining public errors (e.g. EINTR) from syserror to linuxerr.

PiperOrigin-RevId: 390471763
2021-08-12 15:19:12 -07:00
Zach Koopmans 590b8d3e99 [syserror] Update several syserror errors to linuxerr equivalents.
Update/remove most syserror errors to linuxerr equivalents. For list
of removed errors, see //pkg/syserror/syserror.go.

PiperOrigin-RevId: 382574582
2021-07-01 12:05:19 -07:00
Zach Koopmans e1dc1c78e7 [syserror] Add conversions to linuxerr with temporary Equals method.
Add Equals method to compare syserror and unix.Errno errors to linuxerr errors.
This will facilitate removal of syserror definitions in a followup, and
finding needed conversions from unix.Errno to linuxerr.

PiperOrigin-RevId: 380909667
2021-06-22 15:53:32 -07:00
Zach Koopmans 1f2ce9f461 [syserror] Change p9 server to use linuxerr.
Change the p9 server to use *errors.Error defined in pkg linuxerr. Done
separate from the client so that we ensure different p9 server/client versions
work with each other.

PiperOrigin-RevId: 380084491
2021-06-17 17:54:11 -07:00
Zach Koopmans 63b4f6e296 [syserror] Refactor linuxerr and error package.
Move Error struct to pkg/errors package for use in multiple places.
Move linuxerr static definitions under pkg/errors/linuxerr.
Add a lookup list for quick lookup of *errors.Error by errno. This is useful
when converting syserror errors and unix.Errno/syscall.Errrno values to
*errors.Error.
Update benchmarks routines to include conversions.

The below benchmarks show *errors.Error usage to be comparable to using
unix.Errno.

BenchmarkAssignUnix
BenchmarkAssignUnix-32                 	787875022	         1.284 ns/op
BenchmarkAssignLinuxerr
BenchmarkAssignLinuxerr-32             	1000000000	         1.209 ns/op
BenchmarkAssignSyserror
BenchmarkAssignSyserror-32             	759269229	         1.429 ns/op
BenchmarkCompareUnix
BenchmarkCompareUnix-32                	1000000000	         1.310 ns/op
BenchmarkCompareLinuxerr
BenchmarkCompareLinuxerr-32            	1000000000	         1.241 ns/op
BenchmarkCompareSyserror
BenchmarkCompareSyserror-32            	147196165	         8.248 ns/op
BenchmarkSwitchUnix
BenchmarkSwitchUnix-32                 	373233556	         3.664 ns/op
BenchmarkSwitchLinuxerr
BenchmarkSwitchLinuxerr-32             	476323929	         3.294 ns/op
BenchmarkSwitchSyserror
BenchmarkSwitchSyserror-32             	39293408	        29.62 ns/op
BenchmarkReturnUnix
BenchmarkReturnUnix-32                 	1000000000	         0.5042 ns/op
BenchmarkReturnLinuxerr
BenchmarkReturnLinuxerr-32             	1000000000	         0.8152 ns/op
BenchmarkConvertUnixLinuxerr
BenchmarkConvertUnixLinuxerr-32        	739948875	         1.547 ns/op
BenchmarkConvertUnixLinuxerrZero
BenchmarkConvertUnixLinuxerrZero-32    	977733974	         1.489 ns/op

PiperOrigin-RevId: 379806801
2021-06-16 14:08:52 -07:00