Skip to content

Commit

Permalink
misc: protect <unistd.h> with #ifdef
Browse files Browse the repository at this point in the history
Some windows build don't have it.

Thanks to Isuru Fernando for reporting the issue. Refs #327.

Signed-off-by: Brice Goglin <Brice.Goglin@inria.fr>
  • Loading branch information
bgoglin committed Sep 24, 2018
1 parent 256d2e5 commit 2caac3f
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 6 deletions.
4 changes: 3 additions & 1 deletion doc/examples/cpuset+bitmap+cpubind.c
Expand Up @@ -3,15 +3,17 @@
* - retrieving the location where the current thread executes
* - combining/modifying cpusets using the bitmap API
*
* Copyright © 2014-2017 Inria. All rights reserved.
* Copyright © 2014-2018 Inria. All rights reserved.
* See COPYING in top-level directory.
*/

#include <hwloc.h>
#include <errno.h>
#include <stdio.h>
#include <string.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif

int main(void)
{
Expand Down
4 changes: 3 additions & 1 deletion doc/examples/nodeset+membind+policy.c
Expand Up @@ -3,15 +3,17 @@
* - manipulating nodesets
* - memory binding and binding policies
*
* Copyright © 2014-2017 Inria. All rights reserved.
* Copyright © 2014-2018 Inria. All rights reserved.
* See COPYING in top-level directory.
*/

#include <hwloc.h>
#include <errno.h>
#include <stdio.h>
#include <string.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <assert.h>

int main(void)
Expand Down
4 changes: 3 additions & 1 deletion doc/examples/sharedcaches.c
@@ -1,15 +1,17 @@
/* This example program looks for caches shared between this process
* and another one based on their current binding.
*
* Copyright © 2014-2015 Inria. All rights reserved.
* Copyright © 2014-2018 Inria. All rights reserved.
* See COPYING in top-level directory.
*/

#include <hwloc.h>
#include <errno.h>
#include <stdio.h>
#include <string.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif

int main(int argc, char *argv[])
{
Expand Down
4 changes: 3 additions & 1 deletion hwloc/shmem.c
@@ -1,5 +1,5 @@
/*
* Copyright © 2017 Inria. All rights reserved.
* Copyright © 2017-2018 Inria. All rights reserved.
* See COPYING in top-level directory.
*/

Expand All @@ -11,7 +11,9 @@
#ifndef HWLOC_WIN_SYS

#include <sys/mman.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <assert.h>

#define HWLOC_SHMEM_HEADER_VERSION 1
Expand Down
4 changes: 3 additions & 1 deletion netloc/support.c
@@ -1,7 +1,7 @@
/*
* Copyright © 2013-2014 University of Wisconsin-La Crosse.
* All rights reserved.
* Copyright © 2016-2017 Inria. All rights reserved.
* Copyright © 2016-2018 Inria. All rights reserved.
*
* $COPYRIGHT$
*
Expand All @@ -17,7 +17,9 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif

char *netloc_line_get_next_token(char **string, char c)
{
Expand Down
2 changes: 2 additions & 0 deletions tests/hwloc/shmem.c
Expand Up @@ -10,7 +10,9 @@
#include <stdlib.h>
#include <fcntl.h>
#include <stdio.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <sys/mman.h>
#include <sys/types.h>
#include <sys/stat.h>
Expand Down
2 changes: 2 additions & 0 deletions utils/hwloc/hwloc-dump-hwdata-knl.c
Expand Up @@ -10,7 +10,9 @@
#include <dirent.h>
#include <errno.h>
#include <fcntl.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
Expand Down
2 changes: 2 additions & 0 deletions utils/hwloc/hwloc-dump-hwdata.c
Expand Up @@ -11,7 +11,9 @@
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/types.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <errno.h>
#include <assert.h>

Expand Down
4 changes: 3 additions & 1 deletion utils/netloc/infiniband/netloc_ib_extract_dats.c
@@ -1,5 +1,5 @@
/*
* Copyright © 2016 Inria. All rights reserved.
* Copyright © 2016-2018 Inria. All rights reserved.
*
* $COPYRIGHT$
*
Expand All @@ -13,7 +13,9 @@
#include <stdio.h>
#include <assert.h>
#include <stdlib.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <private/netloc.h>
#include <netloc/uthash.h>
#include <netloc/utarray.h>
Expand Down

0 comments on commit 2caac3f

Please sign in to comment.