Repository navigation
Conversation
Creates special files, with -m and -Z. Types are FIFO (p), block (b) and character (c) devices; u is rejected because Linux does not implement the POSIX unspecified type. Block and character devices need a major and minor number, packed the way makedev does, and the file type is folded into the mode passed to mknod(2) alongside the permission bits, which is the detail that distinguishes a FIFO from a plain file. The default mode is 0666 masked by the umask, as GNU applies. Nix-only: mknod(2) does not exist on Windows and the file types have no Windows equivalent, so mknod stays in the build.vsh ignore list and the suite is named _nix_test.v. Verified by cross-compiling to Linux and running under WSL: a FIFO is created with the same type and mode as GNU's, and every diagnostic matches byte for byte, including the curly quotes GNU puts around operands and the bare 'name: File exists' form.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
mknodcreates special files, with-mand-Z.Types are FIFO (
p), block (b) and character (c) devices.uis rejected because Linux does not implement the POSIX "unspecified" type — measured against GNU rather than assumed.Block and character devices need a major and minor number, packed the way
makedevdoes. The file type is folded into the mode passed tomknod(2)alongside the permission bits, which is the detail that distinguishes a FIFO from a plain file.The default mode is
0666masked by the umask, as GNU applies.How this was verified
V cannot link a Linux binary from Windows, only emit C. So I cross-compiled with
-os linux, rewrote V's absolute Windows#includepaths to their/mntequivalents, and built with WSL's gcc. FIFOs turn out to be creatable unprivileged, which made real verification possible rather than only error-path checking:fifo 644)‘ff’) and the baremknod: ex: File existsform with nocannot createand no quotesOne correction worth recording: GNU's diagnostics use U+2018/U+2019 curly quotes, not ASCII apostrophes. My first version emitted the ASCII form and looked right in the terminal, which is exactly the kind of difference that only byte-level comparison catches.
Same caveat as the other nix-only tools: the
_nix_test.vsuite covers only parsing and the mode arithmetic. It compiles for Linux, but I could not execute it, since V will not generate C for a test target. It will run on theubuntu-*CI jobs.