diff options
author | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2016-12-01 16:24:54 +0300 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2016-12-01 16:24:54 +0300 |
commit | d0ab6714c53c9d7f3e42b7ea2e108afbd7449305 (patch) | |
tree | cbc41759898f3e29f58564e6eff48e58aa94217c /tools | |
parent | e2174b0c24caca170ca61eda2ae49c9561ff8896 (diff) | |
parent | 69d4e425d218e866e4cf3d34099691e9bcde0209 (diff) | |
download | linux-d0ab6714c53c9d7f3e42b7ea2e108afbd7449305.tar.xz |
Merge back earlier ACPICA material for v4.10.
Diffstat (limited to 'tools')
-rw-r--r-- | tools/power/acpi/os_specific/service_layers/osunixxf.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/tools/power/acpi/os_specific/service_layers/osunixxf.c b/tools/power/acpi/os_specific/service_layers/osunixxf.c index 8d8003c919d4..10648aaf6164 100644 --- a/tools/power/acpi/os_specific/service_layers/osunixxf.c +++ b/tools/power/acpi/os_specific/service_layers/osunixxf.c @@ -646,8 +646,12 @@ acpi_os_create_semaphore(u32 max_units, } #ifdef __APPLE__ { - char *semaphore_name = tmpnam(NULL); + static int semaphore_count = 0; + char semaphore_name[32]; + snprintf(semaphore_name, sizeof(semaphore_name), "acpi_sem_%d", + semaphore_count++); + printf("%s\n", semaphore_name); sem = sem_open(semaphore_name, O_EXCL | O_CREAT, 0755, initial_units); @@ -692,10 +696,15 @@ acpi_status acpi_os_delete_semaphore(acpi_handle handle) if (!sem) { return (AE_BAD_PARAMETER); } - +#ifdef __APPLE__ + if (sem_close(sem) == -1) { + return (AE_BAD_PARAMETER); + } +#else if (sem_destroy(sem) == -1) { return (AE_BAD_PARAMETER); } +#endif return (AE_OK); } |