os161 | ops-class.org OS/161 sources
kandi X-RAY | os161 Summary
kandi X-RAY | os161 Summary
ops-class.org OS/161 sources.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of os161
os161 Key Features
os161 Examples and Code Snippets
Community Discussions
Trending Discussions on os161
QUESTION
Here, I was asking about an assignment of implementing the sys_open
syscall for OS161
which will be called by the open
function.
The definition of the open
function is as follows:
ANSWER
Answered 2020-Sep-06 at 01:34The POSIX documentation simply states that the:
mode shall be set to the value of the argument following the
oflag
argument taken as typemode_t
modified as follows: ...
It does not specify what happens when you omit that parameter so you would be well advised to ensure it's there (on the client side). The most likely case will be that it will use what is where the parameter would be (whether in register or memory, depending on calling convention), and the chances of this being the correct value would be slim.
The Linux documentation has this to say on the matter (my emphasis):
The
mode
argument must be supplied ifO_CREAT
orO_TMPFILE
is specified inflags
; if it is not supplied, some arbitrary bytes from the stack will be applied as the file mode.
Now, granted, that's not a standards document where the term "must" is a solid requirement that you do it (or else all bets are off as to the effect), but you should probably read it in that way. Hence, again, you should make sure you supply it.
So I would say that the way you handle it is as follows:
- If on the client/caller side, make sure you supply the mode. Anything else is breaking the contract.
- On the server/callee side, assume that the caller has supplied it since, if they haven't, they're breaking the contract. There appears to be no suitable error return in POSIX (in either the "shall fail" or "may fail" section) that would be suitable for indicating this issue, even if you could detect it.
QUESTION
From the man pages of OS161
:
ANSWER
Answered 2020-Sep-03 at 11:16First, that OS161 man page is wrong in incorrectly implying that there are two versions of the open()
function. There is only one version of open()
- C does not support function overloading like that man page implies. Per POSIX the one version of open()
is
QUESTION
ANSWER
Answered 2020-Aug-13 at 01:42This looks like a strong typedef, i.e. a typedef intended to increase type safety by avoiding unintended uses/conversions of the wrapped data.
In your context, most likely intended to differentiate kernel pointers from user space pointers (usually mapped via the MMU).
QUESTION
The "os161" operating system contains the following code. Specifically, where the syscalls are defined:
...ANSWER
Answered 2020-Aug-02 at 06:41It is used for other tools to ease the maintenance of the source code.
The following is a quote from Understanding System Calls
syscalls.S: This file is created from syscalls-mips.S at compile time and is the actual file assembled into the C library. The actual names of the system calls are placed in this file using a script called callno-parse.sh that reads them from the kernel's header files. This avoids having to make a second list of the system calls. In a real system, typically each system call stub is placed in its own source file, to allow selectively linking them in. OS/161 puts them all together to simplify the makefiles. Adding new entries to callno.h automatically causes new user-level system call procedures to be defined when you re-build the user-level code. Each "SYSCALL(name,num)" macro statement in this file is expanded by the C pre-processor into a declaration of the appropriate system call function.
kern/syscall.h most likely is produce by one of those tools.
QUESTION
I am implementing a fork system call in os161 kernel. I am trying to create a new process and for its thread creation I used thread_fork
. I am using the function md_forkentry
to allocate heap and stack to the trapframe of the new thread and switch to user mode; but I get this warning after compiling the code:
passing arg 4 of 'thread_fork' from incompatible pointer type
ANSWER
Answered 2020-Mar-13 at 23:31Your prototype for md_forkentry()
does not match the type of the 4th parameter of thread_fork()
.
md_forkentry()
must be prototyped as:
QUESTION
I am trying to build the userland for os161. When I type make in the command line I get the following error:
Makefile 24: ***missing separator (did you mean TAB instead of 8 spaces?). Stop.
I checked the Makefile at line 24 and tried adding a TAB to the start of the line, but that didn't work as I then get another error:
Makefile 24: ***recipe commences before first target. Stop.
Here is the full makefile for reference:
...ANSWER
Answered 2017-May-20 at 11:37A separator is a . Please do not use spaces at line begin in a Makefile, Makefile.in ...
Snippet:
QUESTION
ANSWER
Answered 2017-Jan-12 at 04:45The code handle->fh_vnode
is setting a pointer to automatic variable ("on the stack"), function parameters are automatic variables. After the function returns this will be a dangling pointer.
To fix this you will need to re-design your code a bit, e.g. perhaps the struct fh
should just store file
and not a pointer to file
.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install os161
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page