Apache Mesos
grp.hpp
Go to the documentation of this file.
1 // Licensed to the Apache Software Foundation (ASF) under one
2 // or more contributor license agreements. See the NOTICE file
3 // distributed with this work for additional information
4 // regarding copyright ownership. The ASF licenses this file
5 // to you under the Apache License, Version 2.0 (the
6 // "License"); you may not use this file except in compliance
7 // with the License. You may obtain a copy of the License at
8 //
9 // http://www.apache.org/licenses/LICENSE-2.0
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 
17 #ifndef __STOUT_INTERNAL_WINDOWS_GRP_HPP__
18 #define __STOUT_INTERNAL_WINDOWS_GRP_HPP__
19 
20 #include <sys/types.h>
21 
22 #include <stout/windows.hpp>
23 
24 
25 // Dummy struct for POSIX compliance.
26 struct group
27 {
28  char* gr_name; // The name of the group.
29  gid_t gr_gid; // Numerical group ID.
30  char** gr_mem; // Pointer to a null-terminated array of character pointers to
31  // member names.
32 };
33 
34 
35 // Dummy implementation of `getgrgid` for POSIX compliance. Per the POSIX
36 // specification[1], we are to return `nullptr` if an entry matching the GID is
37 // not found. On Windows, we will never find such an entry, so we always return
38 // `nullptr`. Just to be safe, we also set `errno` to `ENOSYS` which indicates
39 // the function is not implemented.
40 //
41 // [1] http://pubs.opengroup.org/onlinepubs/009695399/functions/getgrgid.html
42 inline struct group* getgrgid(gid_t)
43 {
44  errno = ENOSYS;
45  return nullptr;
46 }
47 
48 #endif // __STOUT_INTERNAL_WINDOWS_GRP_HPP__
char * gr_name
Definition: grp.hpp:28
struct group * getgrgid(gid_t)
Definition: grp.hpp:42
gid_t gr_gid
Definition: grp.hpp:29
Definition: grp.hpp:26
int gid_t
Definition: windows.hpp:184
char ** gr_mem
Definition: grp.hpp:30