jech / galene

The Galène videoconference server
https://galene.org
MIT License
900 stars 119 forks source link

Changes required for FreeBSD compatibility #149

Closed Amatis-51 closed 1 year ago

Amatis-51 commented 1 year ago

Hello,

When compiling on FreeBSD 13 , go 1.19.2, I saw the following errors:

# github.com/jech/galene/limit
limit/limit_unix.go:18:16: invalid operation: old.Cur >= desired (mismatched types int64 and uint64)
limit/limit_unix.go:19:10: cannot use old.Cur (variable of type int64) as type uint64 in return statement
limit/limit_unix.go:22:15: invalid operation: old.Max < desired (mismatched types int64 and uint64)
limit/limit_unix.go:24:9: cannot use desired (variable of type uint64) as type int64 in struct literal
limit/limit_unix.go:25:9: cannot use desired (variable of type uint64) as type int64 in struct literal
limit/limit_unix.go:29:11: cannot use limit.Cur (variable of type int64) as type uint64 in return statement
limit/limit_unix.go:32:13: cannot use old.Max (variable of type int64) as type uint64 in assignment
limit/limit_unix.go:36:8: cannot use desired (variable of type uint64) as type int64 in struct literal
limit/limit_unix.go:41:10: cannot use old.Cur (variable of type int64) as type uint64 in return statement
limit/limit_unix.go:43:9: cannot use limit.Cur (variable of type int64) as type uint64 in return statement
limit/limit_unix.go:43:9: too many errors

For personal testing, I added a FreeBSD-specific copy of limit_unix.go that converts the types as listed above. This allowed the application to compile and run without issue. However, I wasn't sure if there would be a more elegant solution.

jech commented 1 year ago

Thanks for the report. It should be fixed in 4cdeb17.

I've simply disabled the ulimit handling on BSD, since recent versions of Go automatically set the soft limit to the hard limit. Unfortunately, this means that you won't get a friendly warning if the hard limit is set too low.

Please reopen if you feel this is not good enough.