Il 05/05/2013 11:23, Holger Hans Peter Freyther ha scritto: > 2013-04-28 Holger Hans Peter Freyther <[email protected]> > > * kernel/File.st: Add File>>#primLink:as:, File>>#primFsync: and > File>>#primSync to use the new primitives.
#primFsync should be an additional file primitive, and the method should be in FileDescriptor. FileStream should override it and first flush the buffer. BTW, you probably want to check for fdatasync and use it is available. #primSync should just be #sync and a class method; #primLink:as: should have matching methods that call it on a File object (with an abstract version on FilePath, probably) and that call #checkError to raise exceptions properly. In other word you can copy a lot of how symlinks work (with some simplifications because you don't have to handle relative paths). Thanks! Paolo > 2013-04-28 Holger Hans Peter Freyther <[email protected]> > > * libgst/cint.c: Bind link, fsync, sync for additional C level access. > --- > ChangeLog | 5 +++++ > kernel/File.st | 15 +++++++++++++++ > libgst/ChangeLog | 4 ++++ > libgst/cint.c | 3 +++ > 4 files changed, 27 insertions(+) > > diff --git a/ChangeLog b/ChangeLog > index 6b6d9d2..c45d2a0 100644 > --- a/ChangeLog > +++ b/ChangeLog > @@ -1,3 +1,8 @@ > +2013-04-28 Holger Hans Peter Freyther <[email protected]> > + > + * kernel/File.st: Add File>>#primLink:as:, File>>#primFsync: and > + File>>#primSync to use the new primitives. > + > 2013-03-04 Holger Hans Peter Freyther <[email protected]> > > * kernel/PkgLoader.st: Remove unused variable. > diff --git a/kernel/File.st b/kernel/File.st > index 426a415..b40e9bd 100644 > --- a/kernel/File.st > +++ b/kernel/File.st > @@ -259,6 +259,11 @@ FilePath subclass: File [ > > ] > > + primLink: srcName as: destName [ > + <category: 'private-C call-outs'> > + <cCall: 'link' returning: #int args: #(#string #string)> > + ] > + > primSymlink: srcName as: destName [ > <category: 'private-C call-outs'> > <cCall: 'symlink' returning: #int args: #(#string #string)> > @@ -289,6 +294,16 @@ FilePath subclass: File [ > > ] > > + primFsync: aFd [ > + <category: 'private-C call-outs'> > + <cCall: 'fsync' returning: #int args: #(#int)> > + ] > + > + primSync [ > + <category: 'private-C call-outs'> > + <cCall: 'sync' returning: #int args: #()> > + ] > + > extractDirentName: dirent [ > <category: 'private-C call-outs'> > <cCall: 'extractDirentName' returning: #string args: #(#cObject)> > diff --git a/libgst/ChangeLog b/libgst/ChangeLog > index e95a837..9cf1626 100644 > --- a/libgst/ChangeLog > +++ b/libgst/ChangeLog > @@ -1,3 +1,7 @@ > +2013-04-28 Holger Hans Peter Freyther <[email protected]> > + > + * libgst/cint.c: Bind link, fsync, sync for additional C level access. > + > 2013-02-24 Holger Hans Peter Freyther <[email protected]> > > * libgst/dict.c: Remove ATTRIBUTE_HIDDEN from static methods. > diff --git a/libgst/cint.c b/libgst/cint.c > index 77c8f8c..57a6efd 100644 > --- a/libgst/cint.c > +++ b/libgst/cint.c > @@ -641,6 +641,7 @@ _gst_init_cfuncs (void) > _gst_define_cfunc ("rewinddir", rewinddir); > _gst_define_cfunc ("extractDirentName", extract_dirent_name); > > + _gst_define_cfunc ("link", link); > _gst_define_cfunc ("symlink", my_symlink); > _gst_define_cfunc ("unlink", unlink); > _gst_define_cfunc ("rename", rename); > @@ -649,6 +650,8 @@ _gst_init_cfuncs (void) > _gst_define_cfunc ("mkdir", my_mkdir); > _gst_define_cfunc ("mkdtemp", my_mkdtemp); > _gst_define_cfunc ("getCurDirName", _gst_get_cur_dir_name); > + _gst_define_cfunc ("fsync", fsync); > + _gst_define_cfunc ("sync", sync); > > _gst_define_cfunc ("fileIsReadable", _gst_file_is_readable); > _gst_define_cfunc ("fileIsWriteable", _gst_file_is_writeable); > _______________________________________________ help-smalltalk mailing list [email protected] https://lists.gnu.org/mailman/listinfo/help-smalltalk
