@@ -96,9 +96,9 @@ func (s *vfsShm) Close() error {
9696 return err
9797}
9898
99- func (s * vfsShm ) shmOpen () (err error ) {
99+ func (s * vfsShm ) shmOpen () (rc _ErrorCode ) {
100100 if s .vfsShmFile != nil {
101- return nil
101+ return _OK
102102 }
103103
104104 // Open file read-write, as it will be shared.
@@ -123,13 +123,13 @@ func (s *vfsShm) shmOpen() (err error) {
123123 if g != nil && os .SameFile (fi , g .info ) {
124124 g .refs ++
125125 s .vfsShmFile = g
126- return nil
126+ return _OK
127127 }
128128 }
129129
130130 // Lock and truncate the file, if not readonly.
131131 if s .readOnly {
132- err = _READONLY_CANTINIT
132+ rc = _READONLY_CANTINIT
133133 } else {
134134 if rc := osWriteLock (f , 0 , 0 , 0 ); rc != _OK {
135135 return rc
@@ -156,17 +156,17 @@ func (s *vfsShm) shmOpen() (err error) {
156156 if add {
157157 vfsShmFiles = append (vfsShmFiles , s .vfsShmFile )
158158 }
159- return err
159+ return rc
160160}
161161
162- func (s * vfsShm ) shmMap (ctx context.Context , mod api.Module , id , size int32 , extend bool ) (uint32 , error ) {
162+ func (s * vfsShm ) shmMap (ctx context.Context , mod api.Module , id , size int32 , extend bool ) (uint32 , _ErrorCode ) {
163163 // Ensure size is a multiple of the OS page size.
164164 if int (size )& (unix .Getpagesize ()- 1 ) != 0 {
165165 return 0 , _IOERR_SHMMAP
166166 }
167167
168- if err := s .shmOpen (); err != nil {
169- return 0 , err
168+ if rc := s .shmOpen (); rc != _OK {
169+ return 0 , rc
170170 }
171171
172172 // Check if file is big enough.
@@ -176,7 +176,7 @@ func (s *vfsShm) shmMap(ctx context.Context, mod api.Module, id, size int32, ext
176176 }
177177 if n := (int64 (id ) + 1 ) * int64 (size ); n > o {
178178 if ! extend {
179- return 0 , nil
179+ return 0 , _OK
180180 }
181181 err := osAllocate (s .File , n )
182182 if err != nil {
@@ -192,13 +192,13 @@ func (s *vfsShm) shmMap(ctx context.Context, mod api.Module, id, size int32, ext
192192 }
193193 r , err := util .MapRegion (ctx , mod , s .File , int64 (id )* int64 (size ), size , prot )
194194 if err != nil {
195- return 0 , err
195+ return 0 , _IOERR_SHMMAP
196196 }
197197 s .regions = append (s .regions , r )
198- return r .Ptr , nil
198+ return r .Ptr , _OK
199199}
200200
201- func (s * vfsShm ) shmLock (offset , n int32 , flags _ShmFlag ) error {
201+ func (s * vfsShm ) shmLock (offset , n int32 , flags _ShmFlag ) _ErrorCode {
202202 s .lockMtx .Lock ()
203203 defer s .lockMtx .Unlock ()
204204
@@ -235,7 +235,7 @@ func (s *vfsShm) shmLock(offset, n int32, flags _ShmFlag) error {
235235 }
236236 }
237237
238- return nil
238+ return _OK
239239}
240240
241241func (s * vfsShm ) shmUnmap (delete bool ) {
0 commit comments