Plan 9 from Bell Labs’s /usr/web/sources/contrib/de0u/root/sys/src/cmd/divergefs/common.h

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.



typedef enum bool
{
  true = 1,
  false = 0
} bool;

enum { INVALID_FD = -1 };

#define assert_valid(p) assert((p) != nil)

#define fd_isopen(fd) ((fd) >= 0)

#define static_array_length(array) (sizeof(array) / sizeof(array[0]))

/** same as emalloc9p except the content is zeroed */
void *emallocz9p(ulong size);

void *emalloc_fs(ulong size);
void *erealloc_fs(void *p, ulong size);
void *emallocz_fs(ulong size);
char *estrdup_fs(char *str);


#ifdef CPP_DEBUG
  #ifdef assert
  #undef assert
  #endif
    
  #define assert(x) \
    if(!(x)) \
      { fprint(2, "%s:%d assertion failed\n", __FILE__, __LINE__); abort(); }
#endif



Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to [email protected].