freenode/#lisp - IRC Chatlog
Search
0:18:53
White_Flame
none comes to mind, but with multiple drives/partitions, the notion needs more specificity
0:23:05
Nilby
I have a thing, but I can't recommend it: (nos:filesystem-info-bytes-free (nos:get-filesystem-info "/"))
0:32:07
Nilby
Typical Lisp reasones: no docs, no tests, 1 user, poorly maintained, capricious developer, etc.
1:15:34
pjb
saturn2: in posix, you would use /bin/df with the path of a item stored on the file system.
1:16:03
pjb
saturn2: but note that file systems are unrelated to disks: a disk may contain several file systems, and a file system may be stored on 0, 1 or more disks.
1:16:46
pjb
saturn2: if you have the access rights, you could try to read the parttion table on the raw disk device, and interpret it to see if there's some free disk space between partitions?
1:35:27
pjb
saturn2: by the time you get the information you believe you need, it may be totally wrong!
1:35:46
pjb
saturn2: another user may have allocated all the remaining space, or another process may have deleted files!
1:36:28
pjb
saturn2: so the only way to do it, and this is the big lesson of unix, and why it has been so successful compared to other OSes old an new, is that you don't want to use such query, but instead you want to do what you want to do, and wait for an error to occur if it's not possible.
1:39:06
pjb
saturn2: you can pre-allocate a file: (handler-case (with-open-file (out "DATA:FILE.BIN" :element-type '(unsigned-byte 8) :direction :output :if-does-not-exist :create :if-exists :error) (loop with buffer = (make-array (* 1024 1024) :element-type '(unsigned-byte 8) :initial-element 42) repeat 1024 do (write-sequence buffer out))) (:no-error () t) (error () nil))
1:40:50
pjb
I one of my first jobs we worked on a system where the admin allocated the files on the disk track-by-track…
1:40:51
Nilby
Another lesson of unix is that doing it that way is completely unreliable, and modern reliable software doesn't. And most unix is single user now.
1:41:48
saturn2
but also, there are other reasons to monitor disk usage than creating a file immediately
1:43:38
pjb
because it's useless to offer all the functions: there are an infinite number of functions!
1:47:44
Nilby
The amount of things people expect from a portable O/S interface is finite, and relatively small, and I think seeing how much disk space you have is surely a useful one.
1:48:03
pjb
But anyways the output of df(1) is human readable, so it cannot be processed easily (format may change).
2:08:29
Nilby
I find it amusing that there's awk in lisp and lisp in awk, but a df in Lisp uses C awk.
3:56:24
beach
For example, calling COPY-LIST on a circular list might do that. At least, the standard allows for it to happen.
3:57:35
asarch
I am using cl-cffi-gtk to create the window using a Glade template file to CRUD the data from a local PostgreSQL cluster using Datafly
3:58:42
asarch
Since I am learning the Japanese language, I was copying/inserting some grammar information into the cluster using this interface
4:01:04
White_Flame
and same as beach, I have no idea about the effects of FFI on the lisp heap. Assuming that any malloc stuff is outside lisp-managed memory space, I wouldn't actually suspect it
4:01:34
asarch
Well, every time the data was inserted the CPU % use increased to the infinity and beyond
4:04:14
asarch
top -d 1 shows the % used of the processors every time I "saved" the new data using this GTK+ application
4:05:47
no-defun-allowed
asarch: Do you have an idea of how much data you are loading into Postgres?
4:06:20
beach
White_Flame: I am sure there is. I am no longer directly involved, but I am sure jackdaniel has the ambition to keep it up to date.