xref: /aosp_15_r20/external/sandboxed-api/oss-internship-2020/libuv/examples/README.md (revision ec63e07ab9515d95e79c211197c445ef84cefa6a)
1*ec63e07aSXin Li# LibUV Sandbox Examples
2*ec63e07aSXin Li
3*ec63e07aSXin LiEach example in this folder is the sandboxed version of a code snippet from
4*ec63e07aSXin Li[LibUV's User Guide](https://docs.libuv.org/en/v1.x/guide.html). These examples
5*ec63e07aSXin Liperform some basic tasks using LibUV, and can be useful both to understand how
6*ec63e07aSXin Lito use LibUV Sandbox, but also to get an idea of how regular and sandboxed code
7*ec63e07aSXin Licompare to each other.
8*ec63e07aSXin Li
9*ec63e07aSXin LiThis is the list of examples:
10*ec63e07aSXin Li
11*ec63e07aSXin Li- **helloworld.cc**: sandboxed version of
12*ec63e07aSXin Li[helloworld/main.c](https://docs.libuv.org/en/v1.x/guide/basics.html#hello-world).
13*ec63e07aSXin LiIt simply starts a loop that exits immediately. It shows how to run a simple
14*ec63e07aSXin Liloop in LibUV Sandbox.
15*ec63e07aSXin Li- **idle-basic.cc**: sandboxed version of
16*ec63e07aSXin Li[idle-basic/main.c](https://docs.libuv.org/en/v1.x/guide/basics.html#handles-and-requests).
17*ec63e07aSXin LiCreates an idle watcher that stops the loop after a certain number of
18*ec63e07aSXin Liiterations. It shows how a simple callback can be used in LibUV Sandbox.
19*ec63e07aSXin Li- **uvcat.cc**: sandboxed version of
20*ec63e07aSXin Li[uvcat/main.c](http://docs.libuv.org/en/v1.x/guide/filesystem.html#reading-writing-files).
21*ec63e07aSXin LiTakes a single argument, the absolute path of a file, and prints its contents
22*ec63e07aSXin Li(it is a simplified version of the command line tootl `cat`). It shows how to
23*ec63e07aSXin Limanage various complex callbacks for opening, reading and writing files.
24