-
Notifications
You must be signed in to change notification settings - Fork 740
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Heavily based on the Ruby lexer. Add "guessing" specs for crystal lang
- Loading branch information
Peter Leitzen
committed
Jun 7, 2018
1 parent
a58789a
commit 3fe00d1
Showing
4 changed files
with
541 additions
and
0 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
lib LibC | ||
WNOHANG = 0x00000001 | ||
|
||
@[ReturnsTwice] | ||
fun fork : PidT | ||
fun getpgid(pid : PidT) : PidT | ||
fun kill(pid : PidT, signal : Int) : Int | ||
fun getpid : PidT | ||
fun getppid : PidT | ||
fun exit(status : Int) : NoReturn | ||
|
||
ifdef x86_64 | ||
alias ClockT = UInt64 | ||
else | ||
alias ClockT = UInt32 | ||
end | ||
|
||
SC_CLK_TCK = 3 | ||
|
||
struct Tms | ||
utime : ClockT | ||
stime : ClockT | ||
cutime : ClockT | ||
cstime : ClockT | ||
end | ||
|
||
fun times(buffer : Tms*) : ClockT | ||
fun sysconf(name : Int) : Long | ||
end | ||
|
||
class Process | ||
def self.exit(status = 0) | ||
LibC.exit(status) | ||
end | ||
|
||
def self.pid | ||
LibC.getpid | ||
end | ||
|
||
def self.getpgid(pid : Int32) | ||
ret = LibC.getpgid(pid) | ||
raise Errno.new(ret) if ret < 0 | ||
ret | ||
end | ||
end |
Oops, something went wrong.