-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Sign exchange with sig, and add sig_test.go
- Loading branch information
1 parent
efacc7f
commit d7b880e
Showing
5 changed files
with
412 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# exchange | ||
|
||
A simple C program to atomically exchange two files or folders using the `renameat2(2)` system call. | ||
|
||
## Description | ||
|
||
This program provides a command-line interface to the `renameat2` system call with the `RENAME_EXCHANGE` flag, allowing users to atomically swap the names of two files or directories. | ||
|
||
## Notes | ||
|
||
- This program requires a Linux kernel that supports the `renameat2` system call (Linux 3.15 and later). | ||
- The program uses direct system calls, which may not be portable across all Linux distributions or kernel versions. | ||
|
||
## Building | ||
|
||
To compile the program, use: | ||
```bash | ||
gcc exchange.c -s -Os -o exchange | ||
cp exchange /usr/local/bin/exchange | ||
``` | ||
|
||
## Usage | ||
To exchange two files or directories, run: | ||
``` | ||
./exchange file1.txt file2.txt | ||
./exchange dir1 dir2 | ||
``` | ||
|
||
## Contributing | ||
|
||
Contributions are welcome! Open a pull request. | ||
|
||
## License | ||
|
||
``` | ||
MIT License | ||
Copyright (c) 2024 Clayton Singh | ||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. | ||
``` |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
-----BEGIN PUBLIC KEY----- | ||
MCowBQYDK2VwAyEAzl8VeJlM51SWa9wlOHRRvpdK0ZN1EPNMrQmLrZ9p6dk= | ||
-----END PUBLIC KEY----- |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# Monorepo Tools Collection | ||
|
||
This monorepo contains various command-line tools and utilities for different purposes. | ||
|
||
## Tools Included | ||
|
||
- **exchange** - Atomically swap two files or directories. | ||
- **sig** - For signing, fetching, verifying, and inspecting signed documents. | ||
|
||
## Getting Started | ||
|
||
1. Clone the repository: | ||
```bash | ||
git clone https://github.com/claytonsingh/tools.git | ||
``` | ||
|
||
2. Navigate to the specific tool directory: | ||
```bash | ||
cd tools/tool-name | ||
``` | ||
|
||
3. Follow the individual README instructions for each tool. | ||
|
||
## Releases | ||
|
||
Releases for all tools are grouped together. To find the latest releases: | ||
|
||
1. Visit the [Releases page](https://github.com/claytonsingh/tools/releases) of this repository. | ||
2. Each release contains updates for all tools in the monorepo. | ||
3. Release notes will specify which tools have been updated and their respective version numbers. | ||
4. Download the release package, which includes pre-built binaries for all tools and supported platforms. | ||
|
||
## Contributing | ||
|
||
Contributions are welcome! Open a pull request. | ||
|
||
## License | ||
|
||
Each tool is licensed under its own license. |
Oops, something went wrong.