Issue #13996 has been updated by nobu (Nobuyoshi Nakada).


```
    /*
     * aa is on-stack for small argc, we must ensure paths are marked
     * for large argv if aa is on the heap.
     */
```

As `ALLOCV` uses `imemo_alloc` (`NODE_ALLOCA` till 2.4), the contents are marked.

```
    size_t size = sizeof(const char *) + sizeof(VALUE);
    const long len = (long)(sizeof(struct apply_arg) + (size * argc) - size);
```

I'm afraid that `struct apply_arg` and `fn` in it may not be guaranteed as never-padded.
Isn't it better to make it a separate struct, and calculate `len` using `offsetof`?

----------------------------------------
Feature #13996: [PATCH] file.c: apply2files releases GVL
https://bugs.ruby-lang.org/issues/13996#change-67563

* Author: normalperson (Eric Wong)
* Status: Closed
* Priority: Normal
* Assignee: 
* Target version: 
----------------------------------------
This means File.chmod, File.lchmod, File.chown, File.lchown,
File.unlink, and File.utime operations on slow filesystems
no longer hold up other threads.

The platform-specific utime_failed changes is compile-tested
using a new UTIME_EINVAL macro

* file.c (UTIME_EINVAL): new macro to ease compile-testing
* file.c (struct apply_arg): new struct
* file.c (no_gvl_apply2files): new function
* file.c (apply2files): release GVL
* file.c (chmod_internal): adjust for apply2files changes
* file.c (lchmod_internal): ditto
* file.c (chown_internal): ditto
* file.c (lchown_internal): ditto
* file.c (utime_failed): ditto
* file.c (utime_internal): ditto
* file.c (unlink_internal): ditto


---Files--------------------------------
0001-file.c-apply2files-releases-GVL.patch (7.65 KB)


-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>