Commit | Line | Data |
---|---|---|
7f918cf1 CE |
1 | (* Copyright (C) 1999-2006, 2008 Henry Cejtin, Matthew Fluet, Suresh |
2 | * Jagannathan, and Stephen Weeks. | |
3 | * Copyright (C) 1997-2000 NEC Research Institute. | |
4 | * | |
5 | * MLton is released under a BSD-style license. | |
6 | * See the file MLton-LICENSE for details. | |
7 | *) | |
8 | ||
9 | structure MLtonProcEnv: MLTON_PROC_ENV = | |
10 | struct | |
11 | structure GId = PrePosix.GId | |
12 | type gid = GId.t | |
13 | ||
14 | fun setenv {name, value} = | |
15 | let | |
16 | val name = NullString.nullTerm name | |
17 | val value = NullString.nullTerm value | |
18 | in | |
19 | PosixError.SysCall.simple | |
20 | (fn () => PrimitiveFFI.Posix.ProcEnv.setenv (name, value)) | |
21 | end | |
22 | ||
23 | fun setgroups gs = | |
24 | let | |
25 | val v = GId.vectorToRep (Vector.fromList gs) | |
26 | val n = C_Int.fromInt (Vector.length v) | |
27 | in | |
28 | PosixError.SysCall.simple | |
29 | (fn () => PrimitiveFFI.Posix.ProcEnv.setgroups (n, v)) | |
30 | end | |
31 | end |