Skip to content

Skip major/minor/makedev on WASM #16

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Mar 27, 2025
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions include/HsUnixCompat.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,3 @@
unsigned int unix_major(dev_t dev);
unsigned int unix_minor(dev_t dev);
dev_t unix_makedev(unsigned int maj, unsigned int min);

#define NEED_setSymbolicLinkOwnerAndGroup !HAVE_LCHOWN
8 changes: 4 additions & 4 deletions src/System/PosixCompat/Extensions.hsc
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ module System.PosixCompat.Extensions (
) where


#ifndef mingw32_HOST_OS
#if !(defined(mingw32_HOST_OS) || defined(wasm32_HOST_ARCH))
#include "HsUnixCompat.h"
#endif

Expand All @@ -27,7 +27,7 @@ type CMinor = CUInt
--
-- The portable implementation always returns @0@.
deviceMajor :: DeviceID -> CMajor
#ifdef mingw32_HOST_OS
#if defined(mingw32_HOST_OS) || defined(wasm32_HOST_ARCH)
deviceMajor _ = 0
#else
deviceMajor dev = unix_major dev
Expand All @@ -39,7 +39,7 @@ foreign import ccall unsafe "unix_major" unix_major :: CDev -> CUInt
--
-- The portable implementation always returns @0@.
deviceMinor :: DeviceID -> CMinor
#ifdef mingw32_HOST_OS
#if defined(mingw32_HOST_OS) || defined(wasm32_HOST_ARCH)
deviceMinor _ = 0
#else
deviceMinor dev = unix_minor dev
Expand All @@ -49,7 +49,7 @@ foreign import ccall unsafe "unix_minor" unix_minor :: CDev -> CUInt

-- | Creates a 'DeviceID' for a device file given a major and minor number.
makeDeviceID :: CMajor -> CMinor -> DeviceID
#ifdef mingw32_HOST_OS
#if defined(mingw32_HOST_OS) || defined(wasm32_HOST_ARCH)
makeDeviceID _ _ = 0
#else
makeDeviceID ma mi = unix_makedev ma mi
Expand Down
4 changes: 2 additions & 2 deletions src/System/PosixCompat/Files.hsc
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,11 @@ module System.PosixCompat.Files (

#ifndef mingw32_HOST_OS

#include "HsUnixCompat.h"
#include "HsUnixConfig.h"

import System.Posix.Files

#if NEED_setSymbolicLinkOwnerAndGroup
#if !HAVE_LCHOWN
import System.PosixCompat.Types

setSymbolicLinkOwnerAndGroup :: FilePath -> UserID -> GroupID -> IO ()
Expand Down
9 changes: 5 additions & 4 deletions unix-compat.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,11 @@ Library

else
build-depends: unix >= 2.7.2.0 && < 2.9
include-dirs: include
includes: HsUnixCompat.h
install-includes: HsUnixCompat.h
c-sources: cbits/HsUnixCompat.c
if !arch(wasm32)
include-dirs: include
includes: HsUnixCompat.h
install-includes: HsUnixCompat.h
c-sources: cbits/HsUnixCompat.c
if os(solaris)
cc-options: -DSOLARIS

Expand Down