pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Christoph Moench-Tegeder <cmt@burggraben.net>
To: Michael Paquier <michael@paquier.xyz>
Cc: Julien Rouhaud <rjuju123@gmail.com>
Cc: Christoph Berg <myon@debian.org>
Cc: PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Subject: Re: Monitoring disk space from within the server
Date: Sat, 9 Nov 2019 14:33:49 +0100
Message-ID: <20191109133349.GA2545@elch.exwg.net> (raw)
In-Reply-To: <20191109015618.GB5128@paquier.xyz>
References: <20191108132419.GG8017@msg.df7cb.de>
	<CAOBaU_YVGEnsnP1ufp42NiJ+WvPHRWBOsBOcaxWxsbXPN_sdNQ@mail.gmail.com>
	<20191108133531.GH8017@msg.df7cb.de>
	<CAOBaU_Zu6RP6-mHyA_J9-xkxJe0tarTVqU9TFza+tCPKUxsjiA@mail.gmail.com>
	<20191108135830.GJ8017@msg.df7cb.de>
	<CAOBaU_aENmaDNO7Y=iG=L2Wsjwje4HPxt5+c623_OfCwSzDKmQ@mail.gmail.com>
	<20191109015618.GB5128@paquier.xyz>

## Michael Paquier (michael@paquier.xyz):

> Total bytes and free bytes looks like a good first cut.  Have you
> looked at the portability of statfs() on other BSD flavors and
> Solaris?

"The statfs() system call first appeared in 4.4BSD." (from the statfs(2)
manpage on FreeBSD). struct statfs differs between Linux and BSD, but
is "close enough" for this, the fields from the original patch are
present in both implementations.
Solaris does not have statfs() anymore. Instead, it has a statvfs()
which is "more or less equivalent" to the Linux statvfs(). On FreeBSD,
using statvfs() (it's available) is rather not recommended, from the
man page:
  The statvfs() and fstatvfs() functions fill the structure pointed
  to by buf with garbage. This garbage will occasionally bear resemblance
  to file system statistics, but portable applications must not depend on
  this.
That's funny, as statvfs() is in our beloved POSIX.1 since at least
2001 - current specs:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/fstatvfs.html

Regards,
Christoph

-- 
Spare Space





view thread (22+ messages)  latest in thread

Message-ID: <20191109133349.GA2545@elch.exwg.net>
Permalink:  ../20191109133349.GA2545@elch.exwg.net/
Also on:    postgresql.org/message-id/20191109133349.GA2545@elch.exwg.net

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: cmt@burggraben.net, michael@paquier.xyz, rjuju123@gmail.com, myon@debian.org
  Subject: Re: Monitoring disk space from within the server
  In-Reply-To: <20191109133349.GA2545@elch.exwg.net>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox